Custom shader rendering and "hooking" into Ogre

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Custom shader rendering and "hooking" into Ogre

Post by Praetor »

Hello all, first post here. I've been tinkering with Ogre for about 2 weeks creating a game engine and game. I hope to make it pretty impressive (don't we all) with some nifty features (not all graphical in nature...) so if i get anything interesting going i'll be sure to drop it in here somewhere. But for now, I have a question:

It seems that shadow mapping is a good technique for realtime shadows because they can be used pretty much universally (doesn't the PLSM2 only support terrain shadow mapping right now?). So the real problem is the aliasing that happens, cause it really does looks bad in certain cases. The general idea is to "hook" in some shaders, cause they can do some really nice things. So, say I want to take care of that aliasing with a gaussian blur only on the shadow map (not like FSAA, just on the map) can I hook into Ogre and add this little gaussian filter to the map before the map is used? Or should I just turn off Ogre shadows completely and make my own shadow map shader with the blur myself?

While we're on the shader topic, I'm also looking to smooth out the my obvious lack of texturing/modelling skills with some nice post-process effects. The idea is to stack them. Anyway, I saw some other posts talking about postprocessing and rendering to a texture before, but I'm having problems really understanding getting this functionality "out" of Ogre. What I mean is, can I create a texture (we'll say a D3D one since I've pretty much locked myself in D3D with other features of my game) and tell Ogre to render to it and just run with it? What I mean is, once the scene is rendered to the texture, I'd be "out" of Ogre's functionality completely and I could just run my own postprocessing effects myself and render the screen without Ogre. And what's the status of the HDR stuff? I saw that mentioned as well. If that texture is a floating-point one will Ogre render unclamped lighting to it automatically?

Sorry, long post, and thanks for any answers in any form. And sorry if this has been gone over a lot before. Of course, if it has, a link to that stuff would be appreciated....

Anyway, thanks again, and this seems like a great community to be involved in!
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 »

You can customise the way texture shadow casters are rendered intto the texture and rendered onto the receivers. You can also change the pixel format of the shadow texture. The following SceneManager methods are useful:

setShadowTextureSize
setShadowTexturePixelFormat
setShadowTextureCount
setShadowTextureSelfShadow
setShadowTextureCasterMaterial
setShadowTextureReceiverMaterial

The API reference has more detail.

On the subject of postprocessing - search the forum for 'postfilter'. Several games are using this - see Ankh (bloom filter) and Antharia (painter filter). You'll find a heatvision effect on here somewhere too.

As for HDR, we support floating point texture formats and you'll find an OpenEXR loader in the source, although we don't make use of it in our demos. So with the appropriate shaders you shoudl be able to perform all the HDR effects you need - but be aware that they are expensive and only really practical on a top-end minority of cards.
Post Reply