Hi,
Happy as I am having renderables implemented with success (render per renderable instead of whole mesh instances), I've ran into a challenge/ question. My situation is the following:
- a mesh is loaded
- several instances of the mesh are created
- each mesh instance consists of 'x' renderables
- the 'parent': mesh instance has a world matrix
- each renderable has a transformation matrix
(it's worldmatrix = local transform * parent world matrix)
- when culling I check if the mesh instance is inside the frustum (simple sphere check)
- if not, all renderables are not visible, if so, cull the individual renderables
This all works fine, until I scale one or more individual renderables, up to an amount where the bounding radius of a renderable is larger then the radius of it's parent (whole mesh instance).
Although I'm not sure if this scenario is realistic, I'd like to have my engine flexible
The result now is that the parent might be outside the frustum and therefor renderables which might be inside (because of their radius), not checked and marked !visible.
I've thought of a few solutions:
1 - simply always cull all renderables (don't cull based on full mesh instance)
2 - update the bounding radius of the parent (mesh instance) based on checking the max radius of all it's renderables
3 - assume that this situation is not likely to occur and don't change anything
What solution would go for? Or might you have a 4th solution?
(all of the above ofcourse only goes for dynamic meshes, static meshes are no issue)
Any input is appreciated.