shadows doesnt work

I would like to know why after I add texture to my object shadows doesnt work anymore in multitexture mode in blender game. I am attaching smaller files but I have some where it doesnt work even in glsl mode. Also when I remove texture and there is only color from uv projection shadows works normally.


cokecan.blend (410 KB)

There are two problems with your lighting setup.

1.) If you want to have a shadow you have to use some light casting a shadow.
In the reference blend file you are using a “Lamp”-lamp which is the weakest lamp of them all. The “Lamp”-lamp is mostly used for setting up some light accents like a red light emitting from an LED. (IMHO the term “Lamp” is somehow misleading in Blender)

2.) The light-source is placed far, far away from the coke can.
The can has a height of approx 0.8 Blender units but the lamp is placed approx 59 Blender units away from the can object.

So the problem is that you are using a single LED light source 60 meters away to light up an 80 cm can.

The solution is to switch to a “Sun”-Lamp instead. This light is special in that you can place it in your scene wherever you want, like the real thing. The light energy will always be the same. The casted shadow will be influenced by the X and Y rotation only.

I attach the corrected file. You can work from there. The light intensity can be adjusted with the Energy-field.
cokecan_Sun.blend (433 KB)

And I added some sky background which can be ticked on and off in the lamp setup as well.

thank you Ulf B., I first thought there is no shading but I was wrong. In game render my textures are still missing contrast between shadow and light but I fixed it by setting textures -> influence -> blend -> Linear Light, I hope its the right way to do it.