Shadow Mapping Ambient

Thanks in advance for any help…

I don’t want my shadows to be pitch black. It looks like ARB_shadow_ambient or GL_SGIX_shadow_ambient both address this, but I can’t seem to get them to work.

Here is a small bit of code:

//Init Depth Map Texture
glGenTextures(1,&m_depth_map);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D,m_depth_map);
glTexImage2D(GL_TEXTURE_2D,0,m_depth_format,TEX_SIZE,TEX_SIZE,0,GL_DEPTH_COMPONENT,GL_UNSIGNED_INT,0);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_BORDER_ARB);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_BORDER_ARB);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_COMPARE_MODE_ARB,GL_COMPARE_R_TO_TEXTURE_ARB);
glTexParameterf(GL_TEXTURE_2D,GL_SHADOW_AMBIENT_SGIX,0.5f);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_COMPARE_FUNC_ARB,GL_LEQUAL);

But the shadows are still solid black. Everything still shadows correctly, and my understanding is that the only thing I need to get non-black shadows is the call to:
glTexParameterf(GL_TEXTURE_2D,GL_SHADOW_AMBIENT_SGIX,0.5f);

Should’nt this change the luminance of the affected fragments from 0.0 to something else?

Any help is greatly appreciated…this is driving me nuts…

Even better, any other technique to get non-black shadows is welcome - must work on GeForce 4 and above…

I would guess that it’s not working because the extension is not available on geforce cards (at least up to v56.56 drivers and fx 5900’s - ie. my configuration). Might be different for later drivers (I have doubts) or cards…

I am not aware of any other techniques that can be used to get the desired effect with shadow buffers.

Thanks rgpc - That does definitely explain why it isn’t working…

Is there anyway to accomplish this in geforce 3+ hardware using register combiners or something?

Thanks again…

Yep. ARB_shadow_ambient has very light support. I used register combiners to achieve transparent shadows.

PT - Can you elaborate on how you used register combiners?

Thanks!!

Sorry I can’t supply a code sample right now. But the approach I took isn’t very sophisticated. Here’s the gist of it:

shadow_color * (1 - shadow_texture) + fragment_color * shadow_texture

. set a constant color to be grey
. for the shadow color, blend the constant color with the incoming fragment color to darken it
. use your shadow map texture result (which is 0 or 1) to modulate between the shadow color and the fragment color

BTW: Having set up register combiners has made me really appreciate high level shading languages.

Good luck!

could you supply code? ^^