Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to build simple game and I just bumped on some logical problem that I am sure many of you already came across. I have a plane - floor and several sprites-trees that have tree texture on them. It basically looks like this:enter image description here What I would like to do is to add dynamic shadows below the trees. I don't want to generate the shadows in runtime - I have texture for that. By "dynamic" I mean that I can control shadow length and rotation (simulating different times of day). And here I would like to ask you for best practice for that. I was thinking about adding small plane under each tree and control it's rotation and scaling directly from the game. The other idea I had was to use vertex shader to position, scale and rotate those planes. I was also thinking about using pixel shader to combine floor texture with shadow texture. The last idea has this advantage over the others that my floor may eventually be not flat, and the shadows would still be nicely casted. Also this would allow me to have shadows close to edges of the floor (which hangs in "space") and the shadows would not stick out from the floor. I would be grateful if you could suggest me some approach to the problem.

share|improve this question
    
what have you tried so far? –  wes Sep 11 '13 at 20:16
    
Why do you feel it so important to use a texture and not compute the shadow at runtime? Smaller games (less textures) download and start faster, and on mobile, keeping under the "allowed to download via 3G" limit can make a huge difference for sales/conversions. –  Sean Middleditch Sep 11 '13 at 22:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.