Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Majestik666

stencil shadows ...

This topic is 5790 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i''m currently implementing stencil shadows in my engine and i''m confronted to a performance problem, i spend most of my time rotating the normal of each face to check if it''s facing or not the light. is there a trick to improve this part of the code ? thanks

Share this post


Link to post
Share on other sites
Advertisement
Bring the light position into object space instead of all your normals into worldspace.

Share this post


Link to post
Share on other sites
thx for the help ...

well now ...
my shadows do not show up with a 2 pass rendering
(ambiant then illuminated).
is there an easy way to get a shot of
the current stencil buffer ?

thx

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I''ve been looking for a way for quite a while, but I''ve given up. I am also implementing stencil shadows. The only way I can think of getting a quick view of the stencil buffer is by way of the D3DX function IDirect3DDevice8::GetDepthStencilSurface(), you can check MSDN for more info on the function... If u''re using OpenGL, I''m sure there is an equivalent function. Good luck!

Chris
<ctoan>

Share this post


Link to post
Share on other sites
Are you using additive blending? Using SRCBLEND_ONE and DESTBLEND_ONE, each lightpass will slowly fade out the previous shadows. Use stencilpass always, stencilref 0x00, stencilfunc equal, for each light pass, so it only renders light where there is no shadow.

Share this post


Link to post
Share on other sites
that''s what i''m doing
but i have a problem and don''t really know how to get rid of it...
in fact all my objects are modeled in Maya, and
i when i export the mesh, i also export a edge file
containing all the need edge informations
(vertex indices, and normal for each face),
but i thin my problem now is that my
vertices are not in the right order
all the time ...

how can i know or reorder my vertices
to make my shadow volume to render correctly to
the stencil buffer?

thx

Share this post


Link to post
Share on other sites
That screenshot is very unclear I''m afraid. It doesn''t seem the shadow caps are wrong cos you''d really notice with huge black tri''s going into infinity. So it''s probably not the winding order. Doubt Maya would screw up with something that trivial and important anyway. You could easily generate your own edge information to test though.

Share this post


Link to post
Share on other sites
in fact after a lot of tries, i achieve a strange result,
depending on the camera position,
the shadow can display correctly or not...
here are two shots of the cube from different angles

wrong render :
http://perso.wanadoo.fr/majestik666/cube2.jpg

correct render :
http://perso.wanadoo.fr/majestik666/cube3.jpg

wrong render with wireframe :
http://perso.wanadoo.fr/majestik666/cube4.jpg
http://perso.wanadoo.fr/majestik666/cube4_w.jpg

the gray quads are rendered into the stencil buffer
and the whites segments are the normal to the
shadow volume quads

if it can helps ...

thx


Share this post


Link to post
Share on other sites
sorry again
i found a Huge mistake in my shadow volume rendering code ...

now the shadow display mostly correctly ..
but i still have a problem
i put some shots online,
front shadow volume faces :
http://perso.wanadoo.fr/majestik666/volume_front.jpg
back shadow volume faces :
http://perso.wanadoo.fr/majestik666/volume_back.jpg

and the result :
http://perso.wanadoo.fr/majestik666/volume_final.jpg

as you can see there''s a little problem still with
my shadow volume generation, any idea ?

thx

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!