Game Engine shadows problems in 2.62

Hi, please forgive this newbie question but I am struggling to get realtime shadows working in Blender GE 2.62.

I can make shadows appear in the 3D viewport (pic #1) and I can get shadows to render but when I press ‘P’ odd things happen. If I use a spot light, everything looks great until I press ‘P’ and then the illuminated areas goes black and the non-lit areas become visible (pic #2). No other lights seem to give me shadows in BGE (including sun - which I thought was supposed to in this version).

I have GLSL turned on and I am using an NVIDIA GeForce GTX 260 graphics card, which is not top of the range but isn’t too shabby either.




Since this works for other people, I assume I’m doing something wrong. All help appreciated!

I think I know what’s going on.

  1. Only spotlights have shadows. The Harmony branch has orthographic sun shadows, but that has yet to be merged into the official build. That should happen around 2.64 (we’re currently at 2.62, so not much longer).

  2. Since spot shadows work for you, it might be an issue with lacking materials. Make sure your objects have materials applied to them - then the shadows should work.

  3. Also, try a basic scene (just a couple of cubes and a spot light, for example). This way, problems can be isolated.

screenshot shows that your spotlight is oriented down when in game mode, right?
Are you using Track To constraint for the spotlight? If so, use instead “Edit object” --> “Track to” actuator in Logic bricks.
Object constraints does not work in BGE. Except for “Rigid Body Joint”.

Edit.
it would be nice to hide things in UI which are not functional in BGE… or actually add functionality for them :slight_smile:

Thanks for the hints, but unfortunately shadows are still failing for me.
@SolarLune: I double checked and I do have materials applied to all objects in the scene and, as this is a test, I only have the one light which is a spot. The only other objects in the scene are a plane, a wide, flat cube and the cube floating just above it (ignoring the skydome).
@martinsh: I did add a track to constraint as you guessed but the scene is static. However, I will bear this in mind for later.

Is there some other essential setting I am missing for BGE, since I can see shadows in the 3D viewport even after switching from Blender Render to Blender Game (just not when I press ‘P’)?

UPDATE:
I just tried deleting the spot light and adding a new one. Now the scene is properly lit when I press ‘P’ but no shadows. In fact, I can’t even reproduce the shadow you see in picture one in the 3D viewport. The wierd thing is that I am on the SAME machine. If I re-load my model, I get the shadows back in the 3D viewport but the lighting goes screwy again when I press ‘P’. Is this a bug or possibly a glitchy video driver?

I am very confused! All suggestions are welcome!

UPDATE #2:
I repeated the experiment - deleting the spot-light and adding another one. Now I get shadows in the viewport AND when I press ‘P’ (woot!). But I still don’t understand why it failed to start with.

UPDATE #3:
I think I’ve got it! It is related to distance. Using the standard lamp within its standard distance everything works as you expect. However, if I move the lamp away, shadow now fail despite increasing the distance of the light and the Clip-end parameter correspondingly. Either this is a bug or my stupidity… so… what am I doing wrong? :slight_smile:

Ah, decrease the Bias size of the shadow in the light panel - this is how ‘sensitive’ it is to objects that cast shadows. The further away it is from objects, the lower the bias needs to be to pick it up.

Perfect - thanks and sorry for being ignorant!