Documentation Contents On-line Documentation Tutorials CCP4mg Home

Lighting, Shadows and Shaders

The position and nature of the light source(s) affect the appearance of solid objects such as surfaces, spheres, ribbons and cylinders. The position of lights particularly affects where highlights appear on objects and where shadows are cast by them.

Radically improved lighting can be achieved on most computers by turning on shaders:
Edit->Preferences->Display->Drawing quality (Linux/Windows).
QtMG->Preferences->Display->Drawing quality (Mac).

Check the "Use shaders" box and press "Apply" button. (Note that turning on shadows or occlusion, described
below, will automatically turn on shaders.)

The lights can be changed from the Lighting interface which is accessed via the Display menu. By default there is one light source turned on. Up to 8 light sources are possible. Each light can be selected from the menu at the top and individually turned on/off.


The light position can be moved around the display by holding down the left mouse button and moving the mouse in the sphere picture in the bottom right. This simulates moving the light around a hemispherical surface centred on the graphics window rotation centre.

The sliders scale the diffuse, specular and ambient components of the light. The red, green and blue components of each of these can be altered by pressing on the coloured button beside the slider.


Ambient light gives a completely flat, bright surface. It lights equally everywhere.
Specular light gives one bright patch on an otherwise unlit surface, like the highlight on a glass paperweight.
Diffuse light is soft light.
A combination of specular and diffuse light gives a good sense of depth and an attractive shiny surface.

Shadows and occlusion

Shadows can be used to add realism to a scene by accentuating the sense of depth. The check box on lighting menu turns them on and off. Occlusion is a method of darkening more buried parts of structure. CCP4MG's occlusion method is based on "Screen space ambient occlusion" (SSAO) as poularised in modern computer games. However CCP4MG actually occludes the diffuse lighting component. Future versions will have option to occlude both diffuse and ambient.

The effects of shadows and occlusion are shown in examples below:

The effects of shadows and occlusion:
Top left - no shadows or occlusion; top right - shadows; bottom left - occlusion; bottom right - shadows and occlusion.
No shadows Shadows
Occlusion Occlusion and shadows