A simple, robust and extendible postprocessing class

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Edwart
Posts: 46
Joined: Fri Dec 30, 2005 12:29 pm

Lens flare behind objects

Post by Edwart »

hello,

i added the lens flare in my game project.
it looks great, but i have a problem that the lens flare is everytime in front of objetcs.

in the demo, when a model is in front of the sun, the lens flare is disabled.
in my game not. i have everytime the lensflare.

i use the blureffect to.

do you have an idea why the lens flare is everytime visible and not hidden, when an object is in front of the sun?

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

Post by Dorth »

Dunno, but can't you raytrace from camera to "Sun", and disable the effect if the ray collides a non-transparent object in-between?
Halifax
Posts: 1424
Joined: Sun Apr 29, 2007 10:40 pm
Location: $9D95

Post by Halifax »

Dorth wrote:Dunno, but can't you raytrace from camera to "Sun", and disable the effect if the ray collides a non-transparent object in-between?
You could do that, although it's not terribly physically accurate because the flare will completely pop-in and pop-out. The better way to do it would be to render a billboard in the position of the sun with an occlusion query around it, then modulate the intensity of the flare given how many fragments were visible.
TheQuestion = 2B || !2B
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

A lot of real flare effects pop btw... Or at least, close enough to the human eye.
DavidJE13
Posts: 165
Joined: Tue Jan 09, 2007 7:17 pm

Post by DavidJE13 »

Edwart; the class uses 2 possible methods to check sun visibility. Set the quality to CRUDE and it will do bounding-box checks in the direction of the sun. NORMAL (default) will check the colour at the sun. If it's above 0.9 (i.e ~240) in brightness, the sun is visible, otherwise not.
Both have limitations, and if you look back in this thread you'll see several discussions about better methods which will be added later.
For best results now (easy method), make sure that your obstructing object is dark and your sun is bright, and use normal quality. Also note that it will cause some slowdown.

As Dorth & Halifax said, you may be better off doing the checks yourself and disabling / enabling the effect manually (and change the colour to change the intensity of the flare). Though this is a bit more difficult.
kulesz
Posts: 4
Joined: Thu Feb 18, 2010 6:29 pm

Post by kulesz »

Can't get it to work on 1.7.1.

Changed dimension2di to dimension2du in:

Code: Select all

	IPostProc* ppRenderer = new CRendererPostProc( smgr, dimension2du( 1024, 512 ), true, true, SColor( 255u, 100u, 101u, 140u ) );
	// When setting up the effect, the parameters are:
	// Input, size of output, effect ID (see CEffectPostProc.h for full list), effect parameters (in this case, blur size)
	CEffectPostProc* ppBlur = new CEffectPostProc( ppRenderer, dimension2du( 1024, 512 ), PP_BLUR, 0.01f );
	// Change to a better quality - not all shaders will respect these, but they can be used to hint the rendering standard required.
	ppBlur->setQuality( PPQ_GOOD );
and TextureWrap in some sources:

Code: Select all

mat.TextureLayer[ 1u ].TextureWrap = irr::video::ETC_CLAMP_TO_EDGE;
to:

Code: Select all

mat.TextureLayer[ 1u ].TextureWrapU = irr::video::ETC_CLAMP_TO_EDGE;
mat.TextureLayer[ 1u ].TextureWrapV = irr::video::ETC_CLAMP_TO_EDGE;
and I get nothing, only cleared background.
Did anyone test PP on newest version of engine?
lazerblade
Posts: 194
Joined: Thu Mar 18, 2010 3:31 am
Contact:

Post by lazerblade »

I've patched and tested this to run on Irrlicht 1.7.2 SVN.

Download on mediafire: http://www.mediafire.com/?hfnzc289rm49h4v

P.S:

Sorry to bring up an old thread, I just thought others might be interested in using this as well.
LazerBlade

When your mind is racing, make sure it's not racing in a circle.

3d game engine: http://sites.google.com/site/lazerbladegames/home/ray3d
lazerBlade blog: http://lazerbladegames.blogspot.com/
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Good stuff, thanks! You shouldn't apologise for performing your civic duty!
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
anoki
Posts: 58
Joined: Fri May 05, 2006 8:31 am

Post by anoki »

this class has great effects ...
Even the class is written a long time ago ...

Thanks for updating it to 1.72

Anoki
jorgerosa
Competition winner
Posts: 117
Joined: Wed Jun 30, 2010 8:44 am
Location: Portugal
Contact:

Re:

Post by jorgerosa »

lazerblade wrote:I've patched and tested this to run on Irrlicht 1.7.2 SVN.
Download on mediafire: http://www.mediafire.com/?hfnzc289rm49h4v
Url is dead, can someone update the url? Thankyou! :)
Post Reply