Sign in to follow this  
Followers 0
mv348

OpenGL
Shadow map arrays - appropriate data structures and functions?

2 posts in this topic

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
0

Share this post


Link to post
Share on other sites
The first tutorial (regular shadow mapping) is [url="http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/"]here[/url] 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 [url="http://developer.download.nvidia.com/SDK/10.5/opengl/src/cascaded_shadow_maps/doc/cascaded_shadow_maps.pdf"]here[/url] 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!
0

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  
Followers 0