[SOLVED] scene node visibility

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
gammaray
Posts: 23
Joined: Wed Jun 28, 2006 9:38 pm

[SOLVED] scene node visibility

Post by gammaray »

If any of You posters stumbled upon a similar problem, I'd appreciate any advice You could give me:

Is there a method to determine if a scene node is 'seen' by the camera? Let's say I have a light node that generates a lens flare effect when the camera looks at the light, but when the light is hidden by an another object, I'd like it to be 'off'. How could I check this?

Here a screenie that better illustrates what I mean:
Image
(I'm struggling to find a way to disable the flare when the light is hidden)
Last edited by gammaray on Fri Aug 17, 2007 11:31 am, edited 1 time in total.
olivehehe_03
Posts: 157
Joined: Tue Mar 20, 2007 8:30 am

Post by olivehehe_03 »

Code: Select all

ILightSceneNode* light->isVisible();
That pretty much explains it :D
Tell me what you cherish most. Give me the pleasure of taking it away.
gammaray
Posts: 23
Joined: Wed Jun 28, 2006 9:38 pm

Re:

Post by gammaray »

I wish it was so easy - I've set the light node as the parent of the lens flare effect node and when I check the the parents visibility status the method isVisible() returns true, even when the light is hidden behind another node.
BMF
Posts: 62
Joined: Mon Jul 16, 2007 11:10 am
Location: Spain
Contact:

Post by BMF »

Of course it will return true. isVisible() doesn't take into account objects hiding anything. It just means that the node could be seen (if you were at an appropiate location). So, even if a node was behind your camera, it doesn't mean isVisible() would return false. I think you misunderstood isVisible()'s meaning.

On to your problem, you may want to perform some collision test. Say, if the segment that goes from the camera to the light collides with a certain node (the node that hides the light), then you should turn the lens off.

Hope it helps!
gammaray
Posts: 23
Joined: Wed Jun 28, 2006 9:38 pm

Re:

Post by gammaray »

BMF, he method suggested by You seems to do the trick, at least partially.
I cast a ray from the camera to the flare node position using SceneManager->getSceneNodeFromRayBB() and check what node the function returns. As far as I can see this works with BoundingBoxes so its not perfect detection but seems to do the trick. Thanks for the tip!
Post Reply