renderMaterial not part of my Speckle objects when receiving back in Grasshopper

Objective: I want to be able to receive geometry with its renderMaterial in Grasshopper

Issue: When I receive a stream with a renderMaterial I would expect it to show up when I Deconstruct Speckle Object (DSO):


Grasshopper script: renderMaterial.gh (14.9 KB)
Speckle stream: Speckle

Related post: RenderMaterials from Grasshopper don't appear on streams

Hey @JoostGevaert!

I know whats going on here :raised_hands:t3:

When receiving data in Grasshopper, we automatically convert it to Rhino objects. This is what the vast majority of users expects, but it has some caveats.

I’ll follow this using a Speckle Mesh and Rhino Mesh as an example, but this applies to all geometry really, and any convertible object in general.

The main one being that in Grasshopper, there is no way to attach a render material to a mesh (or any other type of data), so when we convert a Speckle Mesh to a Grasshopper Mesh, anything that is not strictly the mesh information get’s lost.

On the other hand, when you plug in an object to “Deconstruct Speckle Object”, it will be converted to Speckle if possible, even if the input was a Grasshopper Mesh (notice there’s an info bubble on the deconstruct node’s top-right corner)

So basically:

  • Your receiver gets a speckle mesh and converts it to a Grasshopper mesh
  • Once you’ve got the grasshopper mesh, it no longer contains the extra info that the Speckle one did
  • Your DSO is converting the Grasshopper mesh back to Speckle in order to deconstruct it

So as you can see, you’re performing 2 conversions just to expand that object, which is non-ideal because of the lossy-ness of the conversion and for performance reasons.

Solution

Best way to solve this is to just disable conversions on the receive node, in which case the output will be a Speckle Mesh, which, since it hasn’t gone through any conversions still contains the entirety of data you sent.

You can do this in the right-click menu of the receive component (and any other component that performs conversions)

When you need the actual Rhino mesh, you can use the ToNative component to convert that speckle object into a Rhino/Grasshopper compatible one (You may need to activate the Dev components in the Speckle 2 → Tabs menu)

Hope this helps!

Ah, oke. Thanks for the clear, extensive explanation, this is great! Thank you!

1 Like