<< 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 uploading their 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.
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 thought and adding some interesting scenery to transform something as "regular" as a sofa into something a bit more visually appealing.
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.
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.
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:
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 effect that 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.
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:
As you can see, the first surface created with the "BoundarySurface" component has texture coordinates 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.
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 improve the 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 list with 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.
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.
1. "ShapeDiverSimpleMaterial" is 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:
The following material codes can be input in the text fields above:
- Plastic: type code 0200
- Metal: type any of the following codes 0300, 0301 or 0303
- Gold: type any of the following codes 0310 or 0311
- Glass: type code 0400
- Wood: type any of the following codes 0500, 0501, 0510 or 0511
- Leather: type any of the following codes 0600, 0601, 0602 or 0603
- Fabric: type any of the following codes 0700 or 0701
You'll need to take into account that you won't be able to visualize these textures in the Rhino viewer. They'll only be visible via our viewer once you upload your definition to ShapeDiver.com.
Additionally, if you want to play with the preset textures, the color that you set in the "SimpleMaterial" component will multiply the texture. What this means is that the color will blend with the given material letting you obtain different effects like in this configurator.
2. "ShapeDiverMaterial" is the component you'll need if you want to create materials from scratch. This component has different input parameters:
a. Color: It also multiplies the texture image as "ShapeDiverSimpleMaterial" does.
b. Texture Map: It contains a URL image with the base colors of the material.
c. Metalness Map: It defines how much the material appears like metal. It accepts values from 0 (no metal) to 1 (very metal \m/). It also accepts a URL grayscale image where the lighter the grey is, the more metallic the material looks like.
d. Roughness Map: It defines how rough the material appears. It accepts values from 0 (smooth) to 1 (rough). It also accepts a URL grayscale image where the lighter the grey, the rougher the material looks like.
e. Bump Map: It defines the depth that is perceived in relation to the light. It accepts a URL grayscale where the darker the grey is, the deeper the material looks like.
f. Normal Map: It is similar to the bump map but creates a better effect as it affects the surface normals of pixel fragments by using the values of an RGB image stored in a URL.
g. Opacity: It indicates how transparent a material is. It accepts values from 0 (fully transparent) to 1 (fully opaque). It also accepts a URL grayscale image, called Alpha Map, where the lighter the grey is, the more opaque the material looks.
The majority of these parameters accept URL links which contain the image map with the desired effect. However...
The best websites I can recommend are textures.com, poliigon.com and texturehaven.com. Additionally, if you already have a texture image ready to use, you can create its normal map at: http://cpetry.github.io/NormalMap-Online/.
However, you can just do a simple Google search with the name of the material you're looking for, the kind of image map/effect you need and finally you need to make sure your image is seamless.
When a texture is applied to a 3D model, it needs to repeat itself throughout the entire geometry so that it gets completely covered. If the images you are using are not seamless, it will be very clear where each image connects with the next one, meaning it won't look natural. This brings down the realism of your model. Just compare these two examples below:
If you find the image you need but it is not seamless, you can make it seamless by using different tools such as Photoshop. Just make a simple YouTube search and you'll find lots of tutorials for this topic.
Other than getting a seamless texture, it is important to have an optimized one. The easiest and fastest way to optimize your textures is at www.imagecompressor.com. Here you can upload any image and play with the image quality. Remember, if your material is applied to a piece of your definition which is too small or barely seen, the quality of the image doesn't need to be the best. We're almost done here...
All the URLs you use in ShapeDiver components have to be publicly accessible, otherwise our viewer won't be able to read the files.
If you don't have your own servers where you can store your data and then grant public access, my best recommendation is to upload your images to https://imgur.com/upload and then get the link by right clicking the uploaded image and copying the image address.
Now that we have the links, we can add them to "ShapeDiverMaterial" and get cool effects like this one:
*This material was achieved with the image maps/effects here.
Going the extra mile while setting up your models is a great way to ensure long-lasting first impressions. Internet users want to be charmed, "convinced through their eyes" if you will. With so much online competition nowadays and the fact that we live in the age of immediate gratification, it takes a bit more dedication to wow your audience. Great Texture Mapping is just one of the many ways in which you can separate your products from the bunch.
<< Was this tutorial helpful? Do you have any comments or feedback? Make sure to visit our Forum and start a thread with your doubts! We're always checking for new topics from our users so we'll make sure to give you useful answers.>>