PDA

View Full Version : One pass shadow mapping with ambient



CatAtWork
08-25-2003, 08:21 AM
Given two texture units, ARB_shadow, and ARB_texture_env_add, how do I draw geometry in one pass with shadows that just darken the scene, rather than fully blacken it? ARB_shadow_ambient is not available.

Preserving detail underneath the shadow is what my main goal is. Can't send the geometry twice, as it's huge. This is probably fairly basic for most of you, but I've never done much with multitexturing. I'm reading up on the spec, so I should be able to figure out what do to eventually. (Following ARB_shadow_ambient.)

glActiveTextureARB( GL_TEXTURE1_ARB );
glDisable( GL_TEXTURE_2D );
glBindTexture( GL_TEXTURE_2D, GL_GetTexture("black") );
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_????);


glActiveTextureARB( GL_TEXTURE0_ARB );
glEnable( GL_TEXTURE_2D );
glBindTexture( GL_TEXTURE_2D, depth_texture );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB );
glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_???? );
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_???? );

drawGeometry();

Thanks!

[This message has been edited by CatAtWork (edited 08-25-2003).]