mcneel / rhino3dm

Libraries based on OpenNURBS with a RhinoCommon style
MIT License
616 stars 139 forks source link

TextureMapping for non-Meshes #648

Open cedemax opened 1 month ago

cedemax commented 1 month ago

It seems that there is no way to assign texture mapping to non-Meshes like NURBS or Polysurfaces. It is possible to assign a material to these, but not texture mapping.

Is this something that could be added?

fraguada commented 5 days ago

@cedemax are you using js, py, or dotnet?nCan you provide an example of something that isn't working?

cedemax commented 5 days ago

We are using dotnet. More detail:

// We can add UVs like this to a mesh
var rMesh = new Rhino.Geometry.Mesh();
....
rMesh.TextureCoordinates.Add(...);

// but for Breps there seems to be nothing

var brep = new Rhino.Geometry.Brep();
....

brep.TextureMapping ?? 
brepFace.TextureCoordinates ??
brepTrimCurve.TextureCoordinates ??

// There are things like:
var texMap = TextureMapping.CreatePlaneMapping(...);
// but these can't seem to be applied to Breps.

It seems to work fine in the Rhino UI, so I expect it should be possible also in here?

fraguada commented 5 days ago

Thanks. I see the method we use for Rhino, I see we don't have an analog for rhino3dm. At first glance I don't see anything that would stop us from adding this in rhino3dm. Let me check with the team.

cedemax commented 5 days ago

Thank you!