DisplayConduit Mesh Corruption

Hello All,

I’ve actually never had any issues with the DisplayConduit before, but in a new application it’s somehow corrupting the mesh. It seems that the mesh normals are quite arbitrarily flipped - using either a regular Grasshopper output or baked geometry everything looks fine - no problems with the normals at all.
The mesh is stored as a serialized string in the Resources, transformed, and then displayed via the DisplayConduit.

The only possible issue that I see is that the mesh definition is updated from another thread, i.e. there could (maybe) be collisions between the threads. However, there is no flickering when the mesh-robot is moving - the mesh is always staying the same, it’s just moving around.

Any ideas anyone? The DisplayConduit code is pretty standard and switching the draworder from Pre to Post and the other way round didn’t change anything - and the problem happens with many different meshes, so it’s most likely not related to the mesh definition itself.

A screenshot is attached below!
Best,
Johannes

Hi Johannes,

Not nearly enough information here for us to be helpful. Is there source we can review? How can we repeat this?

More information (of any kind) would be helpful…

– Dale

We got a private email from @carlosperez about this. @jeff thinks it may be fixed in SR11 and @johannes is checking

Hello Dale, hello Steve,

Thanks for the quick replies - I’ll try to make some kind of test component tomorrow, hopefully we can replicate it. The current code is under an NDA with a robot company so I cannot share it.

As Steve mentioned there is now a parallel eMail discussion, I’ll try to keep everyone updated (tomorrow, have to move on to other things now!)

Good night,
Johannes

Hello All,

As discussed, I’ve just sent you all an eMail with a “working” example and its full source code!
Quickly summed up, the problem happened with both Intel graphics (HD4400 on a Surface 2 Pro) as well as on NVidia (GTX970) and unfortunately was not fixed by the SR11.

Thanks for looking into it!
Best,
Johannes

Hello All,

In case it helps somebody else here is the solution to the problem: Following Jeff’s advice I updated to a recent build of SR11 and changed to PostDrawObjects() for the DisplayConduit. The working code is more or less like that…

class CustomConduit : Rhino.Display.DisplayConduit
    {
        Rhino.Display.DisplayMaterial mat = new Rhino.Display.DisplayMaterial(System.Drawing.Color.LightGray);

        protected override void PostDrawObjects(Rhino.Display.DrawEventArgs e)
        {
            if (TestGlobal.IOMesh != null)
            {
                e.Display.DrawMeshShaded(TestGlobal.IOMesh, mat);
            }
        }

        protected override void CalculateBoundingBox(CalculateBoundingBoxEventArgs e)
        {
            base.CalculateBoundingBox(e);

            if (TestGlobal.IOMesh != null)
            {
                BoundingBox bbox = TestGlobal.IOMesh.GetBoundingBox(false);
                e.IncludeBoundingBox(bbox);
            }

        }

    }

Thank you all for the support!
Best,
Johannes