Slow render of Monochrome Mesh

Hey! :slight_smile:

There is something weird going on once I color mesh using CreateMonochromeMesh.
For some reason it slows down the whole Viewport (in any mode) when I want to move inside a model, zoom in etc. Before coloring it this way everything is fine. What is the reason behind it? It’s also good to point out that using Custom Preview component instead doesn’t make such slowdown.

There is the isolated example attached. To turn on coloring just enable last component. You can increase the number of meshes to 10000 to see the difference more clearly before and after enabling. Personally in my case for 3000 of meshes it’s already so slow when I compare it to the display of meshes before coloring. Tested on 2 different computers with @Konrad_Zaremba.

SlowMonochromeMeshRender.gh (19.0 KB)

Hi @w.radaczynski,

The meshes drawing in the Custom Preview display conduit are cached and, thus, draw quite quickly.

The meshes in your Python script are just colorized and returned. These meshes are not cached. Thus the drawing speed is dependent on your system.

– Dale

1 Like

Hey @dale,

So do I understand correctly, that for some reason once I colorize these meshes this way, they are no longer cached? I’m asking because if I just return / create / pass further these meshes it seems that the Viewport rendering will be still fast. In other words: just by colorizing meshes using Monochrome Meshes they turn from being cached to not cached?

Hi @w.radaczynski,

Sorry, I don’t know enough about how GH draws or how a custom C# effects this.

– Dale

1 Like

Ok, thank you, no problem :wink:

@stevebaer - any chance you have some insights? :slight_smile:

Generally I’m looking for fast methods to draw hundreds of thousands of colored and bakeable meshes in the Viewport without making it freeze.

I never got around to caching meshes with vertex colors in the same way we cache normal shaded meshes which is why you are seeing such a massive slowdown. The fix for this looks easy, but I’m a bit hesitant to throw this into Rhino 7 this late in the service release cycle as caching is never really as easy as it looks.

Here’s an alternate way to draw these false color meshes quickly. They will include lighting in the draw, but maybe that is good side effect.
SlowMonochromeMeshRender.gh (29.7 KB)

3 Likes

Perfect, thank you! :wink:

If you follow these GhPython performance tips, things appear to compute quite a bit faster (i.e. it’s not just the rendering that’s expensive, but the implicit looping plus use of type hints). Also, if you join all the meshes into one that can make the viewport performance drastically faster:


240822_SlowMonochormeMeshRender_00.gh (17.2 KB)

Edit: Just replying here to your post over here :wink:

2 Likes

Something like this might also work for you (i.e. using SDK mode drawing methods):


240822_SlowMonochormeMeshRender_01.gh (18.5 KB)

2 Likes

@stevebaer I know there are some workarounds, however just wanted to know: was caching mehes with vertex colors implemented in V8? If not then maybe there is a chance to do it in V9?