xml based postprocessing framework

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.

xml based postprocessing framework

Postby tbw » Mon May 02, 2011 7:59 pm

i'm new to irrlicht and this is my first post so please be kind.
Currently i'm working on a tech demo and i needed a special postprocessing approach and I think it's worth to share with you.

http://www.mediafire.com/?199pj1q9qpbsr4p

The single effects can be chained simply by calling them in the desired order

taking this scene
Image

you can apply bloom, depth of field and vignette effect by taking these lines of code

Code: Select all
// begin the scene
driver->beginScene(true, true, video::SColor(255,200,200,200));

// prepare scene for post processing
// (render to rtt 'auxOut')
// call prepare(true) if depth or normal information is used (for example by the depth of field effect)
postProcessManager->prepare(true);

// render the scene as usual
smgr->drawAll();

// now render the post process effect
postProcessManager->render(EPPE_ADAPTIVE_BLOOM);
postProcessManager->render(EPPE_DEPTH_OF_FIELD);
postProcessManager->render(EPPE_VIGNETTE);

// finalize post processing
// (render to the framebuffer)
postProcessManager->update();

// end the scene
driver->endScene();


and modify the scene into this

Image

I collected some pp effects in the forum and elsewhere in the depth of the internet (please refer to the fx shader files)
for now the following effects are implemented (hlsl and glsl):

Code: Select all
// available effects
//
// if you want to create a new effect
// 1) add another EPPE_* constant
// 2) define its behaviour in the effect.xml configuration file
// 3) define additional render target textures in the rtt.xml configuration file
// 4) put the used shader programs into the media/shaders/hlsl and media/shaders/glsl subfolders
enum E_POSTPROCESS_EFFECT
{
   EPPE_NO_EFFECT = 0,
   EPPE_INVERT,
   EPPE_SEPIA,
   EPPE_GRAY_SCALE,
   EPPE_SIMPLE_BLOOM,
   EPPE_ADAPTIVE_BLOOM,
   EPPE_MOTION_BLUR,
   EPPE_NIGHT_VISION,
   EPPE_DREAM_VISION,
   EPPE_POSTERIZE,
   EPPE_SHARPEN,
   EPPE_EMBOSSED,
   EPPE_TILING,
   EPPE_DISPLACEMENT,
   EPPE_SCRATCHED,
   EPPE_PENCIL,
   EPPE_BLUR,
   EPPE_WATER,
   EPPE_COLOR,
   EPPE_PULSING,
   EPPE_SHAKE,
   EPPE_DESATURATE,
   EPPE_RADIAL_BLUR,
   EPPE_DEPTH_OF_FIELD,
   EPPE_VIGNETTE,
   EPPE_COUNT // just for counting the elements
};


The framework is easily extensible by using xml configuration files for the used render target textures and the effect chains. For demo purposes I included a more complex postprocess, the adaptive bloom which is done in several passes.
Currently only shader postprocesses are supported but you can easily integrate fixed function pipeline postprocessing by deriving from the base class IPostProcess:

Code: Select all
#ifndef _IPOSTPROCESS_H
#define _IPOSTPROCESS_H
 
#include <irrlicht.h>

using namespace irr;

class IPostProcess : virtual public IReferenceCounted
{
public:
   // constructor
   IPostProcess(const core::stringw& name)
   {
      // create screen quad vertices
      Vertices[0] = video::S3DVertex(-1.f, -1.f, 0.f, 0.f, 0.f, 1.f, video::SColor(255,255,255,255), 0.f, 1.f);
      Vertices[1] = video::S3DVertex(-1.f,  1.f, 0.f, 0.f, 0.f, 1.f, video::SColor(255,255,255,255), 0.f, 0.f);
      Vertices[2] = video::S3DVertex( 1.f,  1.f, 0.f, 0.f, 0.f, 1.f, video::SColor(255,255,255,255), 1.f, 0.f);
      Vertices[3] = video::S3DVertex( 1.f, -1.f, 0.f, 0.f, 0.f, 1.f, video::SColor(255,255,255,255), 1.f, 1.f);
      
      // set indices
      Indices[0] = 0;
      Indices[1] = 1;
      Indices[2] = 2;
      Indices[3] = 2;
      Indices[4] = 3;
      Indices[5] = 0;
   
      // set name of the postprocess
      Name = name;
   }

protected:
   // screend quad mesh
   video::S3DVertex Vertices[4];
   u16 Indices[6];

   // name of the postprocess
   core::stringw Name;

   // input and output target for the postprocess
   core::stringw RenderTarget;
   core::stringw RenderSource;

public:
   // set the rendertarget
   virtual void setRenderTarget(const core::stringw& renderTarget) { RenderTarget = renderTarget; }
   // returns the rendertarget
   virtual const core::stringw& getRenderTarget() { return RenderTarget; }
   
   // sets the rendersource (texturelayer 0 of the postprocess material)
   virtual void setRenderSource(const core::stringw& renderSource) { RenderSource = renderSource; }
   // returns the rendersource
   virtual const core::stringw& getRenderSource() { return RenderSource; }

   // returns the name of the postprocess
   virtual const core::stringw& getName() { return Name; }
   
   // returns the SMaterial struct of the postprocess
   virtual video::SMaterial& getMaterial() = 0;

   // renders the postprocess
   virtual void render() = 0;
};

#endif


Here is an example for a postprocess definition in the xml effects file

Code: Select all
  <!-- EPPE_NIGHT_VISION = 7 -->
  <Effect id="7" name="Night Vision">
    <ShaderPostProcess name="Nightvison" vsFile="vertex.fx" vsType="0" psFile="nightvision.fx" psType="4" psUseRandom="1" >
      <PixelShaderConstant name="LuminanceThreshold" value="0.01" />
      <PixelShaderConstant name="ColorAmplification" value="0.4" />
      <PixelShaderConstant name="NoiseStrength" value="1.2" />
      <PixelShaderConstant name="VisionColorR" value="0.1" />
      <PixelShaderConstant name="VisionColorG" value="0.99" />
      <PixelShaderConstant name="VisionColorB" value="0.1" />
      <Texture index="0" textureClamp="1" />
      <Texture index="1" path="media/textures/postprocess/noise1.png" />
      <Texture index="2" path="media/textures/postprocess/scope.png" textureClamp="1" />
      <RenderSource path="auxIn" />
      <RenderTarget path="auxOut" />
    </ShaderPostProcess>
  </Effect>


and also for the used render target textures:
Code: Select all
    <!-- additional render target textures adaptive bloom-->
    <RenderTarget id="rtt0" colorFormat="10" scale="0.5"/>
    <RenderTarget id="rtt1" colorFormat="10" scale="0.5"/>
    <RenderTarget id="rtt2" colorFormat="10" scale="0.25"/>
    <RenderTarget id="rtt3" colorFormat="10" scale="0.25"/>
    <RenderTarget id="rtt4" colorFormat="10" scale="0.125"/>
    <RenderTarget id="rtt5" colorFormat="10" scale="0.125"/>
    <RenderTarget id="rtt6" colorFormat="10" scale="0.0625"/>
    <RenderTarget id="rtt7" colorFormat="10" scale="0.0625"/>
    <RenderTarget id="rtt_lg0" colorFormat="4" width="256" height="256" />
    <RenderTarget id="rtt_lg1" colorFormat="4" width="64" height="64" />
    <RenderTarget id="rtt_lg2" colorFormat="4" width="16" height="16" />
    <RenderTarget id="rtt_lg3" colorFormat="4" width="4" height="4" />
    <RenderTarget id="rtt_lg4" colorFormat="4" width="1" height="1" />
    <RenderTarget id="prevLum" colorFormat="4" width="1" height="1" />
    <RenderTarget id="finalLum" colorFormat="4" width="1" height="1" />


please take a look into the code for further details. You can find a sample
and the full source code in the link provided above

In the sample switch through the three implemented modes by pressing 'm'
mode 0: no pp effect
mode 1: sample effect, switch effect by pressing 'p'
mode 2: effect chain (adaptive bloom, depth of field, vignette)

I hope you find it usefull...

EDIT:
forgot to mention: license is zlib!
Last edited by tbw on Tue May 17, 2011 5:46 am, edited 1 time in total.
tbw
 
Posts: 59
Joined: Sat Jan 15, 2011 9:51 am
Location: Germany

Postby ChaiRuiPeng » Mon May 02, 2011 8:06 pm

this is the kind of art that my eyes love
ent1ty wrote:success is a matter of concentration and desire


Butler Lampson wrote: all problems in Computer Science can be solved by another level of indirection
at a cost measure in computer resources ;)
User avatar
ChaiRuiPeng
 
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Postby Radikalizm » Mon May 02, 2011 8:09 pm

This looks pretty nice, irrlicht really needs a decent post-processing system
I haven't looked into your implementation yet, but this looks like a pretty good solution, so nice job ;)
Radikalizm
 
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Postby hybrid » Mon May 02, 2011 9:44 pm

Yes, we will indeed look into integration of a post-processing framework. Either BlindSide will implement something in the next or so version, or I'll make a call for implementations and will choose one. For now you should ask BlindSide, though, if you want to submit a proposal :P
hybrid
Admin
 
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany

Postby REDDemon » Tue May 03, 2011 5:23 am

I tried the post processing and seems that is not working.

When pressing "m" the first time the screen become antialiased, if pressing "b" nothing appens.

When pressing "m" the second time the scene just start lighting green and become darker (almost) black when moving, and lightblue when looking at the sky.

Theorically at least directx 9 should work (opengl 1.5 just crashed since i support up to 1.2 on this machine).

a message just tell "cannot create directX shader from the direcxt assembly dll". maybe i can rewrite glsl shaders and make them compatible with glsl 1.0/1.2
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
User avatar
REDDemon
Developer
 
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Postby tbw » Tue May 03, 2011 6:32 am

try 'p' instead of 'b'
the antialiasing effect is the result of 2x2 downscaling a 2 x screensized rtt. (EPPE_NO_EFFECT)
pressing 'p' in mode 1 (title bar of the window) should switch the used effect.
I have no idea why mode 2 is not working correctly. I developed this on a notebook with a nvidia GT240M and tested also on GeForce 7300.
On the GeForce 7300 I got some errors with the rtt creation for ECF_R16F. After changing the rtt.xml in the config folder
Code: Select all
colorFormat="4"

to
Code: Select all
colorFormat="10"

everything went fine. I will do some further tests...

--------

same effect was detected in

http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?p=238510&sid=66b88f71451a4c160b9c4e84f0033789

i used the current irrlicht trunk (1.8.0-alpha) and compiled it against the directX sdk, june 2010.
This is the reason for crashing. I could reproduce this on an older installation (Intel HD Graphics igxprd32.dll)
After installing the directX runtime (june 2010) the problem was fixed.
tbw
 
Posts: 59
Joined: Sat Jan 15, 2011 9:51 am
Location: Germany

Postby Mel » Tue May 03, 2011 10:43 am

There is something that catches my attention though, the first screen shows a framerate of more than 300 fps, but the second says 56 fps. Is it eficient enough?

Looks great, none the less :)

Also, i would like to ask, regarding to postprocessing. There is already a hack in the forums that allows to undersample an antialiased backbuffer to a rendertarget in Direct X, and i was wondering if that was posible also in Open GL, that is, grab the backbuffer on the fly, undersample it to a texture, and save it as a rendertarget. I say this because this would enable the Open GL driver to have postprocessing with antialiasing the same as DX does already.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
User avatar
Mel
Competition winner
 
Posts: 2264
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Postby tbw » Tue May 03, 2011 11:30 am

You are right. the framerate drops dramatically. In the second mode the scene is rendered twice.

First time to generate the depth and normal buffer.
The Second time to render the scene itself.

Also adaptive bloom is setup in 24 passes (as I mentioned just to demonstrate a complex effect chain) and finally the shaders are everything but optimized. So there is alot of free potential ....
I compared the project with the compositor framework of ogre and found out that irrlicht in combination with the introduced pp-framework is even faster (especially when combining effects).
In general I think extensive postprocessing (like depth of field, hdr or adaptive bloom) requires a good graphics card.
In the tech demo I mentioned in my first post I use occlusion queries in addition to postprocessing (to fade lensflare effects in dependence of light source visibility) and this is really painful on my weak machine!
tbw
 
Posts: 59
Joined: Sat Jan 15, 2011 9:51 am
Location: Germany

Postby Mel » Tue May 03, 2011 12:21 pm

Can you set it to use multi rendertarget?
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
User avatar
Mel
Competition winner
 
Posts: 2264
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Postby tbw » Tue May 03, 2011 2:05 pm

I tried to use mrt, but I didn't manage it so far... :(
tbw
 
Posts: 59
Joined: Sat Jan 15, 2011 9:51 am
Location: Germany

Postby REDDemon » Wed May 04, 2011 5:08 am

this is the full console output, i tried with the new download:

Code: Select all
Please select the driver you want for this example:
 (a) OpenGL 1.5
 (b) Direct3D 9.0c
 (otherKey) exit

b
Irrlicht Engine version 1.8.0-alpha
...
Using renderer: Direct3D 9.0
ATI Mobility Radeon HD 4570  atiumdag.dll 7.14.10.621
Could not load shader function D3DXAssembleShader from dll, shaders disabled: d3
dx9_43.dll
Could not create vertex shader.
Could not create vertex shader.
Could not load sprite bank because the file does not exist: #DefaultFont
compiling material Full Screen Quad
Could not load shader function D3DXCompileShader from dll, shaders disabled: d3d
x9_43.dll
compiling material Invert
compiling material Sepia
compiling material Grayscale
compiling material Simple Bloom
compiling material Downscale
compiling material Luminance Pass 1 (Init)
compiling material Luminance Pass 2 (Iteration)
compiling material Luminance Pass 3 (Iteration)
compiling material Luminance Pass 4 (Iteration)
compiling material Luminance Pass 5 (Iteration)
compiling material Luminance Pass 6 (Adaption)
compiling material Brightpass
compiling material Luminance (Save)
compiling material Horizontal Blur (Pass 0)
compiling material Vertical Blur (Pass 0)
compiling material Downscale Blur (Pass 1)
compiling material Horizontal Blur (Pass 1)
compiling material Vertical Blur (Pass 1)
compiling material Downscale Blur (Pass 2)
compiling material Horizontal Blur (Pass 2)
compiling material Vertical Blur (Pass 2)
compiling material Downscale Blur (Pass 3)
compiling material Horizontal Blur (Pass 3)
compiling material Vertical Blur (Pass 3)
compiling material Upscale Blur (Pass 0)
compiling material Upscale Blur (Pass 1)
compiling material Upscale Blur (Pass 2)
compiling material Accumulate (Final Pass)
compiling material Motion Blur
compiling material Save Frame
compiling material Nightvison
Loaded texture: .../postprocess/postprocess/media/textu
res/postprocess/noise1.png
Loaded texture: .../postprocess/postprocess/media/textu
res/postprocess/scope.png
compiling material Dreamvision
compiling material Posterize
compiling material Sharpen
compiling material Embossed
compiling material Tiling
compiling material Displacement
Loaded texture: .../postprocess/postprocess/media/textu
res/postprocess/water.png
compiling material Scratched
Loaded texture: .../postprocess/postprocess/media/textu
res/postprocess/noise2.png
compiling material Pencil Scetch
Loaded texture: .../postprocess/postprocess/media/textu
res/postprocess/pencil.png
compiling material Downscale
compiling material Horizontal Blur
compiling material Vertical Blur
compiling material Water
compiling material Color
compiling material Pulsing
compiling material Shake
compiling material Desaturate
compiling material Radial Blur
compiling material Downscale
compiling material Horizontal Blur
compiling material Vertical Blur
compiling material Depth of Field
compiling material Vignette
compiling material Final Pass
compiling material Depth
Loaded texture: 032-03a.jpg
//..i just removed list of loaded textures

Needed 31ms to create Octree SceneNode.(215 nodes, 23145 polys)
Resizing window (1024 746)
Resetting D3D9 device.


I don't know why but it is not working. Latest games with DX 11 run smoothly using also tessellation ( Civ V).. now i'm trying to isolate what's wrong..
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
User avatar
REDDemon
Developer
 
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Postby tbw » Thu May 05, 2011 1:12 pm

Please try out this download link.

http://www.mediafire.com/?qcrpfpxignsvrtj

I recompiled the sample against 1.7.2. Some code changes were necessary:

Code: Select all
if (!postProcess->getRenderSource().empty())


changed to

Code: Select all
if (postProcess->getRenderSource()!="")

because 1.7.2 does not know the empty() method for stringw

this works for me on all machines ..., I hope this will help :?
tbw
 
Posts: 59
Joined: Sat Jan 15, 2011 9:51 am
Location: Germany

Postby christianclavet » Sat May 07, 2011 1:41 am

Hi, This is really nice.

I was trying to "plug in" the system in my current project to see how it could work out... The application is running with irrlicht 1.7.2 in GLSL and all files seem to be loaded, and even the shaders look to be compiling...

I had this coming from the console, and my display is flickering from black to white. I draw the GUI after the FX since I want the FX applied on the screen rendering and not the interfaces. From the forum, the "Unsupported texture format" is only a warning and is used by the RTT.

Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
Unsupported texture format
compiling material Full Screen Quad
compiling material Invert
compiling material Sepia
compiling material Grayscale
compiling material Simple Bloom
compiling material Downscale
compiling material Luminance Pass 1 (Init)
compiling material Luminance Pass 2 (Iteration)
compiling material Luminance Pass 3 (Iteration)
compiling material Luminance Pass 4 (Iteration)
compiling material Luminance Pass 5 (Iteration)
compiling material Luminance Pass 6 (Adaption)
compiling material Brightpass
compiling material Luminance (Save)
compiling material Horizontal Blur (Pass 0)
compiling material Vertical Blur (Pass 0)
compiling material Downscale Blur (Pass 1)
compiling material Horizontal Blur (Pass 1)
compiling material Vertical Blur (Pass 1)
compiling material Downscale Blur (Pass 2)
compiling material Horizontal Blur (Pass 2)
compiling material Vertical Blur (Pass 2)
compiling material Downscale Blur (Pass 3)
compiling material Horizontal Blur (Pass 3)
compiling material Vertical Blur (Pass 3)
compiling material Upscale Blur (Pass 0)
compiling material Upscale Blur (Pass 1)
compiling material Upscale Blur (Pass 2)
compiling material Accumulate (Final Pass)
compiling material Motion Blur
compiling material Save Frame
compiling material Nightvison
Loaded texture: c:/Users/Public/Projets/IRR_RPG_Builder/media/shaders/postprocess/textures/noise1.png
Loaded texture: c:/Users/Public/Projets/IRR_RPG_Builder/media/shaders/postprocess/textures/scope.png
compiling material Dreamvision
compiling material Posterize
compiling material Sharpen
compiling material Embossed
compiling material Tiling
compiling material Displacement
Loaded texture: c:/Users/Public/Projets/IRR_RPG_Builder/media/shaders/postprocess/textures/water.png
compiling material Scratched
Loaded texture: c:/Users/Public/Projets/IRR_RPG_Builder/media/shaders/postprocess/textures/noise2.png
compiling material Pencil Scetch
Loaded texture: c:/Users/Public/Projets/IRR_RPG_Builder/media/shaders/postprocess/textures/pencil.png
compiling material Downscale
compiling material Horizontal Blur
compiling material Vertical Blur
compiling material Water
compiling material Color
compiling material Pulsing
compiling material Shake
compiling material Desaturate
compiling material Radial Blur
compiling material Downscale
compiling material Horizontal Blur
compiling material Vertical Blur
compiling material Depth of Field
compiling material Vignette
compiling material Final Pass
compiling material Depth


I'm not using the depth of field FX at the moment, do I need absolutely to add some meshes in the depth buffer? I've not used that command:
Code: Select all
postProcessManager->prepare(useDepth);

Looking at the code it seem to be only needed if I use the depth of field FX.

At each render pass, I do this, just after rendering the current scene:
Code: Select all
postProcessManager->render(EPPE_INVERT);
      postProcessManager->update();

Is it an IRRlicht bug or the GUI goes completely reverse when the shader is activated? Here a screen, it flicker from black to white.
Image
EDIT: Ok, this happened before... Found a way to fix the reverted GUI.
http://irrlicht.sourceforge.net/phpBB2/ ... i+reversed
But the flickering is still there... Anybody have an idea?

I was using GLSL shader in the project but for materials (terrain and water). Can this affect the rendering? I've disabled the application of the material that I was using thoses shaders just to see and the same problem continue. Your binary run just fine here...
User avatar
christianclavet
 
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA

Postby tbw » Sat May 07, 2011 6:22 am

Thank you all for your interest.
I had the same flip effect with the gui and also with images drawn after applying the postprocess. In my project I used:
Code: Select all
VideoDriver->setMaterial(VideoDriver->getMaterial2D())

to fix it

Regarding the postprocess it is a necessary to use this order
Code: Select all
//prepare postprocessing (true: generate depth rtt, false: don't generate depth rtt)
postProcessManager->prepare(false);

// draw the scene
smgr->drawAll();

// render the post process effect
postProcessManager->render(EPPE_INVERT);

// (render to the framebuffer)
postProcessManager->update();


Here is a snippet from my project that goes in your direction (Engine is just a singleton to get easier acces to the typical irrlicht object: video, gui, scene and so on):

1st) drawing a backgroundtexture. It's important to use the Rendertarget size (becaus in general it can have different size than the screen size)

2nd) apply some post effects to the background texture

3rd) draw the scene

4th) apply further post effects

5th) draw the gui

Code: Select all
   // prepare scene for post processing (render into the PostProcess rtt)
   Engine->getPostProcess()->prepare(false);

   // get the background texture
   video::ITexture* background = Engine->getVideo()->getTexture("media/gui/background.png");

   // get the screensize for the textured 2d drawing
   core::dimension2d<u32> screenSize = Engine->getVideo()->getScreenSize();

   // get the rendertarget size for the textured 2d drawing
   core::dimension2d<u32> targetSize = Engine->getVideo()->getCurrentRenderTargetSize();

   // set 2d material
   Engine->getVideo()->setMaterial(Engine->getVideo()->getMaterial2D());

   // draw the background
   Engine->getVideo()->draw2DImage(
      background,
        core::rect<s32>(0, 0, targetSize.Width, targetSize.Height),
        core::rect<s32>(0, 0, screenSize.Width, screenSize.Height),
        NULL,
      NULL,
      true);

   // apply post process effects
   Engine->getPostProcess()->render(EPPE_INVERT);
   Engine->getPostProcess()->render(EPPE_WATER);
   Engine->getPostProcess()->render(EPPE_DESATURATE);
   
   // draw the scene
   Engine->getScene()->drawAll();
   
   // apply further postprocess effects
   Engine->getPostProcess()->render(EPPE_RADIAL_BLUR);
   Engine->getPostProcess()->render(EPPE_VIGNETTE);
   
   // render to the framebuffer
   Engine->getPostProcess()->update();

   // set 2d material
   Engine->getVideo()->setMaterial(Engine->getVideo()->getMaterial2D());

   // draw gui
   Engine->getGui()->drawAll();
 

You're right! At the moment the depth is only needed for the depth of field effect. Only in this case you have to call
Code: Select all
getPostProcess()->prepare(true);

For all other effects you can call:
Code: Select all
getPostProcess()->prepare(false);


If you don't want to render a depth rtt of course you can leave the depthPassNodes array empty. In this case the renderDepth function in the PostProcessManager class will do nothing
Code: Select all
void CPostProcessManager::renderDepth(const video::SColor& defaultDepth)
{   
   if(DepthPassNodes.size())
   {
   ......
   }
}

If you post some more of your code maybe I could help you to find a solution

EDIT:
I looked into the irrlicht implementation and I saw for opengl driver the message
unsupported texture format

indicates a fall back to GL_RGBA8. I'm not sure if the shaders are working correctly with this format...
Last edited by tbw on Sat May 07, 2011 6:35 am, edited 1 time in total.
tbw
 
Posts: 59
Joined: Sat Jan 15, 2011 9:51 am
Location: Germany

Postby REDDemon » Sat May 07, 2011 6:29 am

Now it is working greatly ! :)

I'have tested all the effects and run smoothly (mode 1 every thing going from 40 to 60 fps, mode 2 only 20 fps :-/)

Using the "skechted" post process gives me a black screen now. is that correct? (there are also some empty pixels on the wall corners sometimes but they occur also without post processing so i think that's definitely a map issue and not a Post process' one).
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
User avatar
REDDemon
Developer
 
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Next

Return to Code Snippets

Who is online

Users browsing this forum: No registered users and 1 guest