Fur Shader Passes

From Warren's Fast Fur Shader
(Redirected from Fur Shader Layers)
Jump to navigation Jump to search

Rendering Passes[edit | edit source]

Fast Fur is a 3-pass shader. Each pass runs from start to finish before the next pass starts.

Pass 1 - The Skin[edit | edit source]

Many lighting effects, such as proper specular lighting and normal maps, are simply too slow to calculate for every layer of fur. As a compromise, my shader only renders the skin "expensively".

However, an unexpected benefit of rendering the skin separately is that it actually renders faster than doing everything in 1 pass. As far as I can tell (and this is really just a guess!), trying to render the opaque skin at the same time as the mostly see-through fur results in the GPU caches missing a lot.

The speed increase is so great, in fact, that 16 "cheap" fur layers + 1 "expensive" skin layer renders significantly faster than 15 "cheap" fur layers + 1 "cheap" skin layer.

Pass 2 - The Fur[edit | edit source]

Almost nothing is rendered "correctly" by the fur layers. They take every short-cut possible, resulting in all sorts of lighting errors and glitches (if you know what to look for).

However, speed is absolutely essential, because these layers make up the vast majority of the render time, and rendering lots of "cheap" layers looks significantly better than rendering only half as many "expensive" layers.

The shader also has a couple of tricks up its sleeve:

  • Trick #1: it can turn the fur layers off (if too far away, offscreen, or backwards) by having the Hull shader ask the Tessellator to multiply the number of triangles by 0, which throws them out before they reach the Geometry shader stage. This is a MASSIVE speed boost, roughly doubling the speed of the shader.
  • Trick #2: it can have the Hull shader ask the Tessellator split each triangle into 4 when taking a photo. However, the Domain shader then ignores the Tessellator's instructions, and instead just makes 4 copies of the original, un-tessellated triangle. The fur can thus be rendered at up to 4x resolution, but only when needed.

Pass 3 - The Overcoat[edit | edit source]

Added in v5.0, the overcoat is a translucent layer of fur that acts as a cheap visual stand-in for actual fur when the avatar is far away. It allows the shader to turn the "real" fur layers off completely, which results in a significant speed boost.

At close range the overcoat is not visible, but as distance increases the overcoat fades in and expands outwards to about 2/3rds the thickness of the fur.