Hi All,
I am trying to implement a custom scene node that can do shader accelerated mesh instancing (the fake instancing, comparing to the real instancing that GLES 2 doesn't support). I am not sure how should I handle the bounding box of the scene node. Now I have up to 60 node instances, but I only have one bounding box to calculate.
Fundamentally the question is how scene node bounding box is used by Irrlicht engine? if I am not using the sceneManager to do culling, do I have to give proper bounding box out?
Thanks,
gtimworks
scene node bounding box
Re: scene node bounding box
a scene node is like an instanced mesh. It is not the mesh its self, just points to it and describes the mesh's attributes when it is instanced by this node and it also contains a few handy functions that can be applied to the mesh in this instance.
A node doesn't change the meshes actual location but generates a multiplier ( I think its called a transform) that essentially masks out the difference in location between the actual mesh and the node that instances it.
The scene node's bounding box is composed of 2 coordinates a bottom left front and a top right back corner so you could find the transform between the center of the mesh and the center of the node and apply the same one to the 2 aabbox corners not forgetting to account for rotation and scale. I think the most basic scene nodes in irrlicht from which all others inherit include this functionality when generating a aabbox for the node. http://irrlicht.sourceforge.net/docu/cl ... _node.html
otherwise they have to check all the points in a mesh that is experiencing a scene node's transform and find a new pair of corners that will make the smallest possible box around the node.
there are other possible bounding volumes you could implement as alternatives to boxes like spheres or ovals. a sphere uses the distance from the center of mass to the farthest point in the mesh as a radius. any point nearer the center of the node than the nodes mesh instance's farthest vertex is inside the sphere.
A node doesn't change the meshes actual location but generates a multiplier ( I think its called a transform) that essentially masks out the difference in location between the actual mesh and the node that instances it.
The scene node's bounding box is composed of 2 coordinates a bottom left front and a top right back corner so you could find the transform between the center of the mesh and the center of the node and apply the same one to the 2 aabbox corners not forgetting to account for rotation and scale. I think the most basic scene nodes in irrlicht from which all others inherit include this functionality when generating a aabbox for the node. http://irrlicht.sourceforge.net/docu/cl ... _node.html
otherwise they have to check all the points in a mesh that is experiencing a scene node's transform and find a new pair of corners that will make the smallest possible box around the node.
there are other possible bounding volumes you could implement as alternatives to boxes like spheres or ovals. a sphere uses the distance from the center of mass to the farthest point in the mesh as a radius. any point nearer the center of the node than the nodes mesh instance's farthest vertex is inside the sphere.
Re: scene node bounding box
No, you don't have to.if I am not using the sceneManager to do culling, do I have to give proper bounding box out?