Use the ShapeDiver Display component to assign materials defined with the Preset Material or ShapeDiver Material components to geometry. The component takes two inputs: the geometry to display, and the material definition that is returned by one of the two material components mentioned above.

Applying several materials with a single component

If you want to apply different materials to different pieces of geometry, you don't need to create a ShapeDiver Display component for each geometry, instead, you can input a data tree in the Geometry input and a list of materials in the Material input. Unlike the traditional way of matching tree branches, we match each branch with an item in the materials list.

The reason why we don't use data trees in both inputs is because you can apply one material to various geometries but you can not apply various materials to one geometry.

If you need more flexibility (i.e using a different material for each piece of geometry in a large array of elements), consider using the glTF 2.0 Display component instead and define materials using the attribute system.

Preview in Grasshopper
Grasshopper will not always render accurately all the parameters from the material components. In particular, only the color texture will be part of the preview, other textures will not be previewed in Rhino. If you are using the Preset Material component, many presets use textures and specific online shaders which will not be reflected either.

Attaching transformations

If the same geometry element is reused multiple times in the final display, it is more efficient to store the element only once and attach transformations to the element. That way the Viewer only needs to receive the element once and read the attached transformations to display the other instances of the same object. Attach transformations using the Attach Transformations component before sending geometry to the display component and the viewport will preview all instances of the object. Read more about attaching transformations here.

This component supports transformations only for meshes. In case you want to use transformations for surface-like objects, mesh them in Grasshopper and attach the transformations to the mesh.

Transformations for curves or points are in general not supported by this component.

Details about the generated glTF 1.0 assets

The ShapeDiver Display component outputs glTF 1.0 assets including a non-standard extension specific to ShapeDiver. A separate glTF 1.0 asset is created for each branch of the data tree fed into the Geometry input. The glTF assets are made available on the Geometry Backend API for download by the Viewer. Information about the materials is not embedded into the glTF assets, but made available as a separate Material output on the Geometry Backend API. The viewer applies the materials to the geometry loaded from the glTF assets.

This happens in strong contrast to the glTF 2.0 Display component, which creates a single of glTF 2.0 asset embedding all the materials. This section explains the pros and cons.

These are the processing steps applied by the ShapeDiver Display component when generating the glTF 1.0 assets (one asset for each branch of the data tree):

Step

Description

Discretize

Meshes are used as is.

Surface-like objects are discretized to meshes except for primitive types (see below).
Curve-like objects are discretized to polylines except for primitive types (see below).
Individual points are supported.
Point clouds are supported as individual points.

We recommend to take care of the discretization as part of your model, i.e. convert the geometric objects to meshes or polylines yourself. This allows you to minimize the number of vertices, and take full control of the resulting meshes and polylines.

This component supports transformations only for meshes. In case you want to use transformations for surface-like objects, mesh them in Grasshopper and attach the transformations to the mesh.

Transformations for curves or points are not supported by this component.

This component uses a non-standard extension to glTF 1.0 for transferring polylines, points, and certain primitive types of curves and surfaces (arc, circle, line, rectangle, box, sphere, cylinder, nurbs curve, nurbs surface). Support for this extension will be dropped in the next version of this component, which will use glTF 2.0 assets and discretize all geometric objects.

Group

Meshes are grouped by the transformations attached to them.

Split, Reduce

Meshes which exceed the maximum vertex count of 65535 vertices are split into disjoint components if possible. In case this is not possible, a mesh reduction algorithm is used. This happens due to a limitation of WebGL on most graphics cards.

Join

Within each group, meshes are joined into bigger ones as long as the limit of 65535 vertices is not attained. This allows to minimize the amount of data to be transferred.

Create nodes

A flat list of nodes is created from the groups.

Create asset

A glTF 1.0 asset is created from the nodes resulting from the previous step.

Note that the “up” direction defined by glTF is +Y. However this component does not apply a transformation that rotates the +Z direction to the +Y direction. When loading the resulting glTF 1.0 in a viewer other than the ShapeDiver viewer, the objects would appear rotated.