Description:
I am using GL_ARB_shadow to compare a texture R coordinate to a depth texture’s value to determine shadowed/unshadowed fragments in hardware.
I’m doing this to cast shadows on arbitrary textured objects.
I am using GL_ARB_multitexture to apply the primary texture to the object’s polygons while comparing the R for the depth texture bound to the secondary texture unit, to produce a luminance or alpha result for the second texture unit.
Question(s):
Is there a way to control the luminance/darkness of the shadow? For example, I don’t want the shadows to appear completely black. Specifically if the compare results in a luminance value, is there any way to force the alpha value of 0.4 to go with all the generated luminance values?
What is the best way to control the darkness of the shadow when employing a multitexture render and shadow compare?
(I’ll add one more caveat: I’m looking for a technique that works on semi-recent NVIDIA hardware)
Well, since a shadow is the lack of light from a specific lightsource it should be black if you only have one direct light.
But opengl has the nice thing called ‘ambient light’ to simulate the light that been reflected around so much that you dont know where its origin is.
I know that there exist some extension handeling the shadowpart, but its just as easy to draw the whole scene with only ambient first, then draw it again with the rest of the light and shadows.
Does anyone have a suggestion that is not multi-pass?
Rather than using ARB_shadow, do the comparison in a shader. There, you’re not culling the fragment; you’re just getting a 0 or 1 value telling you if you’re in shadow or not. You can build the lighting equation based on this. For example, you can say: ambient + shadowValue * lightResult. All in one pass.
That sounds cool! Much more flexible. I wrote shaders for RenderMan about 12 years ago. I guess its time to learn about shader programming with OpenGL.
Can anyone suggest a good starting place for diving into the topic of using shaders with OpenGL?
Sorry to revive such an old topic, but I found this while I was searching for a solution to my problem. Basically, it’s the exact same thing as he explained in the very first post. The only difference is that I’m rendering multi-textured objects and applying the shadow map on the 4th texture unit, Gl_Texture3, using display lists.
Basically, I’m just wondering if there is any way to apply a lower alpha value to the depth texture. I realize that you can’t actually poke an alpha value into the depth texture itself, but I can’t seem to grasp how to blend it with the output from the previous texture unit, without appearing totally black.