With the glTF 2.0 Material and ShapeDiver Material components, the ShapeDiver plugin makes it possible to create PBR materials including various textures for rendering in the online viewer. You can read more about those textures and how to set them up in the respective articles of these components.
In order to correctly set up textures, one needs to properly define texture coordinates over the mesh. We distinguish two different cases below and list the best approach to work with textures for each case.
Pre-existing texture coordinates
In some cases, meshes manipulated in Grasshopper already contains texture coordinates. That can be the case if they were imported from a Rhino document or one of the CAD files supported by the Import Geometry component. Alternatively, some Grasshopper components create meshes including texture coordinates (most of the components that generate simple primitive shapes like spheres, boxes, etc…).
In this case, one might still want to transform these coordinates (scale them, rotate them, add noise or just use them for other purposes). That’s when the components of the Textures category of the ShapeDiver plugin become useful. Find more information about each of these components in the respective articles below.
No texture coordinates
If no texture coordinates are included in the meshes, they have to be created from scratch. Unfortunately, Grasshopper does not come with tools that would assist in assigning texture coordinates to each vertex of an existing mesh, nor does the Construct Mesh component allow to define those coordinates when building a mesh from scratch. Fortunately, the Human plugin (supported on ShapeDiver) comes with a set of texturing tools that comes in handy. The components of the Texture Mapping category allow to manually define a custom coordinate for each vertex of a mesh (Custom Mapping component) or to use predetermined mappings for simple primitives (box, spherical, cylindrical, planar mappings…). Each of those components outputs a mesh where texture coordinates are stored in each vertex. Subsequently, those coordinates can be transformed and adapted using the ShapeDiver components mentioned in the previous section for fine tuning.