Hi there,
I am trying to select objects via octree raycast, which works, but the rendering performance isn’t great because of to many subobjects (StaticModel with multiple vertex buffers (~10000)). If I am rendering the combined object (one vertex buffer) the performance is okay, but the raycast can’t determine a subobject other then 0
, understandably.
So my idea was: taking the one-vertex-buffer model to render the models (that’s hidden from the raycast via viewmask) and use a multiple-vertex-buffer model that’s hidden from the camera to do a raycast to determine the selected subobject.
But if I do this the performance drops as low as if I use the multiple-vertex-buffer model for rendering.
The only noticeable performance boost was possible if I disabled the multiple-vertex-buffer model, but on a disabled node the raycast does not work either. Setting the multiple-vertex-buffer models ViewMask
to 0x00000000
or setting its DrawDistance
to 0
or a very high value (100000) has no effect on the performance. I also tried to set the Ocludee
property to true
, with no noticeable impact.
That’s quite interesting in my opinion. Shouldn’t setting a models ViewMask
to 0x00000000
prevent it from rendering, because it’s invisible for the cameras? But it seems as the vertex buffers still get transferred to the graphics card and causing some performance trouble there. I can not imagine that the raycast hits the performance so hard.
Are there any ideas out there, how to prevent a StaticModel from rendering? (Or an other idea how to perform the model selection?)
Two ideas I still have are:
- loading the submodels as CollisionShapes and perform a physics raycast (but I think the physics engine will die with that many objects),
- creating a color coded texture and select the object according to the color at the position where the raycast hits the texture (the problem here is to unwrap the model(s) in blender, because they are very large with high polygon count (~500000 all together) and not easy to unwrap).
best regards,
ahorn42