Orthographic Shadows

I have compared doing a shadow with a spot light in 2.63a with doing a shadow (orthographic) using a sun lamp in 2.64 - latest build available from http://builder.blender.org/download/

This was done using a MacBook Pro with Intel HD Graphics 3000 512 MB.
Comments and corrections are welcome. The idea for doing the shadow is from:

Many thanks to Moguri and Kupoman for orthographic shadows and more!

I need to find a place to upload the .blend files. Any suggestions.


Mediafire’s fine for me. Also note that shadows look different in the game engine than in the 3D view - the smooth variance shadow maps have a bug in them, if I recall, and get turned to simple shadow maps when the game starts.

Thanks SolarLune. I have posted the blend files to: http://www.mediafire.com/?f49rwod59fsu8jf and http://www.mediafire.com/?18il3o06x8e8045

You need to tweak the Frustum size and the Clip End.

I had the Frustum size set to 10. Lower values make the shadow edges sharper. Higher values make the
shadow edges fuzzier. I assume you want the shadow edges fuzzier. Is this correct? A frustum value of 20 gives good fuzzy shadow edges. What do you think?

Using shadow264.blend and the latest build (to get an orthographic shadow), I did a render using “Blender Render” (non-real time) and got a very good shadow and you can see below. I then wanted to create a similar shadow using the BGE. I changed the energy level of the sun lamp from 0.8 to 0.3. I also changed the size of the frustum from 10.0 to 5.0. Still, as you can see below, the result is not as good.

Changing the buffer type between simple and variance appeared to have no affect.
Changing the buffer size between 1024 and 2048 appeared to have no effect.

Does someone know how to get shadows in the BGE that are more like those done with “Blender Render”?


Try turning off specularity for the shadow-casting lamp. I believe there’s some lighting issue with the shadows, though - you have to have both Specular and Diffuse lighting enabled for a lamp set to Shadow-Only to cast shadows.

change the bias to .05…lines it up for me

You are correct. Turning off Specular or Diffuse for the Sun lamp turns off the shadow.

I should have explained that what I am concerned about is that the shadow done in the game engine has so much color in it.
The shadow done using “Blender Render” is grey - like shadows in the real-world.

Does someone know how to get the color out of the shadow when using the BGE?

It looks like an anomaly in the lighting code. The way the game engine handles shadows is apparently different from the way the renderer does. The only fix is to change the source code itself. Is your lamp set to only shadow(out of curiosity)?

Yes. The sun lamp is set to only shadow.

It’s easier to get a consistent shadow if you use the sun lamp normally, with lighting. Use a hemisphere lamp to set ambient light levels.