Sun Lamps Shadows

I was excited about the Sun Light Shadows in 2.64, but I can’t get them to work in the GE. Looking at the release notes, I should be able to, right? A simple scene with a ground plane and a cube looks correct when rendered, but no shadows appear when I “play” the scene with the Engine.

Am I misunderstanding the release notes, or am I missing something else?


Are you using GLSL textured view, have you enabled shadows in the lamp settings

For now, the Sun Shadows are slightly broken. It is possible that your Sunlight just must be repositioned, it will not cast a Shadow anywhere behind its own WorldPosition. Unfortunately, they also are broken in that they look smooth and nice in the Viewport unless you run the Game, where they suddenly look like Simple Shadows when actually set to Variance. As said, broken – I hope it’ll be fixed soon. :expressionless:

  1. Make sure you have materials on objects.
    2.Check the Buffer Length and Bias.
    3.Toggle between Variance And Simple.
    4.Try and move the Sun away.

It’s not really broken. As Blending mentioned, move the sun lamp away to smooth the edges out.

@OP - For shadows to appear, make sure the objects have materials. Only objects with materials can catch shadows.

@SolarLune: Well, that’s an Option, but then the Shadow becomes too soft, almost not there anymore so soft it is, except if I turn the Resolution (Size) up skyhigh, which enormously drags the Performance down. ;_ ;

I am still not sure what is causing the distance issues with the sun shadows. I looked into it once and could not find the problem (I may take another look soon).

As far as shadows working behind the sun, I don’t think I will ever be trying to make that work. For a light to cast shadows, it acts like a camera and renders the depth values of the scene from its point of view. In order to make the sun cast shadows behind it, it would have to render the scene multiple times (likely 6). I have found it is usually simple enough to position the sun in such a way that it affects the area I want to shadow.

You can imagine the area that the camera for the sun light affects as a cube that starts a distance away from the sun equal to the near clipping value, ends at the far clipping value, and has a width and height equal to either the frustum size or two times the frustum size (I can’t remember which at the moment).

Ô, just to be clear, I didn’t actually mean the Lack of Shadows beyond the Lightsource were one of the »broken« Things, because I understand that and just as you say, it is no Problem to handle. (I really mean those Distance Issues.) But thanks for that Response as well. :}

Yup, I am using GLSL textured view and shadows are enabled.

I moved the light, applied a material to everything, toggled Simple and a few other things with no success. I eventually nuked the light and started again. Apparently my Clip End was set to a really high value and as a result it wasn’t showing the shadow in the GE/Viewport. Not sure why that is (I would think that it just effects where to stop shadowing objects), but it works now. Out of curiosity, why is that? Should I keep any other ‘rules of thumb’ in mind?

Thanks for the responses!

Based on my understanding of shadows: When you have a lamp with shadows, it renders the scene from that angle, giving a depth image. Then, when the camera renders the scene it gets the position of each pixel on the “shadow map” If the distance of the pixel is farther away from the lamp then the corresponding pixel on the shadow map is, it’s in shadow. If you set the clip end far away, the shadow map gets really compressed (not much difference in the values for objects at different distances, etc) Then when you try to calculate if its in shadow, its ends up being really close to the shadow map depth, and puts it as no shadow. Just a theory.

I believe Mokazon’s correct. As far as I know, a shadow lamp is pretty much just a camera, and just as with cameras, having absurdly high and exceptionally low clipping values makes for poor depth sorting. As an example, place an object 0.1 Blender Units away from another, like a smaller plane clearly in front of a cube. Increase the clip end of the camera, and eventually, the plane might just disappear behind the cube. That’s why you should keep your clipping values sensible - as small as possible, in fact, to achieve the scene view distance you need. If you need more distance, you might try with a background scene instead, perhaps even with a plane and the video texture module rendering out the scene with a separate camera.