Properly support PSSM/CSM

What it says on the tin: a place to discuss proposed new features.
Caphalor
Greenskin
Posts: 116
Joined: Tue Feb 06, 2007 8:54 pm
Location: Berlin, Germany
x 25

Post by Caphalor »

I just added a timescale slider to my editor and the result looks so nice that I made a small video (PSSM + 16 tap PCF + Caelum): Download
User avatar
captnoord
Halfling
Posts: 42
Joined: Wed Apr 30, 2008 11:01 am

Post by captnoord »

hmmm... NICE :D damn.....
To be or not to be that is the question that dazzles us for centuries, now modern science have found the answer: 0x2B | ~0x2B == 0xFF
Image
sanfir
Halfling
Posts: 46
Joined: Thu Dec 22, 2005 2:43 pm
Location: Cairo, Egypt

Post by sanfir »

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
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

The optimal adjust factor just affects the 'skewing' of the perspective matrix - experiment with values between about 0.01 and 2.
User avatar
Azgur
Goblin
Posts: 264
Joined: Thu Aug 21, 2008 4:48 pm

Post by Azgur »

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:

Code: Select all

mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("pssmSplitPoints", splitPoints);
Is there a good generic way around this? Like detecting all materials that extend PSSM/base_receiver?
Caphalor
Greenskin
Posts: 116
Joined: Tue Feb 06, 2007 8:54 pm
Location: Berlin, Germany
x 25

Post by Caphalor »

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);
}
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

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.
User avatar
Azgur
Goblin
Posts: 264
Joined: Thu Aug 21, 2008 4:48 pm

Post by Azgur »

Caphalor: Thank you for the suggestion. I'll likely use that method during prototyping when alot of stuff changes.
Sinbad: I've tried that and it works like charm. I do have a question though, under what conditions do the split values change? (As in, when should I update the hardcoded values?)
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 67
Contact:

Post by sinbad »

The splits only change if you choose to change them. The class can suggest splits based on near / far planes and a proportion, but once they're set, they don't change on their own. You might want to change them if you vary the near or far plane of your camera, but that's it.
User avatar
Azgur
Goblin
Posts: 264
Joined: Thu Aug 21, 2008 4:48 pm

Post by Azgur »

Thank you. That's all I needed to know.
artn3r
Halfling
Posts: 72
Joined: Wed Jul 16, 2008 10:01 am

Post by artn3r »

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
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5586
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1413
Contact:

Re:

Post by dark_sylinc »

ahmedismaiel wrote:i have some trouble trying integrating this in ps3.0 shader (2.0 work great)
i get this error

Code: 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*. 
i searched for a fix but i cann't say i understand how to do it using ddx,ddy
help!
uh! very late answer, but it may help anyone
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
User avatar
Nargil
Greenskin
Posts: 124
Joined: Thu Feb 15, 2007 8:47 pm

Re: Properly support PSSM/CSM

Post by Nargil »

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 ?
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
User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
x 220
Contact:

Re: Properly support PSSM/CSM

Post by Jabberwocky »

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
Image
User avatar
Nargil
Greenskin
Posts: 124
Joined: Thu Feb 15, 2007 8:47 pm

Re: Properly support PSSM/CSM

Post by Nargil »

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
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
Post Reply