Material.BackDiffuse is not working. How to make it work?


I want the back side of the mesh as Cyan color , but it is showing black…
What is wrong below, that, back side shading is not working.
But other part of the code is working perfectly.
Could not find any sample on the net.
Best regards
public class TestMeshConduit : Rhino.Display.DisplayConduit
public Rhino.Geometry.Mesh Mesh { get; set; }

protected override void CalculateBoundingBox(Rhino.Display.CalculateBoundingBoxEventArgs e)
if (null != Mesh)
Rhino.Geometry.BoundingBox bbox = Mesh.GetBoundingBox(false);

        protected override void PostDrawObjects(Rhino.Display.DrawEventArgs e)
            if (null != Mesh)
                Rhino.Display.DisplayMaterial material = new Rhino.Display.DisplayMaterial();
                material.Diffuse = System.Drawing.Color.Blue;
                material.BackDiffuse = System.Drawing.Color.Cyan;
                e.Display.DrawMeshShaded(Mesh, material);
                e.Display.DrawMeshVertices(Mesh, System.Drawing.Color.Red);
                e.Display.DrawMeshWires(Mesh, System.Drawing.Color.Black);

Don’t forget to do this:

material.IsTwoSided = true;

Hi Dale, Nice to hear from you. Thanks for the response !.I wrote it but still not working… Blue is working perfect but back side is showing black again.

This seems to work for me:

Thanks , Dale it is actually working… I think something is wrong with that particular mash… I have to check…
What are the cause for showing a mesh black? please let me know the causes.

Some sort of vertex topological problem I guess.

Perhaps your mesh does not have normals.

Rhino.Geometry.Mesh mesh = ...;

Many Thanks !
I thought I wrote , but I have missed both lines you wrote.
It is working now :slight_smile: