stenciled shadow volumes and shaders

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.

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.

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?

have you tried changing your drivers? try it on another machine?

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.

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.

I tried it again on multiple pc’s with various graphics cards and the same problem persists.