top of page

Fabric Shading with Unity URP

C#,  HLSL, Shader Graph, Substance Designer

To give artists the flexibility to create various types of fiber while using different pipeline standards, we created this Shader-Graph-based fabric shading solution. While shading fibers in a physically based manner, we guaranteed that artists can use shader graphs to process their inputs. For instance, artists can choose the sources as the normal input–from normal maps, thread maps, or detail maps. We created the master node with two types of BRDF for silk-like and cotton-like fibers. Also, we implemented the commonly used features for fabric shading–translucency, anisotropic specular, and an extended two-sided rendering option. I was responsible to build the Shader Graph nodes to support artists’ work. I was responsible for the C# and HLSL coding, BRDFs research, Shader Graph nodes creation, and Demo creation using Substance Designer.

Fabric Shading with Unity URP: Text
overview.png
Fabric Shading with Unity URP: Image

Cotton Shading

For common cotton shading, we highlighted the following featured based on observations from reality:

  1. Soft specular lobe with large smooth falloffs.

  2. Fuzz on the rim from asperity scattering.

  3. Low specular contribution at front facing angles.

One extreme example is Velvet:

fabric_linen.png
Fabric Shading with Unity URP: Image

Silk Shading

Silk-like fibers feature anisotropic specular highlights and separate specular color that gives the material an iridescent look:

fabric_nylon.png
Fabric Shading with Unity URP: Image
fabric_silk.png
Fabric Shading with Unity URP: Image

Translucency

We implemented translucency effect for thin fibers:

fabric_translucency.png
Fabric Shading with Unity URP: Image

Shader Graph Master Node Extension

Fabric Shading with Unity URP: Text

We extended the Shader Graph material type in URP. Added the “Fabric” option in the Graph Inspector, users can convert their Lit shader to our Fabric shader.

fabric_inspector.png
Fabric Shading with Unity URP: Image

To better mimic the surface feature of fiber, we implemented two types of BRDF–“Cotton: for rough fibers and “Silk” for smooth fibers in general.

fabric_type.png
Fabric Shading with Unity URP: Image

Two-sided rendering options were extended to support flipped-normal and mirrored-normal.

fabric_twosided.png
Fabric Shading with Unity URP: Image

Shader Graph Workflow

Fabric Shading with Unity URP: Text

We provided a general Shader Graph for artists to create their own fibers. By blending the details and patterns, artists can easily create differentiated types of material using a few input textures.

fabric_shadergraph.png
Fabric Shading with Unity URP: Image

Decoding surface information from Threadmap:

fabric_threadmap.png
Fabric Shading with Unity URP: Image
bottom of page