DisplayPipeline.Draw* elements suddenly casting shadows in R8.18+

As of Rhino 8.18 or perhaps earlier, display elements created using DisplayPipeline.Draw*() are casting shadows in rendered display modes (where *=YouNameIt… MeshShaded, Curve, Points, Polyline, etc.).

Is this a bug? If not, please let us know how to disable the behavior.

Hi @sarg,

Not sure as to “why” that is different post 8.18 but give this a try:

https://developer.rhino3d.com/api/rhinocommon/rhino.display.displaypipelineattributes/shadowson

Rhino.Display.DisplayPipelineAttributes.ShadowsOn = False

Make sure that goes “before” whatever you are drawing to disable shadows.

Thanks @michaelvollrath. Unfortunately that doesn’t quite work. Here’s what I tried:

// 1: myObjects still cast shadows
protected override void PostDrawObjects(DrawEventArgs e)
{
    e.Display.DisplayPipelineAttributes.ShadowsOn = false;
    e.Display.Draw*(myObjects);
    e.Display.DisplayPipelineAttributes.ShadowsOn = true;
}
// 2: nothing casts shadows, including actual RhinoDoc objects
protected override void PostDrawObjects(DrawEventArgs e)
{
    e.Display.DisplayPipelineAttributes.ShadowsOn = false;
    e.Display.Draw*(myObjects);
}
// 3: nothing casts shadows, including actual RhinoDoc objects
protected override void PreDrawObjects(DrawEventArgs e)
{
    e.Display.DisplayPipelineAttributes.ShadowsOn = false;
    e.Display.Draw*(myObjects);
    e.Display.DisplayPipelineAttributes.ShadowsOn = true;
}

I also tried each of the above using CastShadows instead of ShadowsOn, with the same results.

If anyone knows of a different sequence that works, I’m all ears. Either way, I’d imagine many 3rd-party plug-ins use RhinoCommon’s Pre/PostDrawObjects overrides – and until now, these routines have never participated in shadow casting. Ideally that default behavior would be restored…