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.
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?
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)
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:
@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?