Properly support PSSM/CSM
-
sanfir
- Halfling
- Posts: 46
- Joined: Thu Dec 22, 2005 2:43 pm
- Location: Cairo, Egypt
Hi,
First of all, thanks for the great efforts done in here
We have integrated the PSSM shadows into our game, and it was working great, until we decided to change the far clipping plane distance from 500 to 1000
Now one (or more) shadow texture has really bad resolution (mostly shadow map 2 or 3)
I have studied the calculateSplitPoints functions, and it is exactly as mentioned in the PSSM paper. But I'm afraid the problem might be in setOptimalAdjustFactor(), which is related to LiSPSM (I assume), and is not mentioned any where in the PSSM paper, so I am never able to adjust its values.
Any help on the proper values, equation, or better resolution tips would be highly appreciated.
Thank you
First of all, thanks for the great efforts done in here
We have integrated the PSSM shadows into our game, and it was working great, until we decided to change the far clipping plane distance from 500 to 1000
Now one (or more) shadow texture has really bad resolution (mostly shadow map 2 or 3)
I have studied the calculateSplitPoints functions, and it is exactly as mentioned in the PSSM paper. But I'm afraid the problem might be in setOptimalAdjustFactor(), which is related to LiSPSM (I assume), and is not mentioned any where in the PSSM paper, so I am never able to adjust its values.
Any help on the proper values, equation, or better resolution tips would be highly appreciated.
Thank you
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
- Azgur
- Goblin
- Posts: 264
- Joined: Thu Aug 21, 2008 4:48 pm
I'm sorry to bump an aging thread, but I have a few questions regarding the implementation of PSSM in 1.6.
I've implemented it successfully into our current prototype, but a few parts still make us feel somewhat less comfortable.
The demo hardcodes a few things like:
Is there a good generic way around this? Like detecting all materials that extend PSSM/base_receiver?
I've implemented it successfully into our current prototype, but a few parts still make us feel somewhat less comfortable.
The demo hardcodes a few things like:
Code: Select all
mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("pssmSplitPoints", splitPoints);
-
Caphalor
- Greenskin
- Posts: 116
- Joined: Tue Feb 06, 2007 8:54 pm
- Location: Berlin, Germany
- x 25
I don't know whether it's a good solution, but I have a pass "Skylight" in my materials which computes directional lightning. So this is enough to setup the pssm parameters:
Code: Select all
Ogre::ResourceManager::ResourceMapIterator RI = Ogre::MaterialManager::getSingleton().getResourceIterator();
while (RI.hasMoreElements())
{
Ogre::MaterialPtr mat = RI.getNext();
if (mat->getTechnique(0)->getPass("SkyLight") != NULL) mat->getTechnique(0)->getPass("SkyLight")->getFragmentProgramParameters()->setNamedConstant("pssmSplitPoints", mPSSMSplitPoints);
}
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
Essentially you can precompute these split points and put them in a base material / program if you want. In this case it's just simple to do it inside the demo at runtime but you can structure your materials so that the split points are built in - they're not the kind of setting you'll need to change once you've tweaked it to your liking anyway.
- Azgur
- Goblin
- Posts: 264
- Joined: Thu Aug 21, 2008 4:48 pm
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
-
artn3r
- Halfling
- Posts: 72
- Joined: Wed Jul 16, 2008 10:01 am
Please, can someone have a look to my Thread:
http://www.ogre3d.org/phpBB2/viewtopic. ... 718#315718
I have problems with transparent pssm shadows!
Thanks,
Regards, Christian
http://www.ogre3d.org/phpBB2/viewtopic. ... 718#315718
I have problems with transparent pssm shadows!
Thanks,
Regards, Christian
- dark_sylinc
- OGRE Team Member

- Posts: 5586
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1413
- Contact:
Re:
uh! very late answer, but it may help anyoneahmedismaiel wrote:i have some trouble trying integrating this in ps3.0 shader (2.0 work great)
i get this error
i searched for a fix but i cann't say i understand how to do it using ddx,ddyCode: Select all
error X6077: texld/texldb/texldp/dsx/dsy instructions with r# as source cannot be used inside dynamic conditional 'if' blocks, dynamic conditional subroutine calls, or loop/rep with break*.
help!
I had the same problem.
Use tex2Dlod(shadowMap, uv.xyyy).r instead and you'll be just fine, like the guys at ATI suggest.
Since shadows aren't LODed, tex2Dlod and tex2D will return the same.
If I recall correctly, that code in the sample is included but just commented.
Cheers
Dark Sylinc
PS: It's a PS 3.0 design issue. Not a shader bug
- Nargil
- Greenskin
- Posts: 124
- Joined: Thu Feb 15, 2007 8:47 pm
Re: Properly support PSSM/CSM
I just recompiled the demo using 1.6.1 and there are some huge artifacts:
http://www.youtube.com/watch?v=hyaoMu4uizs
The precompiled demo worked just fine. Anyone succeded to port it to 1.6.1 ?
http://www.youtube.com/watch?v=hyaoMu4uizs
The precompiled demo worked just fine. Anyone succeded to port it to 1.6.1 ?
Hardcore libertarian, hardcore programmer.
Dell M6300: T9300, 4GB, Quadro FX1600M, 17" 1920x1200p non-glare, OCZ Vertex 120 + external Seagate 120GB 7200.3
Use the power of 2 - literally. Non 2^n texture sizes may crash your graphic driver
Dell M6300: T9300, 4GB, Quadro FX1600M, 17" 1920x1200p non-glare, OCZ Vertex 120 + external Seagate 120GB 7200.3
Use the power of 2 - literally. Non 2^n texture sizes may crash your graphic driver
- Jabberwocky
- OGRE Moderator

- Posts: 2819
- Joined: Mon Mar 05, 2007 11:17 pm
- Location: Canada
- x 220
- Contact:
Re: Properly support PSSM/CSM
Just in the off-chance you've run across the same problem I had:
http://www.ogre3d.org/forums/viewtopic.php?f=4&t=48305
http://www.ogre3d.org/forums/viewtopic.php?f=4&t=48305

- Nargil
- Greenskin
- Posts: 124
- Joined: Thu Feb 15, 2007 8:47 pm
Re: Properly support PSSM/CSM
Could someone confirm if the demo is not working with 1.6.1 or maybe trunk ?
I encounter similar issues (as mentioned above) when I try to implement the LiSPSM or PSSM shadow camera setup in my own project.
Jabberwocky: How could I ? I just recompiled it without modifying anything.
EDIT: The fixed version posted: Wed Aug 13, 2008 9:04 am works fine. Sry for bumping
I encounter similar issues (as mentioned above) when I try to implement the LiSPSM or PSSM shadow camera setup in my own project.
Jabberwocky: How could I ? I just recompiled it without modifying anything.
EDIT: The fixed version posted: Wed Aug 13, 2008 9:04 am works fine. Sry for bumping
Hardcore libertarian, hardcore programmer.
Dell M6300: T9300, 4GB, Quadro FX1600M, 17" 1920x1200p non-glare, OCZ Vertex 120 + external Seagate 120GB 7200.3
Use the power of 2 - literally. Non 2^n texture sizes may crash your graphic driver
Dell M6300: T9300, 4GB, Quadro FX1600M, 17" 1920x1200p non-glare, OCZ Vertex 120 + external Seagate 120GB 7200.3
Use the power of 2 - literally. Non 2^n texture sizes may crash your graphic driver

