Hi, my name is Edwin. I'm a Grasshopper expert at ShapeDiver and in this blog post I will show you how to improve the rendering of your Grasshopper definitions by properly mapping textures on your geometry and then applying some great looking materials. Let's get going!
One of the most common issues I've seen Grasshopper users encounter when uploadingtheir definitions to ShapeDiver.com is "poor" rendering of their models. Great online rendering depends on several factors and two of the main ones are:
1. The online viewer used to display the 3D files (we've been doing some great improvements on ours since we first launched our website back in 2016 and we'll talk about this in a future post).
2. A proper setup of the 3D file itself.
The main problem is that, on average, Grasshopper users are really good at solving geometry problems, investing lots of time into making definitions run as efficiently as possible, but when it comes to how the models actually look... well, let's say that this part also deserves some attention. This is understandable, given that Grasshopper itself hasn't been used all that much as a presentation tool, but with ShapeDiver.com we're trying to change this.
First Impressions Last
Let's start with the way we present our models online. Compare these two sofa setups:
Technically both are the same sofa. You can change exactly the same parameters on both, but... which one was more pleasant to look at and interact with? And most importantly: which one felt better?
In this case it depends not only on having great textures but on putting some extra thoughtand adding some interesting scenery to transform something as "regular" as a sofa into something a bit more visually appealing.
Why Is It Important To Make Your Models Look Good?
Let's jump now onto our main topic. When uploading your Grasshopper definitions to ShapeDiver.com, potentially anyone around the world will be able to check them out (if you set the model to public, that is) and to be able to catch your users attention, first impressions should be made to last. After all, there's only so much you can do through a device's screen, so you better use all the tools at your disposal.
Additionally, if you're planning on using your ShapeDiver model commercially, a good setup will make the experience that more pleasant for your end users.
What is Texture Mapping?
Let's start by defining what "Texture Mapping" is. If you've played before with 3D modeling(or modelling depending where you're reading us from) and animation software such as Blender, Maya, 3Ds Max or others, these concepts may already be clear to you, but let's assume they're not.
Texture Mapping is the application of coordinates to your 3D geometry by using different patterns in order to enhance the realism of the object. These patterns can be planar, cubic, cylindrical, spherical or completely random, you're even free to create your own custom patterns.
How Can Texture Mapping Be Achieved in Grasshopper?
There are two main ways we recommend to achieve this:
1. By using the ShapeDiver component "ShapeDiverTextureTransform" found in our plugin (if you haven't downloaded it from our Food4Rhino page, we recommend you to do so!).
2. By using the popular Grasshopper plugin Human for which on ShapeDiver we currently only support the texture mapping components marked in the image below:
*Texture Mapping with the Human plugin.
Let's start with our "ShapeDiverTextureTransform" component. As its name specifies, it was created to transform the texture mapping of a geometry. It will work wonderfully if the geometry has a pattern applied to it. This will be the case if you have used certain Grasshopper components to create them, which contain the native texture mapping effectthat you want to achieve.
However, if you've played too much with your definition, you could've destroyed the native texture mapping without even noticing it, for which case you'll need to reconstruct your pattern by using the mentioned Human plugin.
How Can You Know If Your Geometry Has A Correct Texture Pattern?
The easiest way to figure this out is by connecting the element you need to render into the "ShapeDiverDisplayGeometry" component and give it a texture using the "ShapeDiverMaterial" component.
If you don't know how to add a texture image yet (something that we will show you further down in this post), simply copy/paste this link: https://i.imgur.com/V0uyKnM.png which contains a texture checker and connect it to the "Texture" input. At the end you should be getting something like this:
*Texture applied to a surface created with the "BoundarySurface" component.
*Texture applied to a surface created with the "Loft" component.
As you can see, the first surface created with the "BoundarySurface" component has texturecoordinates based on a plane that covers the boundary box of the geometry, whereas the second surface that was created with the "Loft" component has texture coordinates that follow the shape of the given element. Other components that create texture coordinates similar to what was achieved with "Loft" are the "Sweep" and "RuledSurface" components.
Tip: Primitive objects also have their own texture coordinates.
Interestingly, the only primitive object that doesn't have a well set texture map is the box. However, this can be solved by converting it into a mesh using the "MeshBox" component. In any case, it is recommended to always convert the final geometry into meshes to improvethe performance of your definition (but we'll talk about this specific topic in another blog post). Converting to a mesh will preserve the texture coordinates of the primitive.
Finally, after you have made sure that your geometry has a good pattern, you can start playing with it by using transformations. The majority of these transformation can be found in the outputs of components which are located in the "Transform" tab inside "Affine", "Array" and "Euclidean".
The simplest and most used transformations for Texture Mapping are "Move", "Rotate" and "Scale" and they can be combined by using the "Compound" component. Just create a listwith those transformations in the order you'd like them to be executed and connect the "Compound" component into the "Transform" input located in "ShapeDiverTextureTransform" as shown in the next image:
If done correctly, you'll be able to achieve something like this:
Additionally, "ShapeDiverTextureTransform" offers the possibility to randomize the texture in the X and Y axes if you don't want a symmetrical result.
What If The Geometry Doesn't Already Have The Texture Pattern I Want?
Don't worry! It's time to explore the second option: let's check how to create one from scratch using the Human plugin.
Let's say we have an asymmetrical shape that was created with the "Loft" component, which means it has a texture map that follows the shape of the geometry as we explained before, but we want the pattern to be symmetrical and aligned with the XY plane.
To do so, we need to use the "PlanarMapping" component available in Human. This component will reconstruct the texture coordinates of our geometry based on a plane and given domains in the X and Y axes.
*Before and After Planar Mapping
Just like in the previous example, you can use other primitive shapes to project textures on your geometry and achieve different effects.
Now that we have our geometry with the texture coordinates that we want, what is the next step? Well, the next step is to find (or create) the right materials for your model!
ShapeDiver has two components used to apply materials:
"ShapeDiverSimpleMaterial" and "ShapeDiverMaterial". Let's start with the former.
Ideal when you just want to add a color or when you want to use one of our preset texture codes. These codes already contain all settings necessary in order to display great materials via our viewer: