CLensFlaresSceneNode - need some help

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
ProSoft
Posts: 59
Joined: Thu Sep 08, 2005 10:55 am
Location: Brasil

CLensFlaresSceneNode - need some help

Post 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 :)
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post 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
CZestmyr
Posts: 72
Joined: Sat Feb 12, 2005 7:11 pm
Location: Czech Republic
Contact:

Post 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??
Guest

Post by Guest »

to make this
Image
ProSoft
Posts: 59
Joined: Thu Sep 08, 2005 10:55 am
Location: Brasil

Post 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...
ProSoft
Posts: 59
Joined: Thu Sep 08, 2005 10:55 am
Location: Brasil

Post 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...
ProSoft
Posts: 59
Joined: Thu Sep 08, 2005 10:55 am
Location: Brasil

Post 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.
Frank Dodd
Posts: 208
Joined: Sun Apr 02, 2006 9:20 pm

Post 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,
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

We have exactly this scene node in irrExt now, with proper licensing information etc, thanks to the contributions from ProSoft.
Frank Dodd
Posts: 208
Joined: Sun Apr 02, 2006 9:20 pm

Post by Frank Dodd »

Thanks Hybrid!
netpipe
Posts: 669
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

demo

Post by netpipe »

Perhaps someone could be kind enough to make this render.

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