The hair shader is a dedicated rendering technique for rendering hair and fur. Hair rendering is a relatively hard task to achieve in real-time with high quality results due to the very fine geometry and specific lighting behavior.
The most recent implementation of hair shading strongly implies the use of alpha test in conjunction with soft alpha test enabled so the use of opacity is strongly discouraged since its visual result is prone to issues especially when sorting multiple polygons using opacity.
Shader Params | Description | Shader Gen Option |
---|---|---|
Alpha test softening | Sets amount of alpha test softening to apply. | Soft alpha test |
Ambient spec multiplier | Controls over specular intensity. | Default |
Bump scale | Sets hair bumpiness. | Default |
Detail tilling | Sets detail tilling scale. | Default |
Diffuse wrap | Sets diffuse wrapping. | Default |
Hair color | Sets hair color. | Default |
Indirect bounce color | See Illum Shader for more information. | Default |
Primary spec color | Sets primary spec color. | Default |
Primary spec glossiness | Sets primary specular glossiness. | Default |
Primary spec shift | Sets primary specular shift. | Default |
Rim multiplier | Sets rim strength. | Default |
Secondary spec color | Sets hair secondary spec color. | Default |
Secondary spec glossiness | Sets secondary specular glossiness. | Default |
Secondary spec shift | Sets secondary specular specular shift. | Default |
Self-shadow softening | Sets geometry self-shadowing multiplier. | Default |
Wind frequency | Sets the speed at which the verts are deformed. | Wind bending |
Wind phase | Sets hair animation phase and randomizes the deformation. | Wind bending |
Wind wave0 amp | Sets the amount or amplitude at which the verts are deformed. | Wind bending |
Wind wave2 amp | Sets the amount or amplitude at which the verts are deformed on a different curve. | Wind bending |
Param | Description |
---|---|
Vertex Colors | See Illum Shader for more information. |
Soft alpha test | Enable for alpha test to have soft edges and for more stable rendering. |
Wind bending | Simulate wind effects. |
Due to limitations in hardware regarding alpha blending sorting, we cannot at this point have per-pixel sorting which would save a lot of work, so we need to use a very cheap sorting approximation which works something like this:
Render hair opaque areas (this is where your alpha channel is 1 (white)). Then render hair backfaces, and finally render hair frontfaces.
This works for many cases but it has a lot of limitations, regarding modeling for it to work:
When "Soft alpha test" is enabled, the hair will be rendered using the usual opaque rendering pipeline. In a post process we apply alpha test smoothing. You can also enable double sided option at will.
Diffuse texture | Diffuse texture alpha channel |
---|