DX11 Shadow Maps - Render targets

Started by
6 comments, last by Aqua Costa 11 years ago

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-

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

Advertisement

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.

New game in progress: Project SeedWorld

My development blog: Electronic Meteor

I'm actually not sure

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

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

To smooth the edges look into percentage closer filtering.

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?

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

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

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/, cuboidzone.wordpress.com/

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)

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).

This topic is closed to new replies.

Advertisement