Compositor in Python-Ogre

saladin

16-03-2007 07:09:54

Hi, for those of you who haven't had a chance to play with compositors with python wrapped ogre because ... well, it wasn't wrapped.

I just had a wee try by typing the following in the DEMO_WX.py generated pycrust shell:

cms = ogre.CompositorManager.getSingleton()
cms.addCompositor(MainFrame.ogreWin.renderWindow.getViewport(0), 'Bloom')
cms.setCompositorEnabled(MainFrame.ogreWin.renderWindow.getViewport(0),'Bloom', True)

Replace 'Bloom' with 'Old TV' or 'Glass' if you like. The 'HDR' shader seemed grim maybe becuz there wasn't enough specular. But impressive nonetheless.

Bravo to the python-ogre team.

andy

16-03-2007 08:45:52

Always good to know that an untested feature works !!

Thanks very much for testing, and if you happen to write a simple (or complex) test program I'd be very glad to add it to the Python-Ogre package..

Cheers

Andy

bharling

16-03-2007 14:22:01

Hey thats cool!

I was looking at porting the c++ code, but have not had enough time to look at it properly, didnt realise it could be that simple!

sebpotter

16-03-2007 16:43:55

That's excellent. I was also looking at porting the C++ demo, and was put off by the complexity of setting up the individual compositors. It's great to see how simple Python-Ogre makes this.

bharling

11-04-2007 22:16:12

I tried inserting the above code into the start of my application, and I can't seem to get it to work. I've copied what looks like the right materials from the python-ogre demos into my project's materials folder (programs, scripts, textures ..).

Anyone know which materials scripts etc. I need to copy across to make compositor work? Or alternatively how to find out the last exception thrown by the compositor manager?

cheers for any help !

saladin

14-04-2007 09:02:07

I tried inserting the above code into the start of my application, and I can't seem to get it to work. I've copied what looks like the right materials from the python-ogre demos into my project's materials folder (programs, scripts, textures ..).

Anyone know which materials scripts etc. I need to copy across to make compositor work? Or alternatively how to find out the last exception thrown by the compositor manager?

cheers for any help !


Can u submit the error bit of ogre.log?

Cheers

bharling

14-04-2007 14:27:54

hmm.. I just checked through the log file, and I cant see anything related to the compositor apart from the cgProgramManager loading which seems fine.

My application runs fine with this code inserted, and doesn't report any compositor errors anywhere that I can see. Just the effect doesn't work.

I tried typing it into the terminal in the wxDemo as you suggest and that works fine. I'm now thinking though, would it be something to do with the sceneManager selection? I'm using the terrain sceneManager and I seem to remember seeing somewhere that it affects shadows in some way. Maybe it effects composition too?

bharling

14-04-2007 19:10:12

Sorted!



Its *Very* blurry now :)

I shifted the compositor code into the game by mapping a key to it. Looks like you have to render at least one frame before the compositor will work.

This code is in my framelistener:

if arg.key == OIS.KC_C:
print 'ADDING COMPOSITOR'
cms = ogre.CompositorManager.getSingleton()
if not cms.hasCompositorChain(self.renderWindow.getViewport(0)):
newcomp = cms.addCompositor(self.renderWindow.getViewport(0), 'Bloom')
cms.setCompositorEnabled(self.renderWindow.getViewport(0),'Bloom', True)
else:
cms.setCompositorEnabled(self.renderWindow.getViewport(0),'Bloom', False)

andy

15-04-2007 05:56:44

That is very cool !!! And thanks for sharing the code :D

Cheers

Andy