Sign in to follow this  
Geometrian

Texture Blending

Recommended Posts

Hi, I finally have a working shadowmap implementation! Naturally, the next thing to do was to make it support multiple shadows from multiple lights. I took a stab at it and arrived at the following: I've color coded the two shadows to see them separately better. Unfortunately, they don't blend nicely together like they should. Here's some code:
glEnable(GL_TEXTURE_2D)
glEnable(GL_TEXTURE_GEN_S)
glEnable(GL_TEXTURE_GEN_T)
glEnable(GL_TEXTURE_GEN_R)
glEnable(GL_TEXTURE_GEN_Q)
#Evaluate where to draw shadows using ARB extension        
glBindTexture(GL_TEXTURE_2D, ShadowMap[0])
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)
glTexGenfv(GL_S, GL_EYE_PLANE, TextureMatrix[0])
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)
glTexGenfv(GL_T, GL_EYE_PLANE, TextureMatrix[1])
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)
glTexGenfv(GL_R, GL_EYE_PLANE, TextureMatrix[2])
glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)
glTexGenfv(GL_Q, GL_EYE_PLANE, TextureMatrix[3])
#Enable shadow comparison
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB)
#Shadow comparison should be True (in shadow) if r > texture
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_GREATER)
#Shadow comparison should generate an INTENSITY result
glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY)
#Set alpha test to discard false comparisons
glAlphaFunc(GL_EQUAL, 1.0)

Any way to get these to blend together? Thanks, G

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this