The light sources in MolScript are global: A light source created at some point in the input file will illuminate objects which have been created in the same file, no matter where.
There is often a limit to the number of light sources that can be defined in a scene, depending on which output format is used, and which computer system is used to view the resulting scene. For the OpenGL output mode there is a maximum of 8 light sources (including the headlight).
It should be noted that the lighting features apply to graphics objects with surfaces, not to those consisting only of lines, labels or points.
The interplay between the different light source parameters and the surface properties are quite complex, and is not be described here. See the descriptions in the OpenGL Programming Guide (Neider et al 1993) or the Annotated VRML 2.0 Reference Manual (Carey & Bell 1997) for exhaustive descriptions.
In MolScript, the diffuse colour is taken from different parameters depending on whether the colourparts parameter is switched on or off.
If colourparts is off (the default), then the diffuse colour is determined by the planecolour, the plane2colour and atomcolour parameters (depending on the graphics object).
If colourparts is switched on, then the diffuse colour is determined by the residuecolour or atomcolour parameters (depending on the graphics object).
The specularcolour determines the specular reflection of a surface regardless of its diffuse colour. It is set to black (that is, no specular colour) by default.
The emissivecolour parameter determines the emissive colour of a surface regardless of its diffuse colour. It is set to black (that is, no emissive colour) by default.
Note that using an emissive colour for an object does not turn it into a light source illuminating other objects in the scene. If you want an atom or another object to actually behave as a light source, then you must create a light source at that position.
The transparency parameter affects all graphics objects, including lines, labels and points. The value is by default set to 0.0, which means no transparency.
It has been noted that the VRML 2.0 files display incorrectly in some browsers when partial transparency has been applied. A surface specified with transparency 0.9 is almost completely opaque, when it should be very nearly translucent. This seems to be a bug in some commonly used browsers, and is, as far as is possible to ascertain, not due to MolScript. A value of 0.5 seems to give correct results.
The implementations for the OpenGL output and VRML 2.0 output modes are very similar and should be correct.
The PostScript output mode has no implementation of light sources or material surface properties. The closest it comes to lighting are the shading and shadingexponent parameters which determine the shading of surfaces as a function of the angle between the surface normal and the view direction. This is in effect a simple calculation of the effects of a headlight.
Another important difference exists compared to the other modes: In PostScript, all graphical objects are delimited by lines drawn around the surfaces. This is very important to create the proper visual effects for the various graphics objects in this output mode. Therefore all graphics state parameters that affect lines (linecolour, linedash and linewidth) also affect the appearance of most other graphical objects. This is not the case for the other output formats.
A related difference is the depthcue parameter, which affects many different objects in the PostScript output mode. It does not affect any other output modes. The basic idea is that the distance from the object to the viewer affects various appearance details, such as the size of labels or the width of lines.