This topic is 4683 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, I am still wondering how the CSM really work. The only information I can find on this on the net is this: http://www.neeyik.info/pix/csm.gif (how do you post a link btw ?) but this not completely clear to me. So you have to create multiple shadow maps. But how are the multiple shadow maps defined ? (each covering a bigger region, or other region, ..). And do they mean with: for each receiver in the scene compute optimal lightProj * lightView, given EyeView*P. Has this something to do with Frustum-frustum cube clipping, cause I presume you have to use this here as well ? Sorry for the noob question, but I am still trying to find a good outdoor shadow solution. If this result isn't good enough, I might go back to the HalfLife 2 method. Static darkmaps, which can be updates, and dynamic projected textures for dynamic objects (then the shadows at least always look good). Reagrds, Kenzo

##### Share on other sites
This thread is quite useful (you prolly seen it tho)
Check the FAQ for info on how to do links.

It seems to me from reading that thread that CSMs work alot like clip maps, basically center a set of progressivly larger and lower res shadow maps around the viewer.
I am going to try and put this in my geo clip-mapping engine cos it sounds like the two techniques would compilment each other perfectly.

##### Share on other sites
thx .. I started reading it in the beginning, but lost track of the thread, but ended as a interesting one :) Stupid me.

But from the explenation carmack gives:

Quote:
 So the solution I'm looking at for outdoor lighting is a sort of multi-middle, propped mip-map of shadow buffers, where you have your 1k x 1k shadow buffer which renders only, say, the 2000 units nearest you, and it's cropped to exactly cover that area dynamically, then you keep scaling by powers of two on there until you've covered the entire world, which may require rendering five or six shadow buffers depending on how big your outdoor area is. It's not really that big of a deal and ends up being like rendering six views for a single point light for an indoor area. I think that's a pretty solvable problem.

This is simply a multiple shadow map which cover a bigger area each time, and from the other explenations is seam like CSM are multiple shadow maps tiled together to fill up the frustum. The one carmack explains seams easier to implement. Like this, you probably have to render the object from near to far, and some objects end up being rendered mutliple times if they don't fit in the smallest view frustum (stencil testing could also be used here then). But how would you make tileable view frustums for the current camera view for the CSM method. Is there an easy solution to this? And has anyone some extra information regarding the paper: Tiled Shadow Maps, because you have to pay to read it :(

Regards,
Kenzo

##### Share on other sites
What I understand from what I have read, is that CSMs are always a set of progressively larger shadow maps (same res, each covering an area 4 times that of the last, i.e. twice the dimensions). The difference is you either center them at the viewer position, or at a determined target point depending on the view direction:
Centered at viewer position                           o viewer                           |\                                                     | \ view direction                           |  v                           |                                   c1   [       c         [  b  [  a    ]  b  ]        c         ]  ORCentered at viewer eye direction                           o viewer                           |\                                                      | \ view direction                           |  \                                                       |   v                               |    c1        [       c         [  b  [  a    ]  b  ]        c         ]

Someone please correct if this is not how it is.

Also I would imagine you could make a choice about which level shadow map to use for each object, and just render it once.

##### Share on other sites
Hello,

I roughly implemented the CSS as explained above using only 3 shadow maps so far. One upto 32m, second 64m and third 128m, this works and gives okayish results whn using 2048x2048 textures and a little bit of PCF. Perhaps if I would increase the complexity of my PCF it might look better. The problem is of course, this uses almost 50MB of texture memory !! (btw has anyone tried the Efficient Soft-Edged shadows technique from GPU Gems 2 already? Is it good, because from the sample it seams like it very costly for the GPU).

I presume a cheaper solution would be to render the closest shadow map, render geometry inside this volume. Use the same texture to render from 32 to 64, .. but this of course will increase my rendering cost quite a lot, because I now select which texture to sample depending on the depth calculated in the shader, and then I only have to illuminate once.

When using CSM's like this, is there another possibility to optimize the shadow quality. I presume the best thing to create my view projection matrix is asfollows:
View: place eye pos just outside of box, and lookat at center of box.
Projection: Ortho with dimensions of the box

I am wondering if LiSPSM isn't better than this. Has anyone implemented both?

Regards,
Kenzo

##### Share on other sites
Possibly using lower res maps, but more of them, might give better results. Can you post screenies which show all the shadow maps?

##### Share on other sites
my implementation of it is pretty similar to what you've all described, with one "extra" (not much, really, but useful): i'm rendering my shadowmaps into one big map. this enables me to "select" the right tile for the shadow receiver pixel (a conditional with 2 maps, basically), so i dont have to PCF each and every map on a ps2.0 hardware. (because only one sampler is used for the shadowmap(s))

im not really fond of the stencil-selector method, it doesnt work very well with transparent surfaces. (that cant have z values written)

##### Share on other sites
Quote:
 Original post by GuoshimaI am wondering if LiSPSM isn't better than this. Has anyone implemented both?

the big problem with perspective-warping methods (like lispsm, tsm, or psm) is that there are cases (where light direction is the same or the exact opposite of viewing direction) when they just dont work. the other problem, that all of those methods require some kind of "focus point" to exist - it's not trivial to find the optimal one for a given frame. the third problem is that they constantly change the texel distribution: even minor changes can result in "sparkling" of shadows which is quite disturbing - and when they approach their bad case, it is definitely more than just minor.

##### Share on other sites
dont center them on the camera, else half the SMs are gonna be behind the camera thus practically wasted,
instead u typically use the cameras forward vector (disregard y component and renormalize) aim the shadowmaps at points along this vector (perhaps set the y component to the average terrain height)

##### Share on other sites
Hi

TSM are quite nice algorithm. There's no as many special case like PSM have.
Facing light cases are enough simple to handle.
The focus point is not a "must" in this algorithm.
It can already give good results without.

Jeckle- kjAPI Team

1. 1
2. 2
3. 3
Rutin
22
4. 4
5. 5

• 13
• 19
• 14
• 9
• 9
• ### Forum Statistics

• Total Topics
632936
• Total Posts
3009311
• ### Who's Online (See full list)

There are no registered users currently online

×