🔒 Locked
stencil shadows ...
Advertisement
Original Post
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
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
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
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
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
i''ve put a shot online if anyone care to look at
http://perso.wanadoo.fr/majestik666/cube.jpg
thanks!
http://perso.wanadoo.fr/majestik666/cube.jpg
thanks!
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.
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
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
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
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
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
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
me, again and again 
i found where the leak was, in fact
some of my edges are wrong outside of Maya...
which is very strange, cause i check the order of the
vertices from the faces list (which i use to render the
faces of the objects...)
i have to invert a few edges and the shadow is correct ...
does anyone have a simple edge creation code
to make them by myself instead of exporting them from maya ?
thx
i found where the leak was, in fact
some of my edges are wrong outside of Maya...
which is very strange, cause i check the order of the
vertices from the faces list (which i use to render the
faces of the objects...)
i have to invert a few edges and the shadow is correct ...
does anyone have a simple edge creation code
to make them by myself instead of exporting them from maya ?
thx
For each face add all 3 edges through a function. This function checks if it''s already in the edgelist. If it doesn''t exist, add it to the first face of your edge structure. If it exists, my method ignores it, so you can have stuff like planes casting shadows. If it exists in opposite winding order, add it to the second face of the edge structure.
thanks for all your help guys !
i rewrote my maya exporter with a custom edge export thing
and it works perfectly ...
what are the main optimisations things i could try for the
stencil shadows ?
i tried the GL_EXT_STENCIL_TWO_SIDE extension, but
it''s not hardware on my board (Ge2 GTS) so .. around 0.01 fps
emulated
any other idea ?
thanks again!
i rewrote my maya exporter with a custom edge export thing
and it works perfectly ...
what are the main optimisations things i could try for the
stencil shadows ?
i tried the GL_EXT_STENCIL_TWO_SIDE extension, but
it''s not hardware on my board (Ge2 GTS) so .. around 0.01 fps
emulated
any other idea ?
thanks again!
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement