PIPELINE TECHNIQUES: Create easy Fabric Shaders with V-ray
Olga Rudi gives us essential cloth shader techniques
creating believable cloth shaders can be tricky, time-consuming and just straight up confusing. in many production environments, each texture is individually crafted by skilled artists using high-resolution photographs as reference. in this tutorial, we will go through the process of creating believable cloth shaders using V-ray, Thunderloom, and Maya. Thunderloom is a free plugin for V-ray created in collaboration with the cg department at ikea, which is responsible for a significant portion of the images in the ikea catalogue. it is used to produce woven fabric, and it gives the ultimate flexibility over controlling each parameter of the fabric such as yarn size, bend, twist and more without the need of bringing the external maps in. This is a step-by-step tutorial where i will show you my way of making a soft cotton fabric, but all techniques can be further implemented to create almost any other type of woven fabric.
Know your fabric The two main ways fabrics are made by weaving or knitting. As a rule of thumb, if the material is soft, then it is most likely to be knit. Typical examples of knit fabric include T-shirts, socks and so on. Knit patterns can vary dramatically in size, and while the knit pattern on a sweater is easy to see, some knit patterns can be minimal. here is the close-up example of a knit hoodie (right, pink) and twill jacket (left, white). Plain weave examples are satin, twill (jeans, overalls), linen. You will need to know exactly what type of fabric you want to make in order to reproduce it properly.
Prepare the scene As with every texturing process, your model needs to be unwrapped and lit. Also, don’t forget to install and turn the Thuderloom plugin on. You can get the plugin on Github.
To start creating the actual fabric we will need a Weave information File (WIF). You can either create it yourself or buy it, but i suggest downloading a free pack on ‘Light collab forum’ under the Thunderloom section. in that pack, you will find two folders conveniently broken down into knit and weave WIF files. Once you have that, open up hypershade and create a Thunderloom material.
The first parameter you will see is a pattern and browse file. That is where we put our WIF file. click browse and navigate to a folder where you can choose your PTN file. For this example, select Knit A 1s1p 10x10.
Understand the settings There are seven different setting you can tweak: diffuse colour,
bend, yarn size, twist, specular strength, specular noise and highlight width. We will be using Thunderloom as a specular shader when combined with V-ray, so bring the saturation on each Diffuse section all the way down and bump specular strength all the way up. Bend controls the curvature of each thread segment between its ends, making a value of 0.5 a perfect torus loop. This is useful for satin fabrics, where decreasing this value results in a ‘flatter’ outcome. Yarn size controls the radius of the thread. The value of 1 will result in no gaps between thread segments, therefore it is usually a good idea to keep it at 0.8. Twist controls how much the threads are twisted around each other, and essentially acts as a roughness parameter. specular noise controls the amount of noise added to highlights. highlight Width controls the width of the specular reflection on the thread. The common sense between most of these settings is: the bigger number, the softer result. here you can see the difference between lower twist value 0.3 and higher twist value 0.8
Make it work for you now that we understand what each setting does, it’s time to set up the actual shader. First you need to adjust is size. i usually change this to 60 to 100 depending on how much detail i want to show in my scene. To make a soft fabric, we need to bump twist and highlight width up. These are my settings: scale at 75, Bend at 0.5, Yarn size at 0.8, Twist at 0.8, specular strength at 1.0, specular noise at 0.7 and highlight Width at 0.8. i usually keep settings consistent on yarn types (except for diffuse), but you can vary them slightly. To give you an example of what each setting does, for the satin fabric i changed Pattern to satina-5h, Bend to 0.3, Twist to 0.15, specular noise to 0.1 and highlight Width to 0.2.
V-ray shader setup Once we are done with Thunderloom, it is time to set up our base V-ray shader. create a simple V-ray Mtl node. Leave a diffuse colour for now but bring the amount down by 0.8. Make roughness a higher value; usually, 0.5 value works good for fabric but for our shader, bring it up to 0.7. This will give us a nice and smooth base to start off with. in the reflection section, change Brdf type to Blinn. Leave out reflection and refraction, as you remember we are using our Thunderloom shader for that. change Fresnel IOR to 1.33 and Anisotropy to 0.25. name this shader ‘V-ray Base’.
Add sheen now that we’ve set up out V-ray shader, we need to make it look like fabric. To do that we are going to put a falloff node in the diffuse section. create a falloff node and middle-mouse drag it into V-ray diffuse section. There are three parameters we need to change in the falloff: front and side colour, and falloff type. choose your desired fabric colour for the front colour.
To add that fabric feel make the side colour a little bit lighter than the front one.
The lighter you make it, the softer it will feel. Finally, the most important setting is to change the falloff type to perpendicular/parallel.
Don’t forget to make test renders!
Combine shaders For our final step, we will need to combine our V-ray Material with Thunderloom. To do that we will need to create a blend node (blend Mtl). Drag V-ray shader in the base material section with the middle-mouse button. Put Thunderloom material as a cover. We will also need to turn Additive mode on.
What it does is blend two materials together equally. if you decide to turn the blend node off, it will put one material (coat) on top of the other (base). You might also want to change the colour of the blend.
The default setting is grey, but you can change it to the chosen colour of your fabric to make it more vibrant. name this shader Fabric Blend.
Add stitches To add stitches, you need to create a mask in Photoshop first. The best way to do it is with a pen tool. Draw a path and fill it with the dotted line stroke. save it as a black-and-white image and apply as a bump in you V-ray base material with a reduced multiplier (0.3 in my case). create a new Thunderloom material and select stitch Fibers as a Pattern. As with the previous examples, reduce saturation and make specular strength 1. create a new blend node. Put V-ray Base material as a base and new Thunderloom stitch material as a coat with additive on, name it ‘stitch Blend’. create another, final blend material. Put Fabric Blend as a base and stitch Blend as a coat, this time with additive off. in the blend amount, put the mask you created for stitches.