Drawing large amount of mesh objects

Hi
I am working on merging our FEA application to Rhino.
Now it comes that I need to display the model and 2 routes seem to be the way:

  1. Draw the objects without baking them into Rhino
  2. Bake them int Rhino Layers

I am looking at option 1 to avoid baking-deleting objects when these are changed but the display
pipeline becomes quite slow with a large amount of data to display.
So the question is:
Do we have other ways to draw objects ? maybe a opengl display list ?

I see that grasshopper is quite fast in rendering objects so i assume its possible

thanks
gerry

here a image to show a model where the display becomes very slow,
clearly the reason is that objects get drawn at each render pass

gd

How many meshes are being drawn? Is all data cached? We have had similar issues when there was a lot of computation begin done to get the meshes. If you cache everything, the drawing should be come faster. If you’re already caching, there may be other tricks and openGL drawing is one of them.

This is a model built out of a fea model, so there are many meshes (all small pipes)
All computation has been done, I have a list of mesh objects to get displayed and using a pipeline to draw them but the viewport becomes very slow.
I have searched other tools in the Rhino.Display other than the DisplayConduit that I am using, the customDisplay object seemed to do the job but so far there is no AddMesh routine.
So the question is how can I make a OpenGL display list once and keep it alive ?

gd

OpenGL I have no experience with, but take a look at the DisplayPipeline class, it has a lot of useful methods. https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_Display_DisplayPipeline.htm

Maybe if you join all meshes into one big mesh that already helps, i think I remember that.

Not feasible, i need to keep them separate to be able to change color and visibility
but it will not change so much if there is no display buffer.
When we draw objects these are sent in immediate mode to the graphic card, with display list they are compiled and kept in the graphic card memory, so it makes a huge difference in display speed,

At least using OpenGL .

gd

Hi @gerryark,

Of you load a large Rhino model, is the display still responsive?

There isn’t any reason why a custom, plug-in based display conduit, wouldn’t draw as fast what Rhino natively draws.

To provide assistance, we’ll need a code sample of your display conduit. Having a project that we can run here, to experience the slowness, would be a bonus deal.

Thanks,

– Dale

Hi dale
Let me explain what we are doing.
Our rhino plugin is in communication with our fem app. It reads all elements and creates a number of objects (meshes, extrusions etc), these are kept in a custom list (breps are meshed) and displayed in a displaycounduit.

Now if I bake these objects in rhino the difference in display speed is huge compared to the display conduit version, maybe I am doing something wrong, but I just go trough the list and use drawmesh on each object.

Monday will send you the code, to see what’s going on in real-time you should install our fem app since nothing is baked in the rhino database.
No problem if you want to test it.

Hi Dale
The code as You may see is quite simple. If I turn on shaded meshes the display rate gets slow.
All this compared to the same model baked in Rhino

protected void DrawObjects(DrawEventArgs e, GroupData grp)
{
foreach (Rhino.Geometry.Curve c in grp.lingeom)
e.Display.DrawCurve(c, grp.mColor);

        foreach (Rhino.Geometry.Mesh m in grp.linMesh)
            e.Display.DrawMeshWires(m, grp.mColor);
    }

    protected void DrawLayerItem(LayerItem it, DrawEventArgs e)
    {
        foreach (GroupData grp in it.mGroupItems)
        {
            DrawObjects(e, grp);
        }

        foreach (KeyValuePair<Guid, LayerItem> ch in it.mChilds )
        {
            DrawLayerItem(  ch.Value , e );
        }
    }


    protected override void PostDrawObjects(DrawEventArgs e)
    {
        foreach (LayerItem it in AracnidPlugIn.Instance.FeaModel.mLayers)
        {
            DrawLayerItem(it, e);
        }
    }