ShadowCameraSetup question

skullmunky

24-10-2008 22:23:15

hi,

I'm trying to use one the Uniform Focused or LiSPM shadow cameras, but I'm not sure I'm doing it right. I'm basing my code off the Shadows demo.

I tried two different things. First,

self.focused = Ogre.FocusedShadowCameraSetup()
self.mCurrentShadowCameraSetup=Ogre.ShadowCameraSetup(self.focused)
self.sceneManager.setShadowCameraSetup(self.mCurrentShadowCameraSetup)


that gives me this error:

Boost.Python.ArgumentError: Python argument types in
ShadowCameraSetup.__init__(ShadowCameraSetup, FocusedShadowCameraSetup)
did not match C++ signature:
__init__(_object*)


It also tried just doing this:


focusedSetup = Ogre.FocusedShadowCameraSetup()
self.sceneManager.setShadowCameraSetup(focusedSetup)


and it was fine with that, but I got another error a little later on:


self.setGuiCaption('Core/AverageFps', 'Average FPS: %f' % statistics.getAverageFPS())
AttributeError: 'wrapper_descriptor' object has no attribute 'getShadowCamera'


Which is in the Framework code that draws the debug gui.

If I take that out I still get the same AttributeError at any line that involves self.RenderWindow(), such as

def frameStarted(self,frameEvent):
if (self.renderWindow.isClosed()):
return False


I really love how those other shadow cameras look ... any idea what I'm doing wrong?

bharling

25-10-2008 11:34:39

I ran into exactly the same problem when trying to setup the PSSM demo, however its easy to solve:

focusedSetup = Ogre.FocusedShadowCameraSetup()
self.sceneManager.setShadowCameraSetup(focusedSetup)


you just need to keep a reference to the shadowCameraSetup, like this:

self.focusedSetup = Ogre.FocusedShadowCameraSetup()
self.sceneManager.setShadowCameraSetup(self.focusedSetup)


the PSSM demo I ported is now in the SVN for python-ogre and works, so go check that out if you like.

skullmunky

28-10-2008 03:01:40

thanks! I tried that out and it got closer, but died further along. I'll check out the demo, should be able to get it working from that.

in the meantime, I get this exception:

ogre.renderer.OGRE._ogre_exceptions_.OgreException: OGRE EXCEPTION(2:): All fram
ebuffer formats with this texture internal format unsupported in GLFrameBufferOb
ject::initialise at OgreGLFrameBufferObject.cpp (line 276)


thrown by

def go(self):
self.setUp()
self.root.startRendering()

bharling

28-10-2008 09:04:02

Sounds like your depth texture format is not compatible with openGL,

what texture format are you using for shadow casters? Here's what I've got in the PSSM demo ( though you'll want to reduce the count from 4 to 1 or maybe 2 )


self.sceneManager.setShadowTextureSettings(1024, 4, ogre.PF_FLOAT32_R)

skullmunky

28-10-2008 17:33:52

thanks bharling!

changing the format worked. I used PF_X8R8G8B8; thought that was already the default, but I guess you do have to set it explicitly.

Strangely, 512x1x PF_FLOAT32_R demolished my framerate. I have a QuadroFX 1400 so I thought it would be able to handle it, but maybe not.