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:
(I'm struggling to find a way to disable the flare when the light is hidden)
[SOLVED] scene node visibility
[SOLVED] scene node visibility
Last edited by gammaray on Fri Aug 17, 2007 11:31 am, edited 1 time in total.
-
- Posts: 157
- Joined: Tue Mar 20, 2007 8:30 am
Code: Select all
ILightSceneNode* light->isVisible();
Tell me what you cherish most. Give me the pleasure of taking it away.
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!
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!
Re:
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!
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!