Sign in to follow this  
AzureRain

Min-Max mipmap

Recommended Posts

AzureRain    122
Hi all, I'm trying to generate a hierarchical shadow map (HSM), that is, a min-max mipmap, but need some help. I generate my usual shadow map with this call: glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, 0, 0, shadowWidth, shadowHeight, 0); But now I want to adapt it so it generates a HSM instead, and need some pointers. This is my attempted code thus far: glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, // base level the same as the full shadow map 0, 0, shadowSize, shadowSize, 0); for(i = 1; pow(2,i) == shadowSize; i++) // for level i of the mipmap { glBlendEquationEXT(GL_MAX_EXT); // use max blend glCopyTexImage2D(GL_TEXTURE_2D, i, GL_DEPTH_COMPONENT32, 0, 0, shadowSize/pow(2,i), shadowSize/pow(2,i), 0); glBlendEquationEXT(GL_MIN_EXT); // use min blend // unsure how to store minimum value on separate channel } glBlendEquationEXT(GL_FUNC_ADD_EXT); // restore standard blend mode I don't know how to manipulate the colour channels of the mipmap directly as I use glCopyTexImage2D to read directly from the depth buffer. Any help is greatly appreciated, thanks in advance!

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