OctTree and moving objects
#1
Hi,

I have a question about moving objects and OctTree. Let's consider this scenario:

1. I have complex scene with multiple objects.
2. I try to select something using Raycast. For that I am using DXEngine OctTree.
3. Now throw multiple moving objects in the hierarchical structure.

The question is if there exists a way to dynamically propagate changes to a child node to parent (it should be possible to set the bounding boxes for each node, but I am not sure if it is recommended)? And would you recommend using the DXEngine OctTree for multiple objects as it seems from the constructors that it is more targeted on single object?

Thank you,

Sincerely
Janovský Roman
#2
Why you don't use the hit-testing that is part of the Ab3d.DXEngine? 

OctTree in DXEngine is designed for organizing triangles inside complex meshes so hit testing can work very fast - without checking the ray to triangle intersection for each triangle in the mesh (that can have millions of triangles). It cannot be used to store many objects and do a hit test on them.

But usually number of objects does not go into millions. If you have a few thousands of objects, then you can do manual hit testing with checking if ray hits the bounding box (checking all objects) and then in case of intersection do a mesh intersection test. This should be still very fast on a modern CPU.

If you use transformations to animate your objects, then you do hit testing in such a way that you transform the original camera's ray with the inverse world transform of the object.
Andrej Benedik
#3
Do I understand correctly, that this use case is handled by DXEngine by default? 

I can expect to have thousand objects. Most of them are small between 100 - 10000 triangles, but some of them are large 500 000-1 000 000 triangles (imagine an engine CAD model with bolts/paddings everywhere and with very detailed cooler). If I use the DXEngine hit-testing will these large objects have an OctTree created (to speed up the hit testing) or do I have to manually create them? Is there a setting when the OctTree should be created (like when mesh is larger than...)? 

In the ObjectSelectionWithSubMeshes sample you show how to hit test object with submeshes and OctTree. The octtree there is not part of any SceneNode. Is there a way to make the OctTree part of the SceneNode - like overriding a method in a subclass, or inserting a behavior like CustomRenderableNode does?

PS: I am trying to convert our WPF structure to use DXEngine so I am trying to find out what needs to be changed to support the behavior we have.
#4
Yes, OctTree is automatically generated by DXEngine when a mesh have a lot of triangles.

By default, OctTree is generated when the number of positions in more than 512. You can change that with MainDXViewportView.DXScene.DXHitTestOptions.MeshPositionsCountForOctTreeGeneration (the DXHitTestOptions also has some other properties that control the generation of OctTree).

In DXEngine the OctTree is used by the Ab3d.DirectX.Models.DXMeshGeometry3D class that is created from the WPF's MeshGeometry3D. The OctTree is set to the DXMeshGeometry3D.OctTree property.

But you can also use OctTree by yourself - as shown in the mentioned sample (ObjectSelectionWithSubMeshes), you can create it from a vertex and an index buffer or any other definition of triangles. After you create it, you can call HitTest method on OctTree.
Andrej Benedik
  


Forum Jump:


Users browsing this thread:
1 Guest(s)