docs.unity3d.com
    Show / Hide Table of Contents

    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.

    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.

    Fragment Normal Space

    The fundamental workflow can be summarized as the following steps:

    1. Sample the texture as a surface gradient
    2. Perform operations or blending of the surface gradients
    3. 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.

    Surfgrad From Texture

    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.

    Operations

    The Surfgrad Mixer provides a utility to perform some of these common operations.

    Surfgrad Mixer

    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.

    Resolve

    The result displays in the Main Preview window.

    Result

    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023