A simple, robust and extendible postprocessing class

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

occlusion doesn't depend on the object type, just so long as all the objects render their z position into the alpha channel (specifically, with this new version they need to write 1.0 - 50.0 / (z + 50.0) into the z)

the reason you can't see anything between the tree and box/terrain is because there's very little distance between them, so the effect is barely noticeable. You can fix it by setting the multiplier higher, though this will make a thick outline against the clouds. It's a bit of a limitation with the effect - maybe it would be better if after a certain distance it began to fade out again, as it would in reality.

as for a screenshot of the water;
Image

The general blocky-ness of the water is because of my crude wave generator. The jagged shoreline is because of the 8-bit depth buffer, and the black far-away water.. I don't know, I need to look into that. It's probably because it's very deep, but the reflection not refraction should be in effect there.
edit: duh! worked it out - the z coord is infinite there, so it can't work out where the water is. I'll see what I can do to fix that
Adler1337
Posts: 471
Joined: Sat Aug 09, 2008 6:10 pm
Location: In your base.

Post by Adler1337 »

well the old monitor effect isn't really supported. it's just me messing about. Might be able to fix it if you can tell me if it's showing the whole scene compacted, only the top-right quadrant (cropped), or the bottom left quadrant panned to the top right. What you describe implies I made a mistake with some texture size/copy function somewhere, which is worth tracking down.
It only shows the top right quadrant, like the rest is just cut off, not compacted. Also, i noticed the lens flare doesn't get hidden by the black space. It would be awesome if you could fix this, because i really like the effect. :)
multum in parvo
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

hmm, still looking into that. Not found the cause yet.

I've updated the water a bit;
Image
and it will automatically switch to an underwater view when the camera moves below the surface;
Image

download will be updated in a sec
sp00n
Posts: 114
Joined: Wed Sep 13, 2006 9:39 am

Post by sp00n »

Hi David, it's great that you're still working with it :)
I'll look more detail at your code some later and may be make some additions.
Also, i want to say you can exclude a line

Code: Select all

#include <windows.h>
from the main.cpp file, for mainly irrlicht projects we don't need a win32 functionality directly (it all is in the engine core)
Good luck

Edit: one more note - why don't you use a delete for your new operator? Another one - at the lens flare example you have two new operators for the same pointer - it's bad style :)
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

oops, I'm always forgetting that stuff. I've added a delete for each new (in the example and in the classes), fixed that double set in the lens flare, and added a remove call for the camera made by the water node, so that should be everything tidied up :)

I'm going through now fixing the using namespace stuff so that it isn't needed by the classes. Should make it integrate with existing projects easier.

All this will be in the next update.
Adler1337
Posts: 471
Joined: Sat Aug 09, 2008 6:10 pm
Location: In your base.

Post by Adler1337 »

Any luck with the old monitor effect?
multum in parvo
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

not as yet - not being able to reproduce the bug is a problem, but I'm changing a *lot* of the code now, so there's a chance it'll be fixed in the next update. If it isn't, I'll put up a few tests you can run to help me track it down.
Adler1337
Posts: 471
Joined: Sat Aug 09, 2008 6:10 pm
Location: In your base.

Post by Adler1337 »

not being able to reproduce the bug is a problem
I don't see why you can't reproduce the bug. I am not doing anything special in my code that would mess with it. I just copied the code from the example. Maybe there is something wrong with the example code. Are you using the exact code from the example to test it?
If it isn't, I'll put up a few tests you can run to help me track it down
I would be happy to help.

PS: When do you think the next update will be available?
multum in parvo
m_krzywy
Posts: 133
Joined: Sat Nov 04, 2006 2:05 pm

Post by m_krzywy »

DavidJE13 wrote:I'll put up a few tests you can run to help me track it down.
Will be honoured to test.
zillion42
Posts: 324
Joined: Wed Aug 29, 2007 12:32 am
Location: Hamburg, Germany

Post by zillion42 »

that is great stuff... respect and thanks !
m_krzywy
Posts: 133
Joined: Sat Nov 04, 2006 2:05 pm

Post by m_krzywy »

Downoladed new release to test and implement lens flare. Recompiled and..

Image

Code: Select all

     IPostProc* ppRenderer = new CRendererPostProc( smgr, dimension2di( 1024, 512 ), true, true, SColor(255,100,101,140) );
     ppBloom = new CEffectPostProc( ppRenderer, dimension2di( 1024, 512 ), PP_BLOOM, 2.4f);
     CEffectPostProc* ppLighten = new CEffectPostProc( ppBloom, dimension2di( 1024, 512 ), PP_LIGHTEN, 0.95f);  
     CEffectPostProc* ppAO = new CEffectPostProc( ppLighten, dimension2di( 1024, 512 ), PP_OCCLUSION, 8.0f );
     ppBlur = new CEffectPostProc( ppAO, dimension2di( 1024, 512 ),PP_BLURFINE,0.000f);
It seems that AO make it look how it looks. Disabled if for a while and all working fine.. Can you fix it somehow.

Edit:
Ther's also problem with LensFlare:

Code: Select all

  [Linker error] undefined reference to `CLensFlarePostProc::CLensFlarePostProc(IPostProc*, irr::core::dimension2d<int>, irr::video::ITexture*, irr::scene::ISceneNode*)' 

  [Linker error] undefined reference to `CLensFlarePostProc::CLensFlarePostProc(IPostProc*, irr::core::dimension2d<int>, irr::video::ITexture*, irr::core::vector3d<float>)' 

Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

Ok, can I ask when you do fix it, can you leave that effect in somehow as another effect or variant? It's wicked :)
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

yes this is a known limitation. Bloom and Lighten (and many others) do not preserve the alpha, meaning they will mess up the z-depth information. To fix it, put the occlusion first, then do bloom and lighten. I won't change this because it makes more sense to do occlusion then bloom instead of the other way around anyway. As for lighten, it's already fixed in the next release, as are most of the other non-blurring effects.
This also applies to all other effects which depend on the z-depth - they must be early in the render sequence.
(if it was working for you before, I don't know why)

Your other problem; did you include CLensFlarePostProc.cpp in the build?
if you didn't, that's the problem! and if you did, chances are it's fixed in the new version (which uses much stricter types). The new version will be available within the next few hours.


btw, it seems you're not using special shaders on your scene - remember that to use occlusion properly, you must use a shader which writes the z depth to the alpha component (specifically sets alpha to 1.0 - 100.0 / (z + 100.0)). It's a pain, but until Irrlicht 1.6 is released I can't work around it.
I added some simple shaders which should work fine for your terrain, although you will need to edit the water yourself. I realise this is a problem for the trees and clouds, which use the alpha. In the next release, I have included a EMT_TRANSPARENT_ALPHA_REF equivalent to help with this. (but the clouds will still be problematic)
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

Dorth wrote:Ok, can I ask when you do fix it, can you leave that effect in somehow as another effect or variant? It's wicked :)
heh, it is kind'a cool. as I said, I'm not fixing it - it will always look something like that when you use bloom followed by occlusion. not sure when it'd be appropriate tho :D
m_krzywy
Posts: 133
Joined: Sat Nov 04, 2006 2:05 pm

Post by m_krzywy »

Thanks for fast reply. New release is on the way by now but in the meantime i have changed AO to be beafore bloom and lighten. Same situation appeared.

I must say the AO do not work at all. I have removed all the effects let AO works. Black terrain and skydome.

But i noticed that i added sun (sphere) with white texture on it. And it appeared normally. Want code and screenshot?

Get LensFlare to working. It looks fantastic. Have some problems with object on the way camera -> sun but it's in development/beta stage so it's great! <3

Some screens for advertisment:
Image
Image
Used: Lighten, bloom, lens flare.
Post Reply