Display Conduit Lighted 2 sides?

At the moment I have a display conduit that shows a brep were the material is set too 2 sided.
Is it also possible to light it from 2 sides like normal objects?

See the difference below:

Top view where it is lighted:

Bottom view where the normal object is lighted but the displayed conduited brep not:

Does this sample get you anywhere?


I’ll have to check. The only thing that I don’t have In my code is e.Display.EnableLighting(true); I’ll check asap and come back to you if it worked or not.

Thanks for the quick response


I;m back from my holidays but still can’t really find the solution.

At the moment this is my code:

Public Class PatchConduitRight

    Inherits DisplayConduit

    Private _bbox As BoundingBox

    Protected Overrides Sub CalculateBoundingBox(ByVal e As CalculateBoundingBoxEventArgs)
    End Sub

    Protected Overrides Sub PreDrawObjects(ByVal e As DrawEventArgs)
        If MyBrepDefinedSomewhereElseIsNot Nothing Then
            If MyBrepDefinedSomewhereElse IsNot Nothing AndAlso MyBrepDefinedSomewhereElse.IsValid Then
                _bbox = MyBrepDefinedSomewhereElse.GetBoundingBox(True)
            End If

            Dim vp = e.Display.Viewport

            Dim Mat As New Display.DisplayMaterial(Color.Red, Color.White, Color.Gray, Color.Black, 0.0, 0)
            Mat.IsTwoSided = True

            Mat.BackDiffuse = Color.Red
            Mat.BackSpecular = Color.White
            Mat.BackAmbient = Color.Gray
            Mat.BackEmission = Color.Black
            Mat.BackShine = 0.0
            Mat.BackTransparency = 0


            e.Display.DrawBrepShaded(MyBrepDefinedSomewhereElse, Mat)

        End If
    End Sub

End Class

The lighting is the same as in my first post.
Any other solution?

Any reason you are drawing here? You might try drawing in PostDrawObjects instead.

No there is no reason. I’ve changed it to PostDrawObjects but its still doing the same.

How can I lighten the PostDrawnObject with light from beneath?
If I flip the brep and then PostDraw it the top side will be black…

@jeff is this something you can help with?

It’s hard to tell from the pictures, but it looks to me like the “Normal” object is a closed solid polysurface, and the conduit drawn object(s) are single surfaces.

If that’s true, then that’s a pretty big distinction because it would mean that the reason you’re seeing a difference is because of the face Normals. The conduit drawn objects have their normals pointing away from the camera in the Bottom view, thus, the shading is black… Whereas, the polysurface will always have normals point outwards.

A simple test would be to just flip the normals on your Brep and see if they shade correctly. If they do, then my guess is that either the back face material isn’t getting setup correctly OR there’s a bug in DrawShadedBrep where the front and back face drawing isn’t getting handled properly. I haven’t looked yet, but my gut is telling me that DrawShadedBrep is probably not pushing and popping the Cull Face property for non-solid surfaces, which means single surfaces are probably being treated as solids (i.e. they have no back face materials).

I’m not sure if the cull face methods have been implemented for C#, but if they are you can try something like:

If MyBrep.IsNotASolid // <== something you’ll need to figure out
e.Display.PushCullFaceMode( CFM_DRAW_FRONT_AND_BACK ) // <== Not sure what the interface is here
End If


If MyBrep.IsNotASolid
End If

Let me know if this helps… @Dale will probably be able to tell how the cull face methods are implemented (if they are)…

Can I please get a simple C# project to work with so that I can easily just test the SDK’s DrawShadedBrep using your conduit technique. I can probably fix this in the SDK (assuming this is the problem), but obviously that means you’ll need to wait until the next release…which is why I’m hoping the workaround above actually works.


Well it are all single face breps. It are not solids.
I am not behind a computer where I can edit the plugin atm. I’ll check tomorrow.

If I flip the surface then the black side will be changed to the other side. Like if the light is on top and de dark on bottom then when flipped top will be dark en bottom wil be lighted.

So I think DrawShadedBrep is only designed for Solids?
But I’ll let you know if PushCullFaceMode will work.


Thank you!


was the solution! Works now like a charm.