A simple, robust and extendible postprocessing class

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

Post by DavidJE13 »

Those are some nice screenshots :)
looks like you removed one of the bits of the flare, and it looks better without it, so I'm removing it from the main release.

code & screenshot of the bug would be helpful, yes.

I (finally) finished the next update. Sorry it took longer than expected, life intervened.

Changes:
* Lens flare only shows when the sun is visible. The method used is a little slow, but usually fast enough. *important*: this judges visibility by pixel brightness, so your sun MUST be > 90% white, and occluding objects should be mainly < 90% white.
* Most shaders play nice with the z-depth now.
* All shaders to use standard opengl variables (gl_TexCoord[0]) instead of custom ones (mTC) - this may make them more efficient (?) and will need custom effects to be changed to fit.
* Some effects now use built-in material types without custom shaders, which should make them faster (only 1 shader instead of 2)
* I've removed all "using namespace" requirements; they are now optional, so it should fit in better with projects
* I changed all shortcut variable types to the full version (i.e. vector3df -> vector3d<f32>), which should avoid problems with different setups/versions of irrlicht
* I've added a quality setting, so for example PP_BLURFINE doesn't exist any more, use PP_BLUR and setQuality( PPQ_HIGH ). All blurs support at least 2 quality levels, most 3. Some other effects also support quality levels. The quality levels are; PPQ_DEFAULT (standard, regular use) PPQ_FAST (for slow machines or lots of effects) PPQ_CRUDE (not as accurate, but fastest possible without disabling the shader) PPQ_HIGH (better look, for faster computers / simple scenes) and PPQ_BEST (no effects support this yet, so for now it's like using PPQ_HIGH)

same download location as before.

Adler1337; if this doesn't fix the old monitor effect for you, please try these;
1) does the effect work in the demo? i.e. is it only broken when you try including it in your own project?
2) try this shader in it's place, is it still broken?

Code: Select all

#define GL_OLDMONITOR "uniform float randNum,time,vecValue0;uniform sampler2D texture1;float tear(in float y){return (y-0.8)*0.01/(y*y*y*y+2.0);}void main(void){float c=dot(texture2D(texture1,vec2(floor(gl_TexCoord[0].x/0.002)*0.002+tear((gl_TexCoord[0].y-1.2+mod(time*0.1,1.4))*50.0)*5.0*vecValue0,floor(gl_TexCoord[0].y/0.005)*0.005+floor(mod(time*0.1+randNum*0.1,1.0)*1.1)*0.03*vecValue0)),vec4(0.2,0.5,0.3,0.0));gl_FragColor=(texture2D(texture1,vec2(gl_TexCoord[0].x+tear(tan(gl_TexCoord[0].y*10.0+time*2.0))*vecValue0,gl_TexCoord[0].y))*(1.0-0.7*vecValue0)+c*0.7*vecValue0+vec4(1.0)*0.1*vecValue0)*(1.0-(sin(gl_TexCoord[0].y*400.0)*0.05+(pow(gl_TexCoord[0].x*2.0-1.0,4.0)+pow(gl_TexCoord[0].y*2.0-1.0,4.0))*0.5)*vecValue0);}"
(it's exactly the same, but with no "random" effects)
3) try the GL_A_SIMPLER_SHADER (from main.cpp in the example) in it's place, still broken?
4) if you can, tell me what errors (if any) appear on the command prompt when you run it (I don't know how to do this in windows, other than running the exe via the command line)
thanks

edit: Adler, seems I missed your last post, sorry about that. Here is the exact code I am using to test; (it's entirely from the example, just copied & pasted about a bit). This doesn't have the error for me.

Code: Select all

#ifdef _IRR_WINDOWS_
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#pragma comment(lib, "Irrlicht.lib")
#endif
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

#include "CRendererPostProc.h"
#include "CEffectPostProc.h"
#include "CTransitionPostProc.h"
#include "CSplitPostProc.h"
#include "CLensFlarePostProc.h"
#include "CWaterPostProc.h"

#define GL_OLDMONITOR "uniform float randNum,time,vecValue0;uniform sampler2D texture1;float rand(in float s){return sin(gl_TexCoord[0].x*(1009.0+s*10.0)+tan(gl_TexCoord[0].y*(1090.0+s*100.0)+tan(gl_TexCoord[0].x*111.0+s*10000.0))+s*4.0+gl_TexCoord[0].y*10000.0)*0.5+0.5;}float tear(in float y){return (y-0.8)*0.01/(y*y*y*y+2.0);}void main(void){float c=dot(texture2D(texture1,vec2(floor(gl_TexCoord[0].x/0.002)*0.002+tear((gl_TexCoord[0].y-1.2+mod(time*0.1,1.4))*50.0)*rand(randNum)*5.0*vecValue0,floor(gl_TexCoord[0].y/0.005)*0.005+floor(mod(time*0.1+randNum*0.1,1.0)*1.1)*0.03*vecValue0)),vec4(0.2,0.5,0.3,0.0));gl_FragColor=(texture2D(texture1,vec2(gl_TexCoord[0].x+tear(tan(gl_TexCoord[0].y*10.0+time*2.0))*vecValue0,gl_TexCoord[0].y))*(1.0-0.7*vecValue0)+c*0.7*vecValue0+vec4(rand(randNum))*0.1*vecValue0)*(1.0-(sin(gl_TexCoord[0].y*400.0)*0.05+(pow(gl_TexCoord[0].x*2.0-1.0,4.0)+pow(gl_TexCoord[0].y*2.0-1.0,4.0))*0.5)*vecValue0);}"
#define DX_OLDMONITOR ""

int main( ) {
	IrrlichtDevice* device = createDevice( video::EDT_OPENGL, dimension2d<s32>( 640, 480 ), 16, false, false, false, 0 );
	IVideoDriver* driver = device->getVideoDriver( );
	ISceneManager* smgr = device->getSceneManager( );
	IGUIEnvironment* guienv = device->getGUIEnvironment( );
	guienv->addStaticText( L"Custom Effect (Old Monitor)", rect<s32>( 10, 10, 260, 22 ), true );
	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( smgr->getMesh( "../../media/sydney.md2" ) );
	node->setMaterialFlag( EMF_LIGHTING, false );
	node->setMD2Animation( scene::EMAT_STAND );
	node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
	smgr->addCameraSceneNode( 0, vector3df( 40.0f, 30.0f, -40.0f ), vector3df( 0.0f, 5.0f, 0.0f ) );
	
	ISceneNode* sun = smgr->addSphereSceneNode( 50.0f, 16 );
	sun->setPosition( vector3df( -500.0f, 0.0f, 1000.0f ) );
	sun->setMaterialFlag( EMF_LIGHTING, false );
	sun->setMaterialTexture( 0, driver->getTexture("../../media/sun.png") );
	
	IPostProc* ppRenderer = new CRendererPostProc( smgr, dimension2di( 1024, 512 ), true, true, SColor( 255u, 100u, 101u, 140u ) );
	CLensFlarePostProc* ppFlare = new CLensFlarePostProc( ppRenderer, dimension2di( 1024, 512 ), driver->getTexture("../../media/flare.png"), sun, 50.0f );
	CEffectPostProc* ppMine = new CEffectPostProc( ppFlare, dimension2di( 1024, 512 ), GL_OLDMONITOR, DX_OLDMONITOR, EPST_PS_1_2, EMT_SOLID, PPF_FROMCODE, 1.0f );
	ppMine->setTimer( device->getTimer( ) );
	
	while( device->run( ) ) {
		ppMine->setParameters( min_( 1.0f, device->getTimer( )->getTime( ) * 0.0002f ) );
		
		driver->beginScene( false, false );
		ppMine->render( NULL );
		guienv->drawAll( );
		driver->endScene( );
	}
	
	delete ppMine;
	delete ppFlare;
	delete ppRenderer;
	
	device->drop();
	return 0;
}
Last edited by DavidJE13 on Sun Sep 20, 2009 1:40 am, edited 1 time in total.
P1SQ4M
Posts: 66
Joined: Sat Sep 19, 2009 1:47 am

Post by P1SQ4M »

I just tried compiling the files listed in the zip in the first post. It started well, but didn't end that way.
1>------ Build started: Project: post test, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>IPostProc.cpp
1>CWaterPostProc.cpp
1>CTransitionPostProc.cpp
1>CSplitPostProc.cpp
1>..\..\..\CSplitPostProc.cpp(96) : warning C4244: 'argument' : conversion from 'irr::f32' to 'irr::s32', possible loss of data
1>..\..\..\CSplitPostProc.cpp(96) : warning C4244: 'argument' : conversion from 'irr::f32' to 'irr::s32', possible loss of data
1>..\..\..\CSplitPostProc.cpp(96) : warning C4244: 'argument' : conversion from 'irr::f32' to 'irr::s32', possible loss of data
1>..\..\..\CSplitPostProc.cpp(96) : warning C4244: 'argument' : conversion from 'irr::f32' to 'irr::s32', possible loss of data
1>CRendererPostProc.cpp
1>CLensFlarePostProc.cpp
1>..\..\..\CLensFlarePostProc.cpp(136) : warning C4244: 'argument' : conversion from 'irr::f32' to 'irr::s32', possible loss of data
1>..\..\..\CLensFlarePostProc.cpp(136) : warning C4244: 'argument' : conversion from 'irr::f32' to 'irr::s32', possible loss of data
1>..\..\..\CLensFlarePostProc.cpp(194) : warning C4018: '<' : signed/unsigned mismatch
1>..\..\..\CLensFlarePostProc.cpp(225) : warning C4244: 'argument' : conversion from 'irr::f32' to 'irr::u32', possible loss of data
1>..\..\..\CLensFlarePostProc.cpp(225) : warning C4244: 'argument' : conversion from 'irr::f32' to 'irr::u32', possible loss of data
1>..\..\..\CLensFlarePostProc.cpp(225) : warning C4244: 'argument' : conversion from 'irr::f32' to 'irr::u32', possible loss of data
1>..\..\..\CLensFlarePostProc.cpp(234) : warning C4244: 'argument' : conversion from 'const irr::f32' to 'irr::u32', possible loss of data
1>..\..\..\CLensFlarePostProc.cpp(234) : warning C4244: 'argument' : conversion from 'const irr::f32' to 'irr::u32', possible loss of data
1>..\..\..\CLensFlarePostProc.cpp(234) : warning C4244: 'argument' : conversion from 'const irr::f32' to 'irr::u32', possible loss of data
1>CEffectPostProc.cpp
1>Generating Code...
1>c:\users\admin\projet\irrlicht-1.5.1\include\irrarray.h(264) : warning C4793: 'irr::core::array<CEffectPostProc *,irr::core::irrAllocator<CEffectPostProc *> >::operator[]' : function compiled as native :
1> Inline native assembly not supported in managed code
1>c:\users\admin\projet\irrlicht-1.5.1\include\ireferencecounted.h(119) : warning C4793: 'irr::IReferenceCounted::drop' : function compiled as native :
1> Inline native assembly not supported in managed code
1>c:\users\admin\projet\irrlicht-1.5.1\include\irrarray.h(264) : warning C4793: 'irr::core::array<irr::video::S3DVertex,irr::core::irrAllocator<irr::video::S3DVertex> >::operator[]' : function compiled as native :
1> Inline native assembly not supported in managed code
1>c:\users\admin\projet\irrlicht-1.5.1\include\irrarray.h(264) : warning C4793: 'irr::core::array<float,irr::core::irrAllocator<float> >::operator[]' : function compiled as native :
1> Inline native assembly not supported in managed code
1>c:\users\admin\projet\irrlicht-1.5.1\include\irrarray.h(273) : warning C4793: 'irr::core::array<irr::video::S3DVertex,irr::core::irrAllocator<irr::video::S3DVertex> >::operator[]' : function compiled as native :
1> Inline native assembly not supported in managed code
1>c:\users\admin\projet\irrlicht-1.5.1\include\irrarray.h(264) : warning C4793: 'irr::core::array<irr::core::rect<float>,irr::core::irrAllocator<irr::core::rect<float> > >::operator[]' : function compiled as native :
1> Inline native assembly not supported in managed code
1>c:\users\admin\projet\irrlicht-1.5.1\include\irrarray.h(264) : warning C4793: 'irr::core::array<irr::video::S3DVertex,irr::core::irrAllocator<irr::video::S3DVertex> >::operator[]' : function compiled as native :
1> Inline native assembly not supported in managed code
1>c:\users\admin\projet\irrlicht-1.5.1\include\irrarray.h(273) : warning C4793: 'irr::core::array<irr::video::S3DVertex,irr::core::irrAllocator<irr::video::S3DVertex> >::operator[]' : function compiled as native :
1> Inline native assembly not supported in managed code
1>c:\users\admin\projet\irrlicht-1.5.1\include\irrarray.h(264) : warning C4793: 'irr::core::array<IPostProc::PSConnector,irr::core::irrAllocator<IPostProc::PSConnector> >::operator[]' : function compiled as native :
1> Inline native assembly not supported in managed code
1>c:\users\admin\projet\irrlicht-1.5.1\include\irrarray.h(273) : warning C4793: 'irr::core::array<irr::video::S3DVertex,irr::core::irrAllocator<irr::video::S3DVertex> >::operator[]' : function compiled as native :
1> Inline native assembly not supported in managed code
1>c:\users\admin\projet\irrlicht-1.5.1\include\irrarray.h(264) : warning C4793: 'irr::core::array<irr::video::S3DVertex,irr::core::irrAllocator<irr::video::S3DVertex> >::operator[]' : function compiled as native :
1> Inline native assembly not supported in managed code
1>c:\users\admin\projet\irrlicht-1.5.1\include\ireferencecounted.h(119) : warning C4793: 'irr::IReferenceCounted::drop' : function compiled as native :
1> Inline native assembly not supported in managed code
1>Linking...
1>main.obj : error LNK2028: unresolved token (0A000555) "class irr::IrrlichtDevice * __cdecl irr::createDevice(enum irr::video::E_DRIVER_TYPE,class irr::core::dimension2d<int> const &,unsigned int,bool,bool,bool,class irr::IEventReceiver *)" (?createDevice@irr@@$$FYAPAVIrrlichtDevice@1@W4E_DRIVER_TYPE@video@1@ABV?$dimension2d@H@core@1@I_N22PAVIEventReceiver@1@@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
1>main.obj : error LNK2019: unresolved external symbol "class irr::IrrlichtDevice * __cdecl irr::createDevice(enum irr::video::E_DRIVER_TYPE,class irr::core::dimension2d<int> const &,unsigned int,bool,bool,bool,class irr::IEventReceiver *)" (?createDevice@irr@@$$FYAPAVIrrlichtDevice@1@W4E_DRIVER_TYPE@video@1@ABV?$dimension2d@H@core@1@I_N22PAVIEventReceiver@1@@Z) referenced in function "int __cdecl main(void)" (?main@@$$HYAHXZ)
1>C:\Users\Admin\Links\PostProcessor\PostProc.xcodeproj\post test\Debug\post test.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:\Users\Admin\Links\PostProcessor\PostProc.xcodeproj\post test\post test\Debug\BuildLog.htm"
1>post test - 3 error(s), 25 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Any clues?
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

wow, um. I was expecting maybe a couple of errors with the huge changes, but... wow. one minute please! lol
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

ok, this is very odd. The first errors are simple enough, and nothing to worry about (though I've fixed them anyway for the next release) but I don't understand the errors like this;
1>c:\users\admin\projet\irrlicht-1.5.1\include\irrarray.h(264) : warning C4793: 'irr::core::array<CEffectPostProc *,irr::core::irrAllocator<CEffectPostProc *> >::operator[]' : function compiled as native :
1> Inline native assembly not supported in managed code
it seems that all of the arrays are causing it the same problem. I did a quick google search, and someone else (also using irrlicht) had the same problem. solution was this;
Switch the compiler to /clr and it should work (Go into Project->Properties-> C++, and turn it from clr:pure or clr:safe to just 'Common Language Runtime support')
m_krzywy
Posts: 133
Joined: Sat Nov 04, 2006 2:05 pm

Post by m_krzywy »

Ther's some problem here with effects. I see only black screen. Using the lens flare.

Code: Select all

ISceneNode* sun = smgr->addSphereSceneNode( 50.0f, 16 );
	 sun->setPosition( vector3df( 100.0f, 2200.0f, 6000.0f ) );
	 sun->setMaterialFlag( EMF_LIGHTING, false );
	 sun->setMaterialTexture( 0, driver->getTexture("media/sun.png") );
     
     
     IPostProc* ppRenderer = new CRendererPostProc( smgr, dimension2di( 1024, 512 ), true, true, SColor(255,100,101,140) );
     
	 ppFlare = new CLensFlarePostProc::CLensFlarePostProc( ppRenderer, dimension2di( 1024, 512 ), driver->getTexture("media/flare.png"), sun );

Code: Select all

                driver->beginScene( false, false );
		water->updateRendertarget(smgr);
		ppFlare->render(NULL);
		env->drawAll( );        
                driver->endScene();

Using Irrlicht 1.5.1 and OpenGL

Image

After some time i get bloom to working. But it looks horrible. You have changed it. Can you suggest some values of it to looks like on my previous screens?
Image

Code: Select all

ppBloom = new CEffectPostProc( ppRenderer, dimension2di( 1024, 512 ), PP_BLOOM, 2.4f);
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Post by 3DModelerMan »

I'm doing a project that I want to use this for, but my project uses DirectX9. If you can write the shaders I could compile them.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

ok, sorry about the new bugs. I can see what's happening and I'll try to fix it ASAP. (bloom hasn't changed; it looks weird because of the same bug as lens flare. all you're seeing is the bits that get brightened)

Since this isn't a bug on OSX, I guess it's time for me to turn on my windows box and see what's going on. I'll also have a go writing some of the simpler directX shaders while I'm there.
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

ok, sorry about the new bugs. I can see what's happening and I'll try to fix it ASAP. (bloom hasn't changed; it looks weird because of the same bug as lens flare. all you're seeing is the bits that get brightened)

Since this isn't a bug on OSX, I guess it's time for me to turn on my windows box and see what's going on. I'll also have a go writing some of the simpler directX shaders while I'm there.


edit:
hmm, ok - a fair few bugs on windows it seems.
I'm seeing a lot of horizontal bars flickering across the screen,

The lens flare is acting very strange, with the entire scene dimming as the camera moves,
update: FIXED: I'd forgotten to set gl_FrontColor=vec4(1.0); in the GL_V_FULLSCREEN shader

I'm finally seeing the problem with the monitor effect, so should be able to do something about that,
update: FIXED: Arguably a bug in the hardware, but I guess not - doesn't like doing negative numbers ^ 4.0. Mathematically it's a valid thing to do, but seems it can't be sure the number isn't 3.99 or something, which wouldn't give real number results. Anyway, adding 2 abs() funcs to the effect have fixed it for the next update :)

and when I close the window, it crashes
update: FIXED: setInput( num, texture ) with texture = NULL wasn't clearing the old input. Although I still occasionally get a crash with device->drop() that I can't pin down.

so a fair bit to fix. Not seeing quite the bug you mentioned m_krzywy, but I think the dimming with lens flare I'm getting is related, so the fix should fix both. update: yes, I'm sure it is the same bug. Next release will fix your problem, and I'll post it when I've fixed the final 2 bugs
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

ok, new version is up. Fixes bugs on Windows.

No DirectX shaders yet, wanted to get the fixes released quickly.

There are still 2 bugs I don't understand;

all of the effects make 1px horizontal splits flash across my screen when active, something that I've never seen before. If I move the app to monitor 2, the splits are still on monitor 1... very odd.

when calling device->drop(), the program crashes UNLESS a second scene manager has been created with smgr->createNewSceneManager( false );
The crash returns if you drop this new object before dropping the device

are these specific to my pc? google didn't help here.

edit: oh and the water effect seems a bit broken in Windows. No idea why, I'll see if I can fix it.
m_krzywy
Posts: 133
Joined: Sat Nov 04, 2006 2:05 pm

Post by m_krzywy »

DavidJE13 wrote: No DirectX shaders yet, wanted to get the fixes released quickly.

There are still 2 bugs I don't understand;

edit: oh and the water effect seems a bit broken in Windows. No idea why, I'll see if I can fix it.
Thanks in advance. I'll test new version and see if there are some bugs.

Edit:
All working fine for me. No crash on exit. Bloom is great but have some problems with CLensFlare, the system you implemented is quite buggy and have some problems with screen coordinates. I have 800x600 render and a cross in the middle. The cross sometimes move up or down without a reason.

Meybe drawing 3dline.start camera and end in sun then while something is in the line way effect will not render :D
Last edited by m_krzywy on Sun Sep 20, 2009 9:16 pm, edited 1 time in total.
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

Meybe drawing 3dline.start camera and end in sun then while something is in the line way effect will not render :D
I tried this (it's the method used if you set the quality to PPQ_CRUDE) but it's also buggy - the only method I found checks by bounding boxes instead of per triangle, and even if I get past that it won't allow transparent objects (i.e. tree leaves)

edit: ok, misunderstood. I'll look into the positioning glitch, not sure why it's happening, but most of the coordinate stuff in that bit I don't fully understand. Seems Irrlicht switches between texture coords, current render target coords and screen coords at a whim...

If you want to disable the testing (go back to how it was in the old version), use PPQ_CRUDE and use a vector to follow instead of a scene node.
Escen
Competition winner
Posts: 167
Joined: Sun Jul 19, 2009 11:27 am
Location: the Netherlands
Contact:

Post by Escen »

DavidJE13: Good news, when I use one of your effect I have a FPS boost.(55->120)

I´m not really into shaders, but what is a possible simple explanation for this, comparing this with the normal ->DrawAll method?

Wonder were my delay takes place. Can you give my any direction?

Cheers.
Adler1337
Posts: 471
Joined: Sat Aug 09, 2008 6:10 pm
Location: In your base.

Post by Adler1337 »

Sorry i haven't posted in a while. I have been busy.
1) does the effect work in the demo? i.e. is it only broken when you try including it in your own project?
The example works fine. When i use the updated version without the new #define GL_OLDMONITOR the screen is completely black, however when i use the new #define GL_OLDMONITOR the top 1/4 of the screen is the only thing that displays. It is the same thing that was happening before. The code in my project is taken directly out of main.cpp. I have no idea what is going on.
4) if you can, tell me what errors (if any) appear on the command prompt when you run it (I don't know how to do this in windows, other than running the exe via the command line)
No errors

btw I am using windows xp pro and i have a Nvidia GeForce 8600 graphics card.
multum in parvo
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

Escen: I honestly have no idea! It's good to know, but there's really nothing I've done that should be faster than a straightforward render. The only thing which comes to mind is that this uses power-of-2 render targets, and what you're doing might not (not sure if Irrlicht enforces this)
I suppose a test for that (if you really want to know) would be to change dimension2di( 1024, 512 ) to dimension2di( 1023, 512 ) and see if it slows down again.

Adler1337: Hmm, I really thought I'd fixed it this time! Well I've just finished porting it to a Direct3D9 shader, so that will most likely work for you (it's totally new code, and a bit of the openGL shader code was also changed, so that may work too). I'll be uploading soon (probably tomorrow), once I've got depth-of-field and haze converted.


Also, in the next version you can make your own old monitor effect (which will be more efficient, though not exactly the same), by combining the new effects PP_VIGNETTE, PP_PIXELATE with the old PP_TINT and PP_NOISE.
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

ok, a new version's up.

I haven't converted haze, depth of field or water yet. (there's no real problem with converting them, though they will need to be cut-down to fit into a directX shader, I just haven't done it yet)

So the most obvious change is that almost all effects now work in Direct3D9 (not in Direct3D8 though), but there are a few others too;

* Depths are now stored as 100.0/(z+100.0) instead of 1.0-100.0/(z+100.0) This removes a calculation in both setting and getting the depth, which helps to fit shaders into directX.
* Custom effects now must specify both OpenGL *and* DirectX pixel shader versions
* The noise effect is better & faster
* Some new effects have been added; PP_PIXELATE, PP_PIXELATEBANDS, PP_VIGNETTE, PP_BIBLUR, PP_SATURATE, PP_PUNCH, PP_MONITOR
PP_BIBLUR is a bi-directional blur which is better quality than PP_HBLUR+PP_VBLUR but slower. To see it properly, use PPQ_GOOD quality.
PP_MONITOR uses many other effects to simulate a (cartoon-esque) old monitor. Doesn't include tearing like the custom effect, but is still quite good.
* Shader variables are now only set if requested. In general this means a speed boost (in directX, irrlicht would throw errors into the log every frame, causing MAJOR slowdown)
This means you now need to specify which parameters you use when making custom shaders, since I can't find a way to calculate this.
* The Renderer node now always uses alpha = 0 in the back colour, regardless of what is set. This helps depth-related shaders.
* PP_DEPTH can now take parameters - near and far - to specify the range of gradient
* PP_TINT now takes an extra multiplier parameter, allowing varying levels of tint. This is used by PP_SATURATE (because a negative multiplier and grey tint will make colours more vivid). Multipliers higher than 1 swap the colours without changing the luminosity... could make some weird effects!
Post Reply