Skip to main content
gamedev.net
🔒 Locked

shadows problem

Started by The Wizard Of Oz Nov 2, 2002 at 5:46 AM 3 replies 350+ views
Original Post
The Wizard Of Oz
The Wizard Of Oz
hi! i''m working on a terrain generator and i''d like to add some shadows... now, i''ve read through lesson 28 many times, but when i implement it in my code it just doesn''t work... i''d like to make a crate that casts shadows on my terrain.. does anybody know where i can find a good tutorial on this? or maybe give me any sugestions on why my code woun''t work? thanks in advance follow the yellow brick road
follow the yellow brick road
The Wizard Of Oz
The Wizard Of Oz
well, i''ve re-written it from beginning to the end and got a beautiful landscape, some neat looking vehicles, a crate and NO shadows...
i don''t know what i''m doing wrong...
i''ve even remembered to replace 0 with 1 in CreateGLWindow() function regarding stencil buffer...



follow the yellow brick road
follow the yellow brick road
Raduprv
Raduprv
I don''t know how exactly you are doing it, but, if you don''t plan to add dynamic lights, then, by all means, precalculate all the shadows before, using some ray tracing, and store the shadows (on or off) on each vertex (height), then, if the shadow is on, on that vertex, change the color of that vertex, if not let it use the default color. Sure, it won''t look THAT nice, especially if your terrain is too scalled, but hey, it''s fast and easy
lc_overlord
lc_overlord
Don''t know if this will help but this is how i do it.
But i render the object after i have made the shadow stencil map

my stencilbuffer is cleared to 1 instead of 0 and i do a z buffer render first

first frontface
glFrontFace(GL_CCW);
glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);

then backface
glFrontFace(GL_CW);
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);

then render everything.
This takes longer time but enabels me to do dynamic shadows a la DOOM3.

The rendering of the shadow is usuarly not the problem it''s figuring out the shadow volume, fiddle with it and see what happens.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.