Subject: How to programmatically set Texture Blend Amount (Percentage) in RhinoCommon?
Hi everyone,
I am currently developing a Grasshopper plugin using C# and I’m working on a custom baking component that handles materials.
In the Rhino UI, we can easily adjust the “intensity” or “blend percentage” of a texture (e.g., Diffuse or Bump) using the percentage slider. However, I am struggling to find the equivalent property or method in RhinoCommon.
I am using the basic Material class as follows:
material.SetBitmapTexture(texturePath);
Is there a way to set the “Texture Amount” (the percentage value) for Diffuse or Bump textures via RhinoCommon or the Grasshopper API? Should I be looking into RenderMaterial.SetParameter, and if so, what are the specific parameter names for these values?
Any guidance or code snippets would be greatly appreciated.
Best regards,
@Mahdiyar
private void ApplyMaterialProperties(
Material material,
string texturePath,
string bumpPath,
Color diffuseColor,
double reflectivity,
double reflectionGlossiness,
double transparency)
{
material.DiffuseColor = diffuseColor;
material.Reflectivity = reflectivity;
material.RefractionGlossiness = reflectionGlossiness;
material.Transparency = transparency;
if (!string.IsNullOrWhiteSpace(texturePath))
material.SetBitmapTexture(texturePath).;
if (!string.IsNullOrWhiteSpace(bumpPath))
material.SetBumpTexture(bumpPath);
}
