Cloth uber shader

by Samsonov Shop in Materials, Shaders, Textures

I. Workflow:

1. Add materials into your scene:

To do this open blender and go File -> Append. Find .blender file from the downloaded archive. If you don't want to create any new materials and just use presets choose Materials in the list of .blend data and select needed materials. Than just aply the material to the object you want. If you want to create your own shader you should append _fabric_ALL_SETTINGS material from the .blend.

2. Modular concept explanation:

This uber-sher is made in modular fashion so that you can easily plug or unplug modules you need. Complete shader set-up can be found in _fabric_ALL_SETTINGS material. Node groups and nodes which are green can be muted by pressing M or deleted completely by Ctrl+X. In that case they are not computed and thus don't eat render time. So if you don't need some of them just do that.

3. Generating textures:

To change materials you change inputs of different node groups. Main settings are of TEXTURE node group. Here's explanation of its inputs:


  • Texture coordinates - self-explanatory input
  • Weft/Warp repeats - general scale of the texutes in X (warp) and Y (weft) axises


left: 4x4, right: 6x10

  • Weft/Warp fibers - amount of fibers in thread (depends on weaving pattern which is writen in the name of the group: set either exact or multiple values(e.g. STRAP (1 X 2) means that weft fibers should be set to 1, 2, 3, ... and warp fibers to 2, 4, 6, ...)


left: 4x4, right: 8x12

  • Warp/Weft - if set to -1 generates only warp threads, 1 - only weft threads, 0 - both


left: -1, right: 1

  • Front/Back - if set to 1 changes wefts and warps (set only to 0 or 1)


left: 0, right: 1

  • Axial AO  - adds darkenning along threads


left: 0, right: 1

  • Cross AO - adds darkenning across threads


left: 0, right: 1

  • Threads axial bump - adds bump along threads
  • Threads cross bump - adds bump across threads
  • Uniform bump  - adds unfirom bumps across the surface
  • Uniform bump scale - controls the scale of uniform bump


  • Color - base color
  • Hue (or Saturation, or Value) variations - adds irregularity in base color's hue, saturation or value
  • Variations scale - controls the scale of irregularity


left: 0, right: 0.5 (all H, S and V)

  • Reflection - amount of reflection
  • Roughness - defines how rough the fabric is
  • Anisotropy - stretches reflections (along threads if positive, across threads if negative)
  • Stripes color - color of stripes
  • Stripes amount - adds stripes along threads
  • Stripes scale - controls density and thickness of stripes


left: 0, right: 1

  • Thickness - thickness of threads


left: 1, right: 0.5 (both weft and warp)

  • Thickness variations - adds irregularity in thickness
  • Thickness variations scale - controls the scale of irregularity


left: 0, right: 1

  • Profile - adds twisted look to threads profile
  • Profile scale - controls twist scale


left: 0, right: 1


  • Amount - fabric age
  • Scale - contrlos general scale of the effect
  • Distortion - adds distortions of torn threads
  • Color fading - adds desaturation
  • Uniform filament - fills mask with procedural texture (better to always set to 1)
  • Weft/Warp tear - controls how much threads are torn
  • Weft/Warp thinnhing - controls how much threads are thinned


left: none, right: amount = 1, scale = 4, distortion, color fading, procedural filament = 1, weft/warp tear = 1/0, weft/warp thinning = 1/0.7

If you go editing the group by pressing Tab you'll se that there are several green node subgroups, meaning that you can mute or delet them if you don't need them. For example, if you don't need ageing effect just select 6 node subgroups in AGEING frame and delete them with Ctrl+X. Than to clear inputs, open Properties panel by pressing N. There you should see Interface tab. Navigate to the bottom of the inputs and delete all, concerning ageing effect. Also you can change last letters of the node group's name. According to the naming convention V refers to Color variations, S to Stripes, T to Thickness variations and A to Ageing. Words after -textures_ prefix are explained below

4. Changing/adding weaving pattern:

In TEXTURES node group you may notice that there's yellow node subgroup called PATTERN. Here's where you can change weaving pattern. The easiest way is to use one of already added. To do so just click little ball icon and you'll see a list of all node groups. What you are looking for are ones with _pattern_ prefix. So there's naming convention I have here as well: numbers in brackets shows weft and warp fibers amount and the word after refers to the pattern form (for example if you have chosen (24x6)_ZIG_ZAG pattern you should set weft repeats to 24 and warp repeats t0 6 or multiples). The pattern name is shown in the name of TEXTURES node group as well. To see the pattern itself you can choose it in Image/UV editor. Blacks are the parts where weft threads are visible on the front side, and whites are the parts where warp threads are visible on the front side.

What you can also do is to create your own weaving patterns if you don't like any of mine. To do that just create a B&W image A x B pixels, where A would be amount of weft fibers and B amount of warp fibers. Than save it to rapports folder. You may also want to create bigger thumbnail for easier navigation (I do not recomend to use this thumbnails as textures, as it may cause errors if they are created by simple scaling, and it will use more computational resources). Than load just created texture into blender in UV/Image editor and go to TEXTURES node group. Then select PATTERN subgroup and press an icon with the number (2, 3, etc.). Rename node group and press F icon to create fake user if you like and open it with Tab. There you'll see 5 red image texture nodes. Click on image icon of any of these nodes and select your pattern image texture, which you loaded via UV/Image editor. Repeat that for each node. Than go out of both PATTERN and TEXTRES node group and set correct weft/warp fibers.

A huge collection of real weaving pattern can be found in rapports folder in Patterns.pdf


5. Baking textures:

TEXTURES node group is separated specifically so you can bake all the textures and save render time, not generating it over and over again. The most important outputs are Diffuse, Reflections, Roughness, Anisotropy and Rotation which are pluged in the same inoputs of SHADERS node group. So if you are happy with the settings you may bake listed above textures and then use them instead of TEXTURES node group: just delete it and add 5 baked image textures and plug them into SHADERS node group (note that it's better to bake textures with low amount of repeats to maintatin details and instead repeat baked textures, though most effects are based on non-tilable cloud texture and you may get visible seams)

6. Changing shading model:

Next parameters you can change are in SHADERS node group. This node group is actually not cloth specific, it's a general uber-shader with diffuse, glossy, velvet and translucency shaders mixed, so you may use it completely separately. For example you may use only this single group to achieve believable velvet shader. So here's explanation of the node group:


  • Normals - plug normals here (you may leve it empty, if you don't use normals maps)
  • Bump - plug normals with applied bump created either via TEXTURES node group or your own textures
  • Tangent - plug tangent node here (can be added by Ctrl+A -> Inputs -> Tangent. Better to use tangent from UV map)
  • Diffuse, reflections, roughness, anisotropy and rotation are the same of Diffuse and Anisotropic BSDF
  • Translusency - adds translusency to the shader
  • Velvetness - adds velvet look to the shader
  • Velvet roughness - adds irregularity (simmulates irregular nap directions resulting in darkening or lightening of random spots)
  • Velvet sigma - contrlos edges accentuation (the lower the value the sharper  the edges)


  • DR - returns only Diffuse and Reflections components
  • DR+V - returns Diffuse, Reflection and Velvet components
  • DR+T - returns Diffuse, Reflection and Translucent components
  • DR+V+T - returns Diffuse, Reflection,Velvet and Translucent components
  • Diffuse - returns Diffuse color
  • Glossy - returns only Reflections component (usefull to clearly see changes you made, concerning reflections: roughness, anisotropy, etc.)

Outputs are separated in such way so that you can exclude unused component from rendering time. So if your Velvetness and Translusency are set to 0 you may use DR iutput what will give you a little speed improvement.

7. Adding effects:

After all that you can add some more effects wich are Dust, Transparency and Fuzz. Their names, inputs and outputs are quite self-explanatory, I suppose. The only thing to accentuate on is Transparency node group. It is here not to simply mix shaders with transparent one. The main thing here is mask, which is derived from corresponding output of TEXTURES node group, and makes shader transperent only between threads, which makes fabric look transparent when the threads are completely solid.


If you have read all that you are a very patient person:) But if you have any questions anyway feel free to send me an e-mail.