Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Shadowmapping a big scene


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 mankut   Members   -  Reputation: 117

Like
0Likes
Like

Posted 28 April 2013 - 10:20 AM

I am trying to shadowmap a large terrain, I position my light that it is always at the position of the player and looking at the player, the problem is that the shadows now move with the player creating a weird effect where it looks like the shadows are floating above the surface, I tried to just set the light at a fixed location which solved my issue however when the player walks out of this light there is no more shadow, I do not think I can fit the entire terrain onto the shadowmap because the terrain is so large, so how I am supposed to solve this? How do I make the shadowmap only follow the player without the shadows themselves moving with the camera?



Sponsor:

#2 phil_t   Crossbones+   -  Reputation: 5703

Like
1Likes
Like

Posted 28 April 2013 - 12:40 PM

Sounds like you want to be using a directional light instead of a point light.



#3 mankut   Members   -  Reputation: 117

Like
0Likes
Like

Posted 28 April 2013 - 12:57 PM

I am using gluperspective for the projection matrix of the light so I am guessing it is directional?



#4 Vilem Otte   Crossbones+   -  Reputation: 2056

Like
2Likes
Like

Posted 28 April 2013 - 02:21 PM

For directional lights you should use orthogonal matrices - at opengl-tutorial they have an article about how to setup shadow map for directional light (e.g. using orthogonal matrix) - http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/

 

For large scenes, you probably want to render shadows in distance, to achieve this you can use cascaded shadow maps - for more information read at least these 2 sources

http://msdn.microsoft.com/en-us/library/windows/desktop/ee416307%28v=vs.85%29.aspx

And MJP's code (it's also commented and easy to understand) - http://mynameismjp.wordpress.com/2009/02/17/deferred-cascaded-shadow-maps/

... you can also google for "cascaded shadow maps" I'm sure that Microsoft's link is one of the first, and there is like a TON of others explaining more or less the same.

 

Also this paper http://visual-computing.intel-research.net/art/publications/sdsm/sdsmLauritzen_I3D2011.pdf from Andrew Lauritzen (I think he was even visiting this forums at some point, although I don't think he is still around...), explains how to further extend CSM (e.g. use better partitioning) to achieve really great results. I still haven't implemented this in my engine, but I've got it on my todo list smile.png.


My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com


#5 Alundra   Members   -  Reputation: 1148

Like
1Likes
Like

Posted 28 April 2013 - 05:44 PM

You can combine two methods if your light doesn't rotate. You can generate the lightmap for static scene and use the shadow mapping using an ortho projection for dynamic objects. The best is SDSM, Vilem Otte gave the link of the paper, you can found the demo source who is Direct3D11 based. It's important to notice that SDSM needs compute shader, without compute shader you will need to read back a lot and you will lost performance.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS