Friday, August 30, 2013

ShaderFX custom code example

Here is an example of using the "Custom Code" node provided in ShaderFX to create a snow-layer effect.

We measure the angle between the vertex normal and the world UP (or "snow direction" if you wish) and blend in the white color on top of the rock texture.

We have a second custom code node that modifies the vertex position to give the snow some thickness.
Download Custom Code Snow ShaderFX graph

Example shaders in Maya LT

ShaderFX is a real-time shader editor build into Maya LT.
Below are some examples.

Matcap shader:
Download Matcap ShaderFX graph

Animated shader:
Download Animated Fire ShaderFX graph

Anisotropic and latlong reflections:
Download Anisotropic ShaderFX graph

ShaderFX is very customizable.
Most nodes are what I call "Group Nodes". Similar to e.g. compound nodes in XSI. For example you can go inside the Surface shader itself and poke around:

Blurring reflection maps based on procedural checker pattern:
Download Blurry Reflections ShaderFX graph

Blending normal maps with various options to blend:
Download Blending Normal Maps ShaderFX graph

Animated Surface Mask (Opacity Mask):
Download Surface Mask ShaderFX graph

An example of DirectX 11 tessellation and displacement:
Download Tessellation and Displacement ShaderFX graph

Mixing with vertex colors:
Download Vertex Colors ShaderFX graph

Wrinkle Map (sorry don't have a great face model/rig laying around):

The attribute on the locator drives the value in the shader.
In ShaderFX "Values nodes" (such as floats, colors, textures) have an option called "Input from Maya". When you enable this option, the value is exposed as a regular Maya Attribute in the dependency graph and can be connected to your rig:
Download Wrinkle Map ShaderFX graph

Translucency (Thickness map controls the density, in this case, a vein map):
Download Translucency ShaderFX graph