Jump to content
  • Advertisement
Sign in to follow this  
mv348

OpenGL Shadow map arrays - appropriate data structures and functions?

This topic is 2268 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

So the tutorial I followed for single shadow mapping uses the following datastructures/functions:

1. Shadow map data type (OpenGL): 2D texture (bound to FBO)
2. Shadow Map data type (GLSL): uniform sampler2DShadow
3. Function to lookup shadow data (GLSL): texture( ) // standard GLSL function

But the tutorial for cascaded shadows (which I'm trying to setup) uses the following:

1. Shadow map data type (OpenGL): 3D texture (bound to FBO)
2. Shadow Map data type (GLSL): uniform sampler2DArray
3. Function to lookup shadow data (GLSL): texture2DArray( )

Now the first tutorial is significantly more recent, and reflects how my code is currently set up. So I was wondering what is an appropriate way to adapt for multiple shadow maps while maintaining the style of the first approach?

Is there such a thing as a sampler2DShadowArray? (I couldn't find this via googling but perhaps it has another name) Edited by mv348

Share this post


Link to post
Share on other sites
Advertisement
The first tutorial (regular shadow mapping) is here but you'll have to scroll down to "Stratified Poisson Sampling" to see fragment shader code as it appears in the accompanying source code (It uses the 'texture' function, rather than the 'texture2D' function.

The second tutorial (cascaded shadow maps) is here but if you choose to look at the accompanying source code, there are a variety of shaders saved because the program lets you choose your fragment shader for a variety of options. The best one to look at would be "shadow_multi_leak_fragment.glsl".

Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!