[C++] how to provide a custom render mesh for a custom object

As per title - I would like to provide a custom render mesh for a custom object - specifically: I want to make sure that surface kinks look better.

Any clue is welcome :smile:

Hi Menno,

If getting the mesh you want is just a matter of tweaking mesh parameters, then you can use the following SDK functions to deal with object-specific mesh parameters:

RhinoObjectGetMeshParameters
RhinoObjectSetMeshParameters
RhinoObjectIsMeshParametersEnabled
RhinoObjectEnableMeshParameters
RhinoObjectRemoveMeshParameters

See rhinoSdkObject.h for details.

Does this help?

Not really, I hoped to create/update the render mesh from scratch, because we see artefacts on surface kinks, probably due to vertex normals that are shared between faces that lie on both sides of a crease.

This isn’t anything that I’ve tried. But I would think overriding the following would do it:

CRhinoObject::MeshCount
CRhinoObject::CreateMeshes
CRhinoObject::DestroyMeshes 
CRhinoObject::GetMeshes

If you’ve inherited from CRhinoBrepObject, you will want to store your custom mesh on the ON_Brep (I think).