Skip to main content
GameDev.net gamedev.net
🔒 Locked

Lispsm

Started by godmodder Apr 15, 2006 at 6:29 AM 26 replies 12.3k views
Original Post
godmodder
godmodder
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
HellRaiZer
HellRaiZer
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
HellRaiZer
godmodder
godmodder
The modelviewProj matrix, is that the light's view matrix multiplied with it's projection matrix?
YengaMatiC
YengaMatiC
Light can be modelled as a camera (ortho for directional and perspective(s) for spot/omni). So you can transform points into camera's space using it's mvp matrix.
YengaMatiC for the people[Pandora's Box project]
HellRaiZer
HellRaiZer
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
HellRaiZer
Niwak
Niwak
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 !
godmodder
godmodder
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
wolf
wolf
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
godmodder
godmodder
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.
Guoshima
Guoshima
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 :)
wolf
wolf
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.
salzrat
salzrat
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
Guoshima
Guoshima
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
godmodder
godmodder
I think CSM's are great because they're cachable and they seem easier to implement. Does anyone know of a tutorial for them?
wolf
wolf
... there will be an article in ShaderX5, but this book is due in December 2006.
krausest
krausest
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?
Enrico
Enrico
There is also Subdivided Shadow Maps. Their video looks great, but I haven't had time to read and implement the paper.
--
Guoshima
Guoshima
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
wolf
wolf
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 ...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.