Page 1 of 1

CLensFlaresSceneNode - need some help

Posted: Tue Sep 13, 2005 2:10 pm
by ProSoft
Hi! Im writing this lens flares code and get stuck on a strange behaviour i cannot solve. If you test this node alone, or with some types of nodes in scene, all works well, but if you add a node like AnimatedMeshSceneNode or WaterSceneNode, the lens flares starts to looking strange. This is rendered in wrong position when its go behind one of this node. Ill sending here a modified version of SpecialFX demo, with only source code.

http://geocities.yahoo.com.br/paulo_cmv ... neNode.zip

The basic idea is to render little billboards (3units large) in front of camera (10 units in front). ZBuffer is all disabled, and node doesnt take care of being occluded by some object ( collision is to much particular to each application ). Use setVisible to do it.

Please take a look and say wath you think. Sorry my english :)

Posted: Tue Sep 13, 2005 3:45 pm
by omaremad
A good solution however i might do it this way

1- draw a line between light source and camera
2- devide line in 4 and get the postion of these points

3- add billboards there

4-The collision being related to different objects can be solved by a meta trianlge selector

if collision true then hide the nodes

btw sorry about my bad explaination may be i can write some code if u want

bye

Posted: Tue Sep 13, 2005 4:40 pm
by CZestmyr
2 omaremad: I don't get it. What's the point in dividing the line into four parts and creating three flares instead of one??

Posted: Tue Sep 13, 2005 5:05 pm
by Guest
to make this
Image

Posted: Tue Sep 13, 2005 5:17 pm
by ProSoft
>>1- draw a line between light source and camera
>>2- devide line in 4 and get the postion of these points
>>3- add billboards there

I have tryed this, but dont look real, coz billboards will reside in 3d space, instead of 2d space ( the camera lens ); this way, billboards will scale when moving. Also lens flares must cross the screen center, the way you say (between light source and camera) will go only from line the screen center. If you continue you will pass behind the camera... I have tested calculating a midpoint btw light and camera, and using this point as reference, but it dont look right too.

>>4-The collision being related to different objects can be solved by a >>meta trianlge selector
>>if collision true then hide the nodes
Ok, but lets say you using ode, or newton, or something for collision, i will not create all triangleselectors only for colliding a lens flare. Better leave this for user...

>>btw sorry about my bad explaination may be i can write some code if u >>want
I understood this better than you have understood my english, i thing.

At end, i know my code works well, only have a very strange problem. If you look at example that i send, when running it looks well, but if you uncomment the fairy loading code and run it again, you will notice a strange positioning bug. I really dont know why this occurs... coz of this im asking for help...

Posted: Tue Sep 13, 2005 5:38 pm
by ProSoft
Guest: Show it running with the lights in SpecialFX sample!

Image

Your screen looks good, but i need to see it inside an enviromment ( toghether with meshes, lights, waters, etc )

Can you explain the methos you used...

Posted: Tue Sep 13, 2005 7:17 pm
by ProSoft
Ok, i found the problem... forgot to reset transformation matrix before start rendering...

Its correct now. I updated download...

Take a look and say wath you think.

Posted: Mon Nov 17, 2008 12:18 pm
by Frank Dodd
Hello ProSoft,

I know this is an old thread but this is still a very nice and simple lens flare effect. Unfortunately there is no license notice in your code but I would like to include this into my IrrlichtWrapper project.

How are you licensing this? Is it under the same type of license as Irrlicht itself?

Thanks,

Posted: Mon Nov 17, 2008 12:20 pm
by hybrid
We have exactly this scene node in irrExt now, with proper licensing information etc, thanks to the contributions from ProSoft.

Posted: Mon Nov 17, 2008 12:42 pm
by Frank Dodd
Thanks Hybrid!

demo

Posted: Fri Jan 02, 2009 6:29 pm
by netpipe
Perhaps someone could be kind enough to make this render.

http://www.teslaenergy.ca/CLensFlaresSceneNode.tar.gz