Hello everyone,
I am currently working on a project where I need to modify RhinoRenderMaterials to include custom texture maps. I have been able to use the SetParameter() method to modify the material’s color and other properties, but I am having trouble changing the texture maps.
I have tried using the SetChildSlotParameter() method and have looked through the RhinoCommon documentation, but I can’t seem to find a working solution. The method doesn’t throw any errors, but the texture maps don’t seem to be updated.
Can anyone give me some direction or advice on how to properly update the texture maps for RhinoRenderMaterials?
Here’s the code snippet that I’ve been using:
Hello everyone,
I am currently working on a project where I need to modify RhinoRenderMaterials to include custom texture maps. I have been able to use the SetParameter() method to modify the material’s color and other properties, but I am having trouble changing the texture maps.
I have tried using the SetChildSlotParameter() method and have looked through the RhinoCommon documentation, but I can’t seem to find a working solution. The method doesn’t throw any errors, but the texture maps don’t seem to be updated.
Can anyone give me some direction or advice on how to properly update the texture maps for RhinoRenderMaterials?
Here’s the code snippet that I’ve been using:
using Rhino.DocObjects;
using Rhino.Render;
// get the active document
RhinoDoc doc = RhinoDoc.ActiveDoc;
// get the material object
ObjRef material_obj = pick_obj(); // Here you should provide your own method to pick an object in Rhino
RhinoObject rhino_obj = material_obj.Object();
Material material = rhino_obj.RenderMaterial;
material.BeginChange(RenderContent.ChangeContexts.Program);
// set the diffuse color
material.SetParameter("diffuse", new Color4f(0,0,0,0););
// set the texture map
material.SetChildSlotParameter("bitmap-texture", "filename", "D:\\03.png",RenderContent.ExtraRequirementsSetContexts.Program);
material.EndChange();