![]() |
| [[ Home | Forums | 3D Engines Database | Wiki | Articles/Tutorials | Game Dev Jobs | IRC Chat Network | Contact Us ]] |
|
|
#1 |
|
New Member
Join Date: Sep 2006
Location: Japan
Posts: 25
|
![]() Description Optimal shadowmap distributions This time the picture is a little bit different from the normal ones, as it is not an impressive rendering, but thoughts about theory. I want to share some ideas about perspective shadowmapping, as there are many methods recently [1,2,3,4], which all improve on, but I think they not optimize everything that is possible yet. In the image above, six examples are shown for different light-directions, where three are for direcional light and three are for a spot-light. The arrows indicate the light direction; z represents the lightfrustrum's depth value, x and y are the lightfrustrum's view plane coordinates. The general idea of perspective shadowmapping is very simple - it is just about changing the x- y- and depth-distribution of a shadowmap. I therefore included line-grids in each light-frustrum to show this. If the line distribution almost matches the camera frustrums distribution, then the shadowmap is optimal and won't show many aliasing artifacts. Another important thing is, to make the light frustrum as small as possible in case of a directional light. I didn't do much research about the formulas which would be required to achieve the shown distributions, but I suppose simple approximation formulas to achieve the wanted distribution (which might also be precalculated) might solve for most cases. The only thing is, that x,y and z will be required to be computed separately with different formulas while writing/reading the shadowmap. However, it might be possible to reduce the resolution and still keep good results in turn. Let me hear your opinions about it - comments are welcome. [1] Perspective Shadow Maps http://www-sop.inria.fr/reves/Marc.Stamminger/psm/ [2] Light Space Perspective Shadow Maps http://www.cg.tuwien.ac.at/research/vr/lispsm [3] Trapezoidal Shadow Maps http://www.comp.nus.edu.sg/~tants/tsm.html [4] Generalized Linear Perspective Shadow Map Reparameterization http://appsrv.cse.cuhk.edu.hk/~fzhang/ Greez, Sven http://www.p0werup.de |
|
|
|
|
|
#2 |
|
Member
Join Date: Mar 2007
Location: Isle of Wight, UK
Posts: 90
|
Any sort of PSM is always going to suffer duelling frustra problems and be nasty to implement. Congratulations on getting this far with it.
You might want to read up on an arcticle found at the below website called "Extrememly Practical Shadows". I'm halfway through implementing this stuff and it's starting to look a lot better than my previous method. http://home.comcast.net/~tom_forsyth/papers/papers.html
___________________________________________
Regards, Paul Johnson www.rubicondev.com My Free 3D Tower Defence Game |
|
|
|
|
|
#3 |
|
New Member
Join Date: Sep 2006
Location: Japan
Posts: 25
|
I just finished reading throught the docs of Tom Forsyth. The idea to split everything into smaller parts is interesting. I'm wondering if its very complicate to manage the quadtree-stucture of the created shadowmap.
Does his method also scale well for large scenes with hundreds of objects? As for the IOTD, I found I forgot to include some shadow-casting and -receiving objects for a better understanding. If the light-frustrum has to enclose them as well, it would lead to changes in the distribution, which is especially challenging if the shadow caster is very distant from the receiver. I remember that cascaded shadowmaps are one of the solutions for this task - but they require a lot of memory. I am wondering if it is also possible to improve on this by altering the distribution. |
|
|
|
|
|
#4 |
|
Member
Join Date: Mar 2007
Location: Isle of Wight, UK
Posts: 90
|
It's horses for courses. This stuff isn't easy, but I'd say it has a lower difficulty setting than getting PSM to work in a robust way tbh.
My previous shadow options were simpler still - projected texture shadows or stencils. I can't wait to get Tom's stuff finished off as I can then bin both of those and have something more reliable. Not sure how it will scale with scene complexity, as our company specialises in smaller games such as stuff for xbox live arcade we won't know, and don't really care tbh, but I see no reason for it to reach a snapping point any more than another system - it's up to you how generous you are with the frustrum dividing after all. If you disallow any at all, you're back where you started with PSM. One big problem it does solve fairly nicely is duelling frustrums. Well "solves" anyway ![]()
___________________________________________
Regards, Paul Johnson www.rubicondev.com My Free 3D Tower Defence Game |
|
|
|
|
|
#5 |
|
New Member
Join Date: Oct 2005
Location: Kaunas, Lithuania
Posts: 27
|
The biggest constraint is that it's very desirable that the shadow map distribution can be achieved with a standard 4x4 projection matrix. Then you can just use existing graphics hardware, and it just works. PSM, LisPSM, TSM and friends - they all are done by just fiddling with projection matrix.
Some parametrizations would be optimal (i.e. log), but are not possible to do with existing hardware (or are possible with such large amount of work that it's not practical anymore). How would you tweak projection matrix to achieve (3) parametrization, for example? My projection skillz are not very good, but something tells me it's not possible (I'd be happy to be proved wrong!). |
|
|
|
|
|
#6 |
|
New Member
Join Date: Sep 2006
Location: Japan
Posts: 25
|
Yes, thats true - I also guess that most of the distributions above are impossible by using just one matrix. In some cases, at least two divisions are necessary per pixel to get the desired distribution - or in 3) it might even be necessary to use a function like atan. However, I'm not sure about the speed change - it would be interesting to make some tests, if a more complex shader affects the speed much.
A speed advantage of more complex funtions could be, that multiple render-passes can be avoided for certain cases. The atan function could for example be used to avoid the use of cascaded shadowmaps - by increasing the resolution near the view-point and decreasing the distant resolution. |
|
|
|
|
|
#7 |
|
New Member
Join Date: Oct 2005
Posts: 11
|
For the game industry all perspective distorted shadow map approaches are pretty much dead. Most games have a time of day cycle and the depth aliasing artefacts increased by the perspective distortion are not acceptable.
So from what I hear cascading shadow maps along the view frustum or other multi-frustum approaches with a normal projection is working with the lowest depth aliasing error and nearly no duelling frusta problem. The guys from the parallel-split shadow map approach did not realize that their implementation is behind what is already used in the game industry ... I would recommend checking out Tom Forsyth's stuff for good ideas on what is practical. |
|
|
|
|
|
#8 | |
|
New Member
Join Date: Sep 2006
Location: Japan
Posts: 25
|
Quote:
I saw the GDC presentation of Tom and also his DX9 demo. However, I wouldn't think perspective SM's are dead. If you take a close look on the shadows in the demo, you will notice, that the aliasing is quite strong - independent from using ID's. I think ID's and local object depth (like cascaded shadowmaps) basically help to avoid aliasing that derives from depth inaccuracy - but they do not improve on the aliasing that occours from distance to the light. Therefore, I guess that a combination of local Z + ID's and perspective distortion gives better results, as it can help to reduce the aliasing. Last edited by spacerat : 03-13-2007 at 04:58 AM. |
|
|
|
|
|
|
#9 |
|
New Member
Join Date: Oct 2005
Posts: 11
|
perspective distortion is increasing depth aliasing ... this is the reason why it is not practically useful.
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|