Jump to content
  • Advertisement
Sign in to follow this  
AzureRain

Min-Max mipmap

This topic is 3474 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!