Sign in to follow this  

Lispsm

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I've been trying to implement Lispsm for quite some time now, but time after time, i've failed. The source from their main site is just so confusing. I would like to ask to you all: If you have source for a lispsm implementation, would you be so kind to let me read it, cause I'm really stuck at this. I'm able to calculate the 8 points of the eyeFrustum without any problems. But what am I supposed to do next? I have to translate them into lightspace or something, but I don't really know what that means. My email is: credoandjeroen@hotmail.com, feel free to add me to your msn too. Thanx in advance, Jeroen

Share this post


Link to post
Share on other sites
Hi...

Unfortunately i haven't implemented LiSPSM myself so i don't have any source to give. But if you have to tranform the eye frustum into light space, i think you have to tranform the 8 points with the light's mvp (Modelview-Projection) matrix. The resulted points will be in light space.

HellRaiZer

Share this post


Link to post
Share on other sites
Quote:

The modelviewProj matrix, is that the light's view matrix multiplied with it's projection matrix?


Yes. But keep in mind that LiSPSM may not be able to model all light types. I don't know this (i haven't read the paper),so see if it can model both ortho and perspective projections.

HellRaiZer

Share this post


Link to post
Share on other sites
I've been thinking to implement LiPSM too. The fact is that it happens to be quite difficult. I have switched to implement trapezoidal shadow map which are AFAIK a more advanced technique and is very, very well documented ;

http://www.comp.nus.edu.sg/~tants/tsm.html

What's marvellous with shadow map technique is that you can always spend time improving them ; starts with a standard shadow map, move on to trapezoidal shadow map, add PCF or variance filtering, move on to cascaded shadow map or subdivided shadow map... When you start shadow mapping, you get plenty of work for the upcoming monthes !

Share this post


Link to post
Share on other sites
I've tried implementing TSM before LisPSM, but had no success. The reason why I swithed to LisPSM is that it seemed easier.

In the sourcecode of their sample, they've implemented both uniform shadow mapping and lispsm shadowmapping in lightspace. When you render the scene from the light's point of view (F3), the view frustum nicely rotates with the camera like it should and it always remains perpendicular to the screen (more or less).
When I draw my view frustum, it's quite a bit different, although the uniform shadowmapping with it actually works!
The lispsm implementation is correct for some parts of the screen, but has severe artifacts due to the stretching I see from the light's point of view.

Can someone tell me how to post screenshots here, then I can show you?

Jeroen

Share this post


Link to post
Share on other sites
Source code is provided in a NVIDIA example called perspective shadow map. It covers the original PSM, TSM and LiSPSM ... very cool. I think the implementation is also a bit more game specific, but can be wrong on this ...

- Wolf

Share this post


Link to post
Share on other sites
I think that sample of nvidia is just plain useless. The code gives me a headache and it uses all kinds of weird bounding box thingies that don't seem to have anything to do with the original algorithms.
Oh yeah, and I'm programming for OpenGL, so with that sample being Direct3D is an extra minus.

Share this post


Link to post
Share on other sites
ShaderX4 has a nice implementation preview of LiSPSM, where everything is rather good explained, and it has a demo in OpenGL and DirectX. I added/tried to add the LiSPSM to my engine, but actually I am rather dissapointed. In some scenes in really works nice, but the problem, as soon as you start moving your camera, you get the 'dancing shadow effect', which only makes your shadow look worse if you ask me. I also tried to combine this with Variance shadow maps (see some previous post of me), and the result was not really what I was looking. I did not only get dancing shadows, but fade in and fade out of shadows because of variance shadow maps. Perhaps I am doing something wrong, but I don't think you can do a lot of things wrong when using VSM.

In the end I think, I will use LiSPSM only for dynammic object, and use a region based projected Shadow approach, which I can preblur, and project 'on top of my objects'. When I blend this together with my LiSPSM (perhaps with or without VSM), the result might still be oké. Still working on it though ..

So far I haven't found anything good yet .. :(

PS: if you want to I can give you the name of the writer of the article in ShaderX4, and when you contact him, you can have his source code, but I don't think I am allowed to give you the source when you don't have the book .. perhaps wolf can help on this :)

Share this post


Link to post
Share on other sites
Just distribute the source code, I do not think the author has a problem with it. My personal favourite are cascaded shadow maps. They work very well ... but they are expensive. Nevertheless this is the price you want to pay for decent shadow maps.

Share this post


Link to post
Share on other sites
Which source did you try?

If you want, I can send you the ShaderX-version (being the author of that article :)...

LiSPSM and TSM actually achieve practically the same effect, except that the parameter in LiSPSM is calculated to guarantee a maximum error in z. It should be noted that warping techniques work best with directional lights, and for situations where the light comes from rather overhead.

"swimming" shadows are unfortunately unavoidable if you want to make decent use of texture space, since you have to adapt the shadow map to what you actually see...

Michael

Share this post


Link to post
Share on other sites
well I tried the LiSPSM calculation for my directional light, but I didn't like the results. It is great for screenshots, but like you mentioned, the swimming artifacts, when you're moving, make the shadow look even worse if you ask me. I am now doing some more advanced cascaded shadow maps with variance and projected shadows into it, and I might add the LiSPSM calculations afterwards to it again, because the quality should be much better then, and I hope the swimming will be less noticable.

I heard that with TSM you can smoothly change the transitions. Is this correct, and does this work nicely?

Regards,
Kenzo

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
I heard that with TSM you can smoothly change the transitions. Is this correct, and does this work nicely?

Yes, there is a parameter which determines the focus region. When light and camera become more parallel, I set this parameter to a higher value.
What I'm also doing is to cut the view frustum before shadow calculations. This means that objects far away don't cast shadows anymore, but it really helps improving shadowmap resolution.

Share this post


Link to post
Share on other sites
Quote:
Original post by wolf
... there will be an article in ShaderX5, but this book is due in December 2006.


I found a paper about CSM right here it's called "Parallel Split Shadow Maps".
They mention that they will consider using MRT for CSM shadows in future. I have no clue how that should work, since you want different geometry for each shadow map, but maybe they are just way more clever than I am.

There's also another paper from the same university called "Generalized Linear Perspective Shadow Map Reparametrization" which (as every other algorithm before ;-) claims to create lower antialiasing artefacts. Has anyone tried that one?

Share this post


Link to post
Share on other sites
hmm fast server for the "Parallel Split Shadow Maps" paper. Can someone provide a link or mirror to this pdf, because I can't seem to download it. Will take ages.

Thank you,
Kenzo

Share this post


Link to post
Share on other sites
Quote:
I found a paper about CSM right here it's called "Parallel Split Shadow Maps".
They mention that they will consider using MRT for CSM shadows in future. I have no clue how that should work, since you want different geometry for each shadow map, but maybe they are just way more clever than I am.

Yes, they do a couple of things that I think are not applicable to game development:

1. They construct a bounding volume around the shadow casters and they use this bounding volume to write into one of their shadow maps. Think of a building that goes over several shadow maps and you are screwed, if you do not slice the building in several AABB boxes ... or easier if you want to render the terrain into the shadow map ...
In the example program they use single small objects ...

2. Think about the case that the sun is very low and let's say you have one tree standing behind the viewer and this tree casts shadows over the area of three or four shadow maps ....

3. Minor: there is no depth buffer support for MRT's ...

Share this post


Link to post
Share on other sites
Subdivided Shadow Maps sound interesting, but some points that keep me from implementing are:
* They need up to 8 rendering passes for the shadows maps (4 for the frustum subdivision, results in 8 when using face subdivision), which is quite a lot.
I'd guess that you can get pretty good results with CSM in combination with TSM, PSM or LISPSM or each subdivion too. Do you think the quality is actually much better?
* For cases where the ususal reparametrizations like PSM, TSM converge to SSM (light and view direction are almost equal) Subdivided Shadow Maps still apply some warping (each frustum is still a trapezoid that can be warped into a rectangle). Does that improve image quality or is SSM optimal in that case?
* The math behind it will cause some bad headaches in the scarce spare time ;-)

Wolfgang, maybe I read that part of the paper too fast, but I thought that they are just applying an optimization to optimize shadow map useage for each split part of the frustum (if possible). I wouldn't use it anyway since the shadow quality will depend on the view position and not be constant.

But I think that an AABB approach may work fine even for the case you've described with the sun, as long as you use it to compute only the x and y extension of the objects in the split part for the projection of the shadow map. The z extension of the projection should depend on the minimum z distance of all shadow casters for that split part to the light (and those shadow casters can be outside of the split part).

Yours,
Stefan

Share this post


Link to post
Share on other sites
I have quickly implemented CSM again (rough version), but now using VSM so I can blur my shadow maps. This works rather fine for static buildings and stuff, with 3 subdivisions and shadow maps of 1024 x 1024. But the problem is that quality of the shadows of the characters is rather low (upto extreme low). I have already tried to use 2K but it didn't really help a lot. Perhaps adding the LiSPSM might help, but then you get the dancing shadow effect, and it didn't work all that wel together with VSM (at least not my implementation, has anyone else already tried this?).

I read that unreal uses a depth buffer for every character seperatly. Like this you can get very nice self shadows and casting shadows, but I don't see how too cast shadows onto multiple objects. If these objects receive shadows from multiple characters, it needs all these shadow buffers already in the shader to correctly illuminate it, or is there an easier way to blend multiple shadow maps over each other, coming from the same light.

(perhaps my explenation is not really good here, but I hope you get the picture, else I'll try to reexplain)

Regards,
Kenzo

Share this post


Link to post
Share on other sites
Quote:
I have quickly implemented CSM again (rough version), but now using VSM so I can blur my shadow maps. This works rather fine for static buildings and stuff, with 3 subdivisions and shadow maps of 1024 x 1024.

How did you calculate the light view frustum?

Quote:
I read that unreal uses a depth buffer for every character seperatly. Like this you can get very nice self shadows and casting shadows, but I don't see how too cast shadows onto multiple objects. If these objects receive shadows from multiple characters, it needs all these shadow buffers already in the shader to correctly illuminate it, or is there an easier way to blend multiple shadow maps over each other, coming from the same light.

Check out Tom Forsyth's article in ShaderX4 ... it is his technique.

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this