PDA

View Full Version : stenciled shadow volumes and shaders



Nick's a Novice
10-10-2007, 10:12 AM
Is there anything I need to do specifially to make my stencilfunc work in accordance with my shader? My terrain and shadow volumes was working fine until I switched on my shaders. Everything still seems to be working ok except with the shaders it is redrawing the entire terrain as if it was contained in the shadow volume.

k_szczech
10-11-2007, 04:50 AM
Stencil test is independent from shaders. So it must be something you changed recently. Like replacing fixed-functionality lighting model with your own shader.

Keep in mind that if you mix geometry drawn with shaders and fixed functionality, ou should use ftransfrm() in shaders. It may also have something to do with your problem.

Nick's a Novice
10-11-2007, 08:44 AM
I wish that were the case, but the geometry hasn't changed. The only thing I changed about the lighting is to have it handled by the shader. On the first Pass I am mixing a bright color with the terrain, and on the second pass I'm mixing a darker shadow color. I know the geometry is all the same because the grass billboards not drawn by shaders are still having shadows cast upon them.

My vertex shader is very basic and uses ftransform(). For the two passes of the shadow volume I am calling the same fragment shader with simply a different value input to the alpha with which I mix the color.
color = mix(color, vec4(0.0,0.0,0.0, 1.0), LightIntensity)

Could the problem lie in calling the shader to shade a certain area twice?

knackered
10-11-2007, 12:04 PM
have you tried changing your drivers? try it on another machine?

Nick's a Novice
10-11-2007, 01:41 PM
I have the newest drivers as of last week from NVidia. I also tried it on another machine with the same reseult. I don't expect this to be a driver issue because the shaders are working just not in conjunction with the stencil buffer.

knackered
10-11-2007, 01:58 PM
I wouldn't be so sure, I had a problem with sub-pixel triangles disappearing but only when using a vertex shader and multisampling - no problem with either disabled. Turned out to be a driver bug.

Nick's a Novice
10-12-2007, 10:08 AM
I tried it again on multiple pc's with various graphics cards and the same problem persists.