Jump to content

Procedural geometry based on Unigine::Mesh


photo

Recommended Posts

Hello,

I'm trying to use Unigine::Mesh and Unigine::ObjectMeshDynamic for generating procedural geometry which is supposed to be modified by the user by setting some parameters from UI.

So I add surfaces and modify vertices/indices via Mesh class but seems that the drawback of this approach is that every time I do the geometry updates I need to transfer the mesh to ObjectMeshDynamic. The second approach, as I can see, is to submit geometry directly using ObjectMeshDynamic methods (addVertex, addIndex etc) that seem to be using/updating some internal mesh and the geometry update is triggered via flushVertex/Indices calls.

My question is, assuming that I'm always building a geometry from scratch during each update, would there be a difference (performance wise) between:

a) Modifying Unigine::Mesh and copying it to ObjectMeshDynamic using setMesh method and

b) Modyfing mesh directly in ObjectMeshDynamic and triggering updates using flushVertices/Indices call?

The only drawback I see so far is that I'm forced to reassign the material and intersection mask to ObjectMeshDynamic when I use the first approach. Material seems to get lost after setMesh call.

Thanks in advance

Link to comment

Thanks for your response. What about re-assigning materials after setMesh call? Seems materials are always lost and needs to be assigned again but I guess it is not an expensive operation at all?

Link to comment
×
×
  • Create New...