Surface gradient workflow
This is an introduction to the fundamental concepts and workflow for using surface gradient bump mapping with Shader Graph.
Getting started
After you have installed the package in a project, you can access the Surface Gradient Bump Mapping Subgraphs in Shader Graph via the Create Node Menu.
For a Shader Graph to use surface gradients, the resolved normals must be in the same space as the Master Stack. Set the Fragment Normal Space to World in the Graph Inspector's Graph Settings tab.
The fundamental workflow can be summarized as the following steps:
- Sample the texture as a surface gradient
- Perform operations or blending of the surface gradients
- Resolve the surface gradient to a World space normal
Surfgrad from texture
Use the Surfgrad From Texture Subgraph to sample a normal or height texture and output a surface gradient. The Subgraphs outputs a Vector 3 named Surfgrad. The texture type and settings for interpreting it can be selected via the dropdowns.
Operations
Math operations can be performed on the Surfgrad output. In the following example, this has the effect of increasing the intensity of the first bump (height texture) and layering the second bump (normal texture) on top of it.
The Surfgrad Mixer provides a utility to perform some of these common operations.
Resolve
Finally, resolve the Surfgrad back to a normal to connect it to the Shader Graph Master Stack. Use the Surfgrad Resolve Subgraph. You must set the Shader Graph Fragment Normal Space to accept normals in World Space.
The result displays in the Main Preview window.