Alpha (transparency) not effected with Color.FromArgb() from Rhino.NET SDK


#1

With the following code, I get no variation in transparency of color regardless of value of Percent_Thickness_Remaining:

On3dmObjectAttributes obatts = new On3dmObjectAttributes();
obatts.SetColorSource(IOn.object_color_source.color_from_object);
obatts.m_color = OnColor.FromColor(Color.FromArgb((int)((thicknessRemaining*128.0/100.0)+64.0), 20, 90, 190)); //i.e. 0% remaining get transparency value of 64, 100% gets transparency value of 192
obatts.m_layer_index = 1;
.
.
xz = context.m_doc.AddMeshObject(oneFaceMesh, obatts);

The color itself displays fine. I have also tried using constant values for alpha of 1,128 and 254; still effecting no variation in transparency.

Trying out different display modes: ghost, x-ray, flat-shaded, render all make no difference.

Any ideas?

Thank you

Peter Schwenn


(Steve Baer) #2

Rhino doesn’t use the transparency value from the color for display purposes. You would need to assign a transparent material to the object.