Jump to content

  • Log In with Google      Sign In   
  • Create Account

DX11 Shadow Maps - Render targets


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
7 replies to this topic

#1 Migi0027   Crossbones+   -  Reputation: 1725

Like
0Likes
Like

Posted 27 March 2013 - 02:03 PM

Hi guys,

 

right now I render the scene with a depth buffer from the lights position and aim, though it's actually a directional lights. So what I do is that i make the difference in the aim and the position large so that the 'rays' almost become parallel, so it seems like a directional light. The only problem with this is that the shadows become very edgy, as the size of the depth rendering map is quite small compared to the area that needs to be covered with shadows (the cameras position is very far away from the shadows position), to make it detailed. So what I though could be possible was to change the size of the render target with the device to a larger and then render the texture, and then change the size back and then use the texture, but wouldn't that be quite slow?

 

So how should this be done? As it is done in previous games, like e.g. Battlefield 3: (look at the building or the trees shadows on the grass)

 

943231915d1319140158-battlefield-3-name-

 


Hi! Cuboid Zone
The Rule: Be polite, be professional, but have a plan to kill everyone you meet, ohh, AND STEAL ALL ZE TRIANGLES FROM ZHEM!

Sponsor:

#2 CC Ricers   Members   -  Reputation: 623

Like
0Likes
Like

Posted 27 March 2013 - 02:38 PM

Are you talking about downsampling the render target in order to get soft shadows? Usually, a blur filter is applied for that effect. This is commonly used in Variance Shadow Mapping where the square of the depth value is stored along with the original, and using both for a visibility test to see where some area should be shadowed. It usually gives some good results with smaller render targets, compared to traditional shadow mapping.


My development blog: Electronic Meteor

#3 Migi0027   Crossbones+   -  Reputation: 1725

Like
0Likes
Like

Posted 27 March 2013 - 03:29 PM

I'm actually not sure


Hi! Cuboid Zone
The Rule: Be polite, be professional, but have a plan to kill everyone you meet, ohh, AND STEAL ALL ZE TRIANGLES FROM ZHEM!

#4 TiagoCosta   Crossbones+   -  Reputation: 2197

Like
0Likes
Like

Posted 27 March 2013 - 03:40 PM

Cascaded shadow maps is a popular technique for shadow mapping of large scenes.

 

To smooth the edges look into percentage closer filtering.



#5 Migi0027   Crossbones+   -  Reputation: 1725

Like
0Likes
Like

Posted 27 March 2013 - 04:17 PM

EDITED:

 

So e.g. we split the scene up into like 4 parts  (or something else) and then render shadows for each of them depending on the depth?

 

Right now I'm using a spot light lighting, so should i render 4 (in this case) shadow maps for this spotlight, each time moving it to the new 'layer of shadows', so making a new position and aim, to seem as global shadows?


Edited by Migi0027, 27 March 2013 - 04:38 PM.

Hi! Cuboid Zone
The Rule: Be polite, be professional, but have a plan to kill everyone you meet, ohh, AND STEAL ALL ZE TRIANGLES FROM ZHEM!

#6 Migi0027   Crossbones+   -  Reputation: 1725

Like
0Likes
Like

Posted 27 March 2013 - 05:25 PM

Is it something like this (below) ? I'm not finished reading yet but I'm just trying to understand if I'm on the right path...

 

2r2bz0w.png

Red, shadow map 1, Green, shadow map 2, Blue, shadow map 3. Detail decreasing down the shadow map number. Arrows represent cameras


Edited by Migi0027, 27 March 2013 - 05:26 PM.

Hi! Cuboid Zone
The Rule: Be polite, be professional, but have a plan to kill everyone you meet, ohh, AND STEAL ALL ZE TRIANGLES FROM ZHEM!

#7 Matias Goldberg   Crossbones+   -  Reputation: 3388

Like
0Likes
Like

Posted 27 March 2013 - 05:48 PM

It sounds like you're using a perspective camera. Directional lights should use an ortographic projection so that it's "parallel". The only problem then to solve is the size of the AABB calculated from receviers and casters to know where to place the camera and which objects to render (if the aabb isn't big enough, some casters may be left out, as a trade off for quality, that's why we use cascaded maps)

#8 TiagoCosta   Crossbones+   -  Reputation: 2197

Like
0Likes
Like

Posted 27 March 2013 - 06:47 PM

Is it something like this (below) ? I'm not finished reading yet but I'm just trying to understand if I'm on the right path...

 

2r2bz0w.png

Red, shadow map 1, Green, shadow map 2, Blue, shadow map 3. Detail decreasing down the shadow map number. Arrows represent cameras

 

That's right. Render all cascades to a single depth stencil target (example size: 4096x1024) using viewports to draw to the correct part of the depth stencil target.

 

There's a good example implementation in the DirectX SDK 2007 and a lot of topics in this forums about it (like this one).


Edited by TiagoCosta, 27 March 2013 - 06:48 PM.





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