Skip to content

Shader Graph

Vladislav Kantaev edited this page Dec 28, 2023 · 18 revisions

Graph Types

⚠️ Warning: Shader Graph is not yet fully supported. Some of the missing fuctionality can be found in the Known Issues section.

The following graph types are implemented at the moment:

Shader Graph

How to Create

To create a shader graph, right click in the Project window, select Create/Shader Graph/Toon RP and choose the required graph type.

Graph Settings and Properties

Shared

This subsection lists properties used in all shader graph types provided by Toon RP.

Graph settings:

  • Surface Type - Opaque/Transparent
  • Blending Mode - Alpha/Premultiply/Additive/Multiply
  • Render Face - Back/Front/Both
  • Depth Write - Auto/Force Enabled/Force Disabled
  • Depth Test
  • Alpha Clipping
  • Alpha To Coverage - AlphaToMask
  • Control Outlines Stencil Layer - enables Outlines Stencil Layer in material inspector, used to prevent inner outlines (applicable to Inverted Hull Outlines)
  • Fog
  • Custom Fog - adds an overlay color, which can be used for fog-like effects. It is blended on top of the output color via Custom Fog Factor and Custom Fog Color).
  • Cast Shadows
  • Ignored Pre-Passes - specify the pre-passes to exclude from generation

Fragment outputs:

  • Albedo - Color
  • Emission - HDR Color
  • Alpha - Float
  • Alpha Clip Threshold - Float
  • Custom Fog Factor - Float
  • Custom Fog Color - Color

Built-in material properties:

  • Outlines Stencil Layer

Default

A graph with the full lighting model, similar to what is offered in Toon RP/Default.

Graph settings:

  • Receive Shadows
  • Override Ramp - enables control over threshold and smoothness in the fragment shader (for diffuse, specular, and rim separately)
  • Specular - enables specular lighting
  • Additional Lights Specular - enables specular lighting for additional lights
  • Rim - enables rim (fresnel) lighting
  • Environment Lighting
  • Fragment Normal Space - Tangent/Object/World - changes the space of the Normal input in the fragment stage

Fragment outputs:

  • Shadow Color - RGB for shadow color, A for shadow opacity
  • Override Ramp Threshold, Override Ramp Smoothness - threshold and smoothness for the overriden ramp. Specular and rim have their own outputs, which are only visible if the corresponding options are enabled in the Graph Settings.
  • Emission Shadow Blend - controls how emisison should attenuate in shadow (1 - full emission, 0 - no emission).

Built-in material properties:

  • Receive Blob Shadows

Unlit

A basic unlit shader similar to Toon RP/Unlit.

Particles (Unlit)

A shader for particles similar to Toon RP/Particles/Unlit.

Graph settings:

  • Soft Particles - enables smooth fade when close to opaque geometry. Requires Depth Pre-Pass. Activates the Soft Particles Distance and Soft Particles Range outputs.

Fragment outputs:

  • Soft Particles Distance - how close to opaque geometry the fade should start
  • Soft Particles Range - the smoothness of the soft particles fade

Inverted Hull Outlines

A shader graph type for overriding materials of Inverted Hull Outline.

Vertex outputs:

  • Outline Thickness - extra multiplier for outline thickness.

Built-In Custom Nodes

Matcap

Matcap

Computes UV and samples a matcap texture.

Inputs:

  • OriginalColor - source albedo color. Used for blending with the resulting matcap color.
  • MatcapTexture
  • MatcapTint - additional color, which is multiplied with a MatcapTexture sample.
  • MatcapUV_Tiling, MatcapUV_Offset
  • Blend - a parameters used to blend between the OriginalColor and computed matcap color.

Outputs:

  • Out_Result

Known Issues

Unsupported nodes:

  • ...

References

Clone this wiki locally