Jump to content

  • Log In with Google      Sign In   
  • Create Account


RPG Shadows, CSM, TSM, what else?


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

#1 Tispe   Members   -  Reputation: 1002

Like
1Likes
Like

Posted 05 July 2013 - 03:03 AM

Hi, what shadowing methods are the rave these days?

 

What Shadowing method would you consider best for DX9 and for DX11 hardware under these conditions:

-Large Area, multiple actors and objects, One Sun Light, First person perspective and Isometric perspective

-Room, multiple actors and objects, Several Lights, First person perspective and Isometric perspective

 

Cheers!



Sponsor:

#2 Krypt0n   Crossbones+   -  Reputation: 2481

Like
0Likes
Like

Posted 05 July 2013 - 03:29 AM

for outdoor, sun light, PSM shadows are neat.

#3 RnaodmBiT   Members   -  Reputation: 606

Like
0Likes
Like

Posted 05 July 2013 - 07:49 PM

Variance shadow maps can look quite nice if you tweak the parameters a little and they are very resource friendly. They also allow you to filter the shadow map and blur it to provide nice soft edged shadows at the cost of a single blur.



#4 Krzysztof Narkowicz   Members   -  Reputation: 1130

Like
0Likes
Like

Posted 07 July 2013 - 02:51 PM

For DX9 I would go with standard PSSM. For DX11 and more powerful GPUs I would try to use EVSM with SDSM. Of course for local lights (spotlights etc.) use a single cascade.

SDSM - ("Sample Distribution Shadow Maps") is an interesting PSSM extension, which provides optimal shadow map frustum.

EVSM (Chen, Tatarchuk - "Lighting Research at Bungie", SIGGRAPH09). It combines ESM and VSM in order to fix light bleeding issues.


Edited by Krzysztof Narkowicz, 09 July 2013 - 11:41 AM.

blog | twitter | "Don't have any friends? Still a virgin? Programming is for you!"


#5 Tispe   Members   -  Reputation: 1002

Like
1Likes
Like

Posted 09 July 2013 - 04:42 AM

Is it possible to get SDSM using Shader Model 3.0?

 

Edit:

The TSM paper does a comparison against PSM, and the pictures show TSM is better. Is this correct? Or do all Shadowing papers make other techniques look bad in comparison?


Edited by Tispe, 09 July 2013 - 07:25 AM.


#6 Krzysztof Narkowicz   Members   -  Reputation: 1130

Like
1Likes
Like

Posted 09 July 2013 - 11:53 AM

Sorry, I meant PSSM, not PSM. PSM/TSM and similar algorithms have a lot of temporal aliasing when camera moves. IMHO "normal" shadows look much better.

 

Yes, it's possible to implement SDSM on SM3.0. Just calculate depth range on GPU using pixel shaders and then read it on CPU. For read back use a few textures in round-robin fashion, so GPU won't be stalled by CPU. Results will be lagged by a frame or two, but it should look ok.


blog | twitter | "Don't have any friends? Still a virgin? Programming is for you!"


#7 Tispe   Members   -  Reputation: 1002

Like
0Likes
Like

Posted 09 July 2013 - 01:50 PM

Is there a difference between PSSM and CSM? I've toyed with CascadedShadowMaps11.exe in the SDK but I can't really find a good fit.



#8 Sirisian   Crossbones+   -  Reputation: 1724

Like
3Likes
Like

Posted 09 July 2013 - 03:17 PM

You can probably use RTW. It's one of the best shadow mapping algorithms.



#9 cowsarenotevil   Crossbones+   -  Reputation: 2006

Like
0Likes
Like

Posted 09 July 2013 - 09:47 PM

You can probably use RTW. It's one of the best shadow mapping algorithms.

 

Wow, that's really incredible. Probably not useful for the OP's isometric scenes, but for first person I can't imagine that there's much out there that works better.


-~-The Cow of Darkness-~-

#10 Tispe   Members   -  Reputation: 1002

Like
0Likes
Like

Posted 10 July 2013 - 01:51 AM

RTW is definitely an eye opener. Though I am not familiar with how to use a warping map, or even create one. Please correct me if I am wrong on something I am about to say.

 

From what i've gathered so far, using the forward method, a regular shadow map is colored brighter for regions of interest and darker for uninterested regions. I am not sure if the depth channel is colored or another channel. Then this colored shadow map is collapsed to 1D textures. I think all pixels in the same row is summed up to be one pixel in the 1D map, or the brightest color is picked. Then the same for all the pixels on the same column, which is placed in a second 1D texture. These 1D textures are blurred and then they are used to construct a warping map. How this is done, I don't know. Then this warping map is used to render the shadow map once again, this time with regions of interest magnified. And there is the final shadow map. Use this together with the warping map to transform each rendered pixel in view space to the shadow map and check if the depth is greater or not.

 

The consuming part is to do CPU analysis on the original shadow map and color it, I think. Then maybe (I am guessing) it is possible to collapse the result using the GPU. By rendering the colored shadow map to a render target with 1px height for the columns, and then again to another render target with 1px width for the rows. Gaussian blur on these 1D render targets might also be done I guess. Now, render the warping map(is this a texture?) by sampling each of the 1D textures once for the corresponding pixel. I'm not sure how to use the warping map to mess around in the vertex and pixel shaders....

 

 

Am I wrong?


Edited by Tispe, 10 July 2013 - 01:53 AM.


#11 Eternal   Members   -  Reputation: 584

Like
3Likes
Like

Posted 10 July 2013 - 10:47 AM

I'm currently working on a demo-app for RTW shadows, Maybe my experience is helpful, even if I have only implemented backwards projection so far and also still have to fix a few things and probably add some VSM variant on top.

 


From what i've gathered so far, using the forward method, a regular shadow map is colored brighter for regions of interest and darker for uninterested regions. I am not sure if the depth channel is colored or another channel. Then this colored shadow map is collapsed to 1D textures. I think all pixels in the same row is summed up to be one pixel in the 1D map, or the brightest color is picked. Then the same for all the pixels on the same column, which is placed in a second 1D texture. These 1D textures are blurred and then they are used to construct a warping map. How this is done, I don't know. Then this warping map is used to render the shadow map once again, this time with regions of interest magnified. And there is the final shadow map. Use this together with the warping map to transform each rendered pixel in view space to the shadow map and check if the depth is greater or not.

The coloring is only used for easier visualization in the paper, you just need a standard low-res shadowmap that you can use to detect depth-discontinuities, which then get assigned higher importance values. This is of course no problem in a small scene and for a single light, but I'm worried about the performance hit in a real scene and with potentially more lights.

The process is basically shadow map->2D importance map->2x 1D importance maps->blur->2x 1D warping maps. The warping maps are then used to to render the full-res shadow map and during final rendering.

 


The consuming part is to do CPU analysis on the original shadow map and color it, I think. Then maybe (I am guessing) it is possible to collapse the result using the GPU. By rendering the colored shadow map to a render target with 1px height for the columns, and then again to another render target with 1px width for the rows. Gaussian blur on these 1D render targets might also be done I guess. Now, render the warping map(is this a texture?) by sampling each of the 1D textures once for the corresponding pixel. I'm not sure how to use the warping map to mess around in the vertex and pixel shaders....

There is no CPU analysis necessary, everything can be done in pixel shaders on the GPU. Also with square SMs the 1D maps can be combined into a 2 pixel wide texture.

 

A sample implementation of the whole thing is available on Paul Rosen's homepage, in the software section. Very helpful.

 

For the criteria used in the paper, the backwards projection also needs a view-space depthbuffer and normals, so you'd want to use these for your general lighting as well.

 

Then there's the tessellation thing. It's only mentioned as an afterthought or optional thing in the paper, but for good results you'll need to ensure decently tessellated geometry, either using HW tessellation or during content creation.

Another thing I still have to work out is that shadow-acne actually increased in some areas using RTW, but this should be easy to fix by scaling the z-bias depending on the local shadow resolution / importance values.

 

Also some WIP pictures:

Projective-Aliasing still causing self-shadowing artifacts, even with hand-tuned bias values, so these still need some help.

 

2WwNPU0l.png

 

Artifacts on an untessellated cube:

mrA2SDMl.png

 

Fixed:

VxPL22dl.png

 

 


You can probably use RTW. It's one of the best shadow mapping algorithms.

Got any real-world experience with RTW you want to share? :)



#12 belfegor   Crossbones+   -  Reputation: 2554

Like
0Likes
Like

Posted 10 July 2013 - 12:06 PM

Could you share your demo source?  smile.png 



#13 Tispe   Members   -  Reputation: 1002

Like
0Likes
Like

Posted 10 July 2013 - 02:28 PM

I was hoping on implementing RTW on Shader Model 3.0. So no tesselation. Will it be possibe/worth it?



#14 allingm   Members   -  Reputation: 438

Like
0Likes
Like

Posted 10 July 2013 - 04:12 PM

For RTW is it possible to use the previous frame's shadow map to compute the warping maps?



#15 Eternal   Members   -  Reputation: 584

Like
1Likes
Like

Posted 12 July 2013 - 10:23 AM

Could you share your demo source?  smile.png

I'll try to :P I'd just have to finish it first, which will take some time. In the meantime you can look at the original demo source here: http://www.cspaul.com/wiki/doku.php?id=software:rtw

 

 

I was hoping on implementing RTW on Shader Model 3.0. So no tesselation. Will it be possibe/worth it?

Possible? Sure. Worth it? I don't know. Personally I'd start with CSM/PSSM for SM 3.0 and then compare it to RTW if you decide to add it later.

 

 

For RTW is it possible to use the previous frame's shadow map to compute the warping maps?

I think that should be possible with some more shader work.



#16 DigiHunter   Members   -  Reputation: 168

Like
0Likes
Like

Posted 09 August 2013 - 08:20 AM

It seems you want to have dynamic illumination with shadowing from everything on everything (aka global direct illumination). 

Cascaded shadow mapping is gold standard for now in large-scale environment.

Use CSM with PCF on Poison Kernel. It works well. This method is used in many titles in the market.

Some time ago I had been testing many others. This had given max result for scalability and perf.

Also you should use deferred tech instead forward even in large-scale scene.

And hold in mind what types of BRDF you want to see in your game. May be it's just diffuse and specular terms.

Or may be complex aniso BRDF, or may be you'll have decided to add local subsurface scattering via spherical harmonics or wavelets.

You should have chosen a good solution at the beginning, because there are 4 render targets in Direct3d9.



#17 Kryzon   Prime Members   -  Reputation: 2924

Like
0Likes
Like

Posted 12 August 2013 - 11:11 AM

Regarding mobile platforms, someone achieved low-resolution stencil shadows on the DS: http://tfpsly.free.fr/english/3d/Shadows_on_ds.html






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