Configuring Shadows

 

This tutorial demonstrates how to configure shadows in conjunction with the OgreMax viewports.

First, a simple scene should be created. This scene has a plane, a sphere, a box, a target directional light (with shadow casting enabled - the default), and a camera:

The OgreMax viewports only support OgreMax materials, so such a material must be created and applied to the meshes in the scene. You can modify the material in whatever way you like, however, you must configure the material to receive shadows. This is achieved by checking the Receives Shadows setting on the material. This setting is checked by default:

After applying the material to the meshes in the scene, create an OgreMax viewport. Depending on whether you made any changes to the material (this tutorial added the wood.tga file to a texture unit), your scene will look something like this:

Next, open the Environment page of the Scene Settings dialog:

Stencil shadows are the easiest to configure. To see this, select Stencil Modulative for the Technique. The OgreMax viewport will then look something like this:

It is far more common to use texture shadows. Since texture shadowing is itself a complex topic, this tutorial will use simple projected shadows.

Select Texture Modulative for the Technique, then uncheck the Self Shadow setting since projected shadows do not perform self shadowing. The OgreMax viewport will then look something like this:

It appears as though shadows are disabled. The problem is that the ground plane is being rendered into the shadow map, and since self shadowing has been disabled, it doesn't receive the shadow at all. The solution is to disable shadow casting for the ground plane. This is achieved by selecting the ground plane, then right-clicking to bring up the OgreMax viewport menu. Uncheck the Cast Shadows item:

After making that change, the OgreMax viewport will then look something like this:

If you have followed the steps of this tutorial and still don't see shadows, try adjusting the Far Distance setting of the Environment page, setting it to a distance from the camera that encompasses the entire scene. Alternatively, you can try moving the camera closer to the objects.