Jump to content
  • Advertisement
Sign in to follow this  
LancerSolurus

Single pass multi-depth buffer generation

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

I've recently implemented shadowing in my game engine. Currently it only has one shadow map and I want to expand it to at least 3 to 4. I was going to try to attempt doing it using a MRT but ran into the issue of only being able to use 1 depth/stencil buffer which is required to keep the depth pixels in order. So any ideas on how to accomplish this? Using a single texture for all will get around the depth/stencil buffer problem but haven't been able to come up with a way to use the MRT or a single channel to a 1/4 slice of the texture.

 

I am looking to use a cascade shadow mapping technique since I simple calculate a quaternion based position for the shadow map placement directly in front of the player. The reason is I can easily fine-tune the overlap amount.

Share this post


Link to post
Share on other sites
Advertisement

You can use a single texture but divide it into multiple parts (by adjusting the viewport during rendering and the loopup inside the shaders).

If you have 4 cascades, divide the texture into four parts so that the first quarter (1 in the ascii art) is cascade 0,the second (2 in the ascii art) would be cascade 1.....

----------------------

|            |             |

|    1      |     2      |

|            |             |

----------------------

|            |             |

|    3      |      4     |

 

|            |             |

----------------------

Share this post


Link to post
Share on other sites

Well that is along the lines of how I would like to do it but AFAIK there is only one viewport that can be active at one time. Also, I was looking into the possibility of using POSITIONx (x= 0 to 3) to provide the correct coordinates, problem is MS documentation on that command is pretty sparse as to what it's used for beyond POSITION0.

Share this post


Link to post
Share on other sites

With D3D9 there is indeed only one viewport active at a time.  With D3D11 there is an array of both scissor rects and viewports that are available to use.  Unfortunately, I don't think there is a way to render your geometry into multiple areas with a single pass through the pipeline.

 

You can minimize the cost of multiplying the geometry by using instancing to render multiple copies of your geometry, and then use the instance data to manipulate the geometry into the right portion of the screen.  You would have to profile to get a good idea of how the performance compares to just rendering it four times, but it would be worth a try I suppose.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!