little stencil shadows bug (pic incl.)
hey!
i built nehe's and brett's code for stencil shadows into my project and advanced it a bit.. it actually works fine. but if i have multiple objects casting shadows or just two lights with shadow-casting enabled, the cast shadows are drawn with different transparecies althoug i always call the same funtion with the same parameters to draw the shadows:
screenshot (the white dots are the light sources):
http://www.vexator.net/neu-1.jpg
any idea why this happens? thx :)
The only way i can think of is that you
draw your shadow in mulitple passes!
What you should do, is to setup your shadow stencil, and then draw
ONE quad over the whole screen (using the shadow).
Since the stencil buffer only can have pixels as true or false,
this guaranties all shadows to look the same.
anders
draw your shadow in mulitple passes!
What you should do, is to setup your shadow stencil, and then draw
ONE quad over the whole screen (using the shadow).
Since the stencil buffer only can have pixels as true or false,
this guaranties all shadows to look the same.
anders
yeah i'm doing it with multiple passes.. it's the only way i could figure out with which i can exclude triangles from being covered by shadows :/
Quote:Original post by uncutno
The only way i can think of is that you
draw your shadow in mulitple passes!
What you should do, is to setup your shadow stencil, and then draw
ONE quad over the whole screen (using the shadow).
Since the stencil buffer only can have pixels as true or false,
this guaranties all shadows to look the same.
anders
That is not true, the stencil buffer can have up to 256 values(0-255), it is only when testing against the stencil buffer you get a true or false response.
Because of this you can and should render all shadow volumes in one pass.
Did I understand you picture wrong or is there also an error in the orientation the shadow of the cross has? if the light source is directly above it it should cast a shadow with the shape of a quad.
not if it's a 3D cross with one more axis than other non 3d ones have.
it would have made mutch more sence if the shading wasn't so odd.
it would have made mutch more sence if the shading wasn't so odd.
I only see two axes on the cross. But, it might be the shading...
edit: I looked at it again and it seems to have three axes indeed.
edit: I looked at it again and it seems to have three axes indeed.
That lesson doesnt do the shading correct 100%.
What you want to do is.
Draw Scene Normaly with Lighting enabled
Draw the Volume shadow to the stencil buffer
Draw The Scene only in the Shadow Stencil with lights disabled.
There is no transparency thingy needed. And this effect is better since if it is a red light then making it darker isnt correct.
Although that effect allows you to make shadows other colours for example instead of darkening the shadow fragments you can lighten it creating a alien type of view.
Yes when you setup your pixelformat you chose a stencil buffer size.
1,4,8 are accepted by most hardware.
If you are using a 1bit then true it can only hold true/false(0,1) but if its 8 bits thats not true.
What you want to do is.
Draw Scene Normaly with Lighting enabled
Draw the Volume shadow to the stencil buffer
Draw The Scene only in the Shadow Stencil with lights disabled.
There is no transparency thingy needed. And this effect is better since if it is a red light then making it darker isnt correct.
Although that effect allows you to make shadows other colours for example instead of darkening the shadow fragments you can lighten it creating a alien type of view.
Quote:Original post by uncutno
The only way i can think of is that you
draw your shadow in mulitple passes!
What you should do, is to setup your shadow stencil, and then draw
ONE quad over the whole screen (using the shadow).
Since the stencil buffer only can have pixels as true or false,
this guaranties all shadows to look the same.
Yes when you setup your pixelformat you chose a stencil buffer size.
1,4,8 are accepted by most hardware.
If you are using a 1bit then true it can only hold true/false(0,1) but if its 8 bits thats not true.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement