Texture Mapping Surfaces

Hi,

Is it possible to apply texture mapping to surfaces?

For meshes there is something like this in RhinoCommon:

mesh.TextureCoordinates.SetTextureCoordinates(Mapping);

Is there similar thingy for breps/surfaces?

Thanks

  • up

    David Rutten

    Rhino supports texture mapping projections per object (cubic, spherical, cylindrical, uv etc) but I have no idea how any of that works. It's also possible that those properties are stored on the attributes of Rhino objects, instead of on the geometry. I think you're better off asking on the discourse forum, that's where you'll find the programmers who made those features.

    5
  • up

    Matt

    I'm attempting to make a C# component that allows for texture mapping meshes on multiple channels. Here is the code I have so far (M is a mesh, P is a plane, and X and Y are intervals):

    Rhino.Render.TextureMapping textureMapping1 = Rhino.Render.TextureMapping.CreatePlaneMapping(P, X, Y, new Interval(0, 1));
    Rhino.Render.TextureMapping textureMapping2 = Rhino.Render.TextureMapping.CreatePlaneMapping(P, new Interval(0, 1), new Interval(0, 1), new Interval(0, 1));
    M.TextureCoordinates.SetTextureCoordinates(textureMapping2); //M.TextureCoordinates.SetTextureCoordinates(textureMapping2, 2)
    M.TextureCoordinates.SetTextureCoordinates(textureMapping1); //
    //M.TextureCoordinates.SetTextureCoordinates(textureMapping1, 1); //

    It appears that texture mapping per channel isn't allowed on the mesh or am I missing something? If these attributes are on rhino objects instead of the geometry, does that mean 1) I have to bake the meshes and then run a secondary script which gives them their second texture mapping or 2) convert the meshes to surfaces in grasshopper and apply the mapping per channel as a rhino object? If 2, then how do I set the Guid x as the mesh? From my attempts I'm assuming I have to bake and then texture for the second channel, but wanted to check in case I'm missing something. (From the code above one channel is working completely correctly).