Grasshopper

algorithmic modeling for Rhino

Hi, 

Does anyone know how to set spherical mapping in rhinocommon (C#) ? 

We apply a material programmatically with the code below but don't succeed in getting the spherical mapping set up for the same object... 

//init objects
RhinoObject obj = RhinoDoc.ActiveDoc.Objects.Find(myobject_guid);
Material mymaterial = new Material();

//set enviromment texture
mymaterial.SetEnvironmentTexture(examplecolor_path);
mymaterial.CommitChanges();

//set material on object
obj.Attributes.MaterialIndex = RhinoDoc.ActiveDoc.Materials.Add(mymaterial);
obj.Attributes.MaterialSource = Rhino.DocObjects.ObjectMaterialSource.MaterialFromObject;
obj.CommitChanges();


//init spherical mapping
Rhino.Render.TextureMapping map = Rhino.Render.TextureMapping.CreateSphereMapping(new Rhino.Geometry.Sphere(new Point3d(0, 0, 0), 1));

//set spherical mapping
?????????

many thx, 

Elco & Jan

Views: 1356

Replies to This Discussion

anybody any idea? thx..

I don't know sorry. But you can ask on our discourse server using the Developer tag.

--

David Rutten

david@mcneel.com

Tirol, Austria

Hi Elco & Jan,

The TextureMapping has to be set directly on the RenderMeshes of an object. You can do so with the TextureCoordinates property of any Mesh.

As far as i know it's not possible yet to set a custom RenderMesh to a RhinoObject. But you can do texture mapping for display purposes of your own geometry objects.

Here is an example in GH C#:

Cheers,

FF

Attachments:

Cool thx! im gonna give it a try in the next couple of days

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service