How to draw points in a display conduit with depth testing (not overlay)?

Hi everyone,
I’m drawing custom points inside a Rhino display conduit, but they always appear in front of the model regardless of their actual 3D position.

My current code runs inside the SC_DRAWOVERLAY channel:

bool CCustomDisplayConduit::ExecConduit(CRhinoDisplayPipeline& dp, UINT channel, bool& terminate)
{
    if (channel == CSupportChannels::SC_DRAWOVERLAY)
    {
        for (const auto& kv : m_points_map)
        {
            for (const auto& pt : kv.second)
            {
                dp.DrawPoint(pt.point, pt.size, pt.point_shape, pt.color);
            }
        }
    }
}

The issue is that the points are drawn in the order I call DrawPoint(), but they ignore the depth buffer (i.e., they don’t get occluded by surfaces or objects that should be in front of them).

Is there a way to draw points with depth testing enabled, so they behave like normal 3D geometry?
Should I be drawing them in a different display channel, or is there a flag/state I need to enable in the pipeline?

Thanks for any guidance!

Use post draw objects instead of draw overlay for depth testing to work
SC_POSTDRAWOBJECTS

1 Like