Custom Preview component stops displaying in many view modes

I have a GH file that uses referenced objects by layer which are then sent to custom preview components, each has its own material retrieved from a material table.

GH stops displaying the items in the Rhino viewport unless I am in shaded mode.
Rendered view no good
My custom view modes no good
Rendering with cycles no good nothing gets drawn.

I guess I’ve reached the limit of what Gh can pass and display though before I changed this file for a simpler model it did work though with hiccups.

Now I have to bake out the custom render previews something I didn’t want to do just to get renderings. When I do this it adds thousands of items to the material table and undoing leaves null items. Luckily if I exit and don’t save the nulls go away when I reopen the Rhino and GH file.

The worse thing about all of this is having to use the materials table which is a complete weirdo. Why not make a component that simply lists materials instead of each and every instance. This file which is easy to do Gh wise without materials becomes a behemoth in wiring once one adds materials to the render preview.

Perhaps I need to cull the Material preview index? Is there a way to make it list one material like the materials tab instead of each instance the material is used on?
Is there a way to run an array instead of having to wire each and every material preview? I guess Material preview is a one shot deal?

Thanks for any tips or hints on getting this to work better.

I would consider rendering this in VRay for Rhino and use its gh instancer. I know you are using Vray in max, but if you do have the newer license (subscription) this allows you to use it in Rhino too.

Otherwise, not sure if this is possible in your project, but what might help is joining all objects that have the same material into one mesh, before loading it into the custom preview component.

Works just fine here (Rhino 7).

A sphere, torus and box are referenced into the GH definition. These geometries are multiplied by GH and as you can see their final geometries are piped into Custom Preview with each group getting its own material. Drawing in both Rendered mode and Raytraced works.

The custom preview is set to both Preview and Render, the latter is required for Rendered and realtime engine viewports to works (like Raytraced)

HI @nathanletwory,
Thanks for taking a look. It works for me up to a point but as you can see dies when I add more geometry. I do have preview and render checked.

I also saw mapping go completely wrong when it did work some of the time. Some objects are mapped with physical materials that have an emissive slot. Notice in the image in shaded mode I can see all the geometry but in rendered only one set shows up. Also, if I try to render from the shaded mode using cycles by hitting the render button no geometry gets parsed to cycles.

But if I bake out the geometry, I can render it and that does show up in all view modes. Perhaps something is amiss with large previews like I’m trying? I really didn’t want to bake out the geo as it’s huge.

I love the look of cycles even though the final destination is Unreal where I’ll reassemble the geometry from parts. These renders are more for testing moods and looks of the geometry before export.
Thanks for your help.

Hi @Gijs,
Unfortunately, I jumped the Autodesk and Vray ship. I’m using Unreal and Blender now. I do really like max and vray with phoenix fire. But it’s a bit sluggish to render results are super nice though using that combo. I like using Unreal for its real time workflow especially fx and cinematics.

I love the look of cycles it kind of looks like Wyeth egg tempera paintings. Thus I’m testing moods and looks in Rhino.

Thats a good idea about adding a pipe to distill it to one mesh per material.
Any better ideas on how to manage the material table?
Thanks for your help and suggestions.

Maybe you’re hitting the memory limits of your graphics card? Is the material duplicated for each instance? Then I wouldn’t be surprised. This is not clear to me from the screenshots. What if you make the textures very small, like 64 x 64px, does that make a difference?

Hi @Gijs,
No, the materials are used on sets of objects. I think I hit the GH limit but not Rhinos. I can bake out the geo and render it if I want. I really think it’s a materials preview issue since it displays in shaded. My guess is that it’s using too much memory bottlenecks and doesn’t pass the render info to cycles or to the rendered view mode. It must be duplicating geo or it’s implemented in a less than robust fashion since I can bake the geo and render, so it’s not my graphics card memory.
Yet another caveat of using Rhino and GH.

Unreal handles this no problem and I even have video on each screen with special FX. Rhino could be nicer for displaying heavy files and GH should be better at handling materials instead of the render preview work around.

It’s hard to say what else without a file. If you can share one that demonstrates this behavior I’d be interested to investigate and also compare it with vrays toolset in gh.

Hi @nathanletwory
I brought all these models into unreal and Unreal handles them no problem I even have animations playing on each monitor. I was able to even copy many more of these elements and Unreal keeps going while playing a whole crowd of animated characters etc. I know Rhino and Unreal are different beasts, but Rhino needs to up its game when it comes to working with lots of geometry. I’m trying many different approaches in Rhino and they all have flaws and bugs, worksessions and blocks has the material duplicate bugs and material names bug that never got fixed as well as there are mapping bugs with blocks and worksessions. Then there is this little bug with the GH preview.

I love using Rhino I know you guys are magicians I hope that working with large files and worksessions and Gh gets attention where it could work without problems for the most part.

Don’t use the Materials table, use RenderMaterials. You can write a simple Python script that iterates over the contents and gives you the names

import scriptcontext
for rm in sc.doc.RenderMaterials:

Or specifically for GH Python:

import Rhino as rc
import scriptcontext as sc

sc.doc = rc.RhinoDoc.ActiveDoc

a = [rm.Name for rm in sc.doc.RenderMaterials]

sc.doc = ghdoc

Attached a GH definition and 3d geom/material file (18.5 KB)
geom_to_reference.3dm (3.5 MB)

Hi @nathanletwory
Awesome can’t wait to try it out when my rendering queue is done.
Thanks for your quick reply and help!