Class ShaderGenerator | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class ShaderGenerator

    Inheritance
    System.Object
    ShaderGenerator
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: UnityEditor.ShaderGraph
    Syntax
    public class ShaderGenerator

    Properties

    numberOfChunks

    Declaration
    public int numberOfChunks { get; }
    Property Value
    Type Description
    System.Int32

    Methods

    AdaptNodeOutput(AbstractMaterialNode, Int32, ConcreteSlotValueType)

    Declaration
    public static string AdaptNodeOutput(AbstractMaterialNode node, int outputSlotId, ConcreteSlotValueType convertToType)
    Parameters
    Type Name Description
    AbstractMaterialNode node
    System.Int32 outputSlotId
    ConcreteSlotValueType convertToType
    Returns
    Type Description
    System.String

    AdaptNodeOutputForPreview(AbstractMaterialNode, Int32)

    Declaration
    public static string AdaptNodeOutputForPreview(AbstractMaterialNode node, int outputSlotId)
    Parameters
    Type Name Description
    AbstractMaterialNode node
    System.Int32 outputSlotId
    Returns
    Type Description
    System.String

    AdaptNodeOutputForPreview(AbstractMaterialNode, Int32, String)

    Declaration
    public static string AdaptNodeOutputForPreview(AbstractMaterialNode node, int slotId, string variableName)
    Parameters
    Type Name Description
    AbstractMaterialNode node
    System.Int32 slotId
    System.String variableName
    Returns
    Type Description
    System.String

    AddGenerator(ShaderGenerator)

    Declaration
    public void AddGenerator(ShaderGenerator generator)
    Parameters
    Type Name Description
    ShaderGenerator generator

    AddPragmaChunk(String)

    Declaration
    public void AddPragmaChunk(string s)
    Parameters
    Type Name Description
    System.String s

    AddShaderChunk(String, Boolean)

    Declaration
    public void AddShaderChunk(string s, bool unique = false)
    Parameters
    Type Name Description
    System.String s
    System.Boolean unique

    BuildMaterialTags(SurfaceType)

    Declaration
    public static SurfaceMaterialTags BuildMaterialTags(SurfaceType surfaceType)
    Parameters
    Type Name Description
    SurfaceType surfaceType
    Returns
    Type Description
    SurfaceMaterialTags

    ConvertBetweenSpace(String, CoordinateSpace, CoordinateSpace, ShaderGenerator.InputType, CoordinateSpace)

    Declaration
    public static string ConvertBetweenSpace(string variable, CoordinateSpace from, CoordinateSpace to, ShaderGenerator.InputType inputType, CoordinateSpace tangentMatrixSpace = CoordinateSpace.Object)
    Parameters
    Type Name Description
    System.String variable
    CoordinateSpace from
    CoordinateSpace to
    ShaderGenerator.InputType inputType
    CoordinateSpace tangentMatrixSpace
    Returns
    Type Description
    System.String

    Deindent()

    Declaration
    public void Deindent()

    EmitTransform(ShaderGenerator.TransformDesc[], ShaderGenerator.TransformDesc[], String, Boolean, Boolean, Boolean)

    Declaration
    public static string EmitTransform(ShaderGenerator.TransformDesc[] matrices, ShaderGenerator.TransformDesc[] invMatrices, string variable, bool isAffine, bool noMatrixCast, bool inverseTranspose)
    Parameters
    Type Name Description
    ShaderGenerator.TransformDesc[] matrices
    ShaderGenerator.TransformDesc[] invMatrices
    System.String variable
    System.Boolean isAffine
    System.Boolean noMatrixCast
    System.Boolean inverseTranspose
    Returns
    Type Description
    System.String

    GenerateSpaceTranslations(NeededCoordinateSpace, InterpolatorType, CoordinateSpace, ShaderGenerator.InputType, ShaderStringBuilder, ShaderGenerator.Dimension)

    Declaration
    public static void GenerateSpaceTranslations(NeededCoordinateSpace neededSpaces, InterpolatorType type, CoordinateSpace from, ShaderGenerator.InputType inputType, ShaderStringBuilder pixelShader, ShaderGenerator.Dimension dimension)
    Parameters
    Type Name Description
    NeededCoordinateSpace neededSpaces
    InterpolatorType type
    CoordinateSpace from
    ShaderGenerator.InputType inputType
    ShaderStringBuilder pixelShader
    ShaderGenerator.Dimension dimension

    GenerateSpaceTranslationSurfaceInputs(NeededCoordinateSpace, InterpolatorType, ShaderStringBuilder, String)

    Declaration
    public static void GenerateSpaceTranslationSurfaceInputs(NeededCoordinateSpace neededSpaces, InterpolatorType interpolatorType, ShaderStringBuilder builder, string format = "float3 {0};")
    Parameters
    Type Name Description
    NeededCoordinateSpace neededSpaces
    InterpolatorType interpolatorType
    ShaderStringBuilder builder
    System.String format

    GenerateStandardTransforms(Int32, Int32, ShaderStringBuilder, ShaderStringBuilder, ShaderStringBuilder, ShaderStringBuilder, ShaderStringBuilder, ShaderStringBuilder, ShaderGraphRequirements, ShaderGraphRequirements, ShaderGraphRequirements, ShaderGraphRequirements, CoordinateSpace)

    Declaration
    public static void GenerateStandardTransforms(int interpolatorStartIndex, int maxInterpolators, ShaderStringBuilder vertexOutputStruct, ShaderStringBuilder vertexShader, ShaderStringBuilder vertexShaderDescriptionInputs, ShaderStringBuilder vertexShaderOutputs, ShaderStringBuilder pixelShader, ShaderStringBuilder pixelShaderSurfaceInputs, ShaderGraphRequirements pixelRequirements, ShaderGraphRequirements surfaceRequirements, ShaderGraphRequirements modelRequiements, ShaderGraphRequirements vertexRequirements, CoordinateSpace preferredCoordinateSpace)
    Parameters
    Type Name Description
    System.Int32 interpolatorStartIndex
    System.Int32 maxInterpolators
    ShaderStringBuilder vertexOutputStruct
    ShaderStringBuilder vertexShader
    ShaderStringBuilder vertexShaderDescriptionInputs
    ShaderStringBuilder vertexShaderOutputs
    ShaderStringBuilder pixelShader
    ShaderStringBuilder pixelShaderSurfaceInputs
    ShaderGraphRequirements pixelRequirements
    ShaderGraphRequirements surfaceRequirements
    ShaderGraphRequirements modelRequiements
    ShaderGraphRequirements vertexRequirements
    CoordinateSpace preferredCoordinateSpace

    GetMaterialOptions(SurfaceType, AlphaMode, Boolean)

    Declaration
    public static SurfaceMaterialOptions GetMaterialOptions(SurfaceType surfaceType, AlphaMode alphaMode, bool twoSided)
    Parameters
    Type Name Description
    SurfaceType surfaceType
    AlphaMode alphaMode
    System.Boolean twoSided
    Returns
    Type Description
    SurfaceMaterialOptions

    GetPragmaString()

    Declaration
    public string GetPragmaString()
    Returns
    Type Description
    System.String

    GetPreviewSubShader(AbstractMaterialNode, ShaderGraphRequirements)

    Declaration
    public static string GetPreviewSubShader(AbstractMaterialNode node, ShaderGraphRequirements shaderGraphRequirements)
    Parameters
    Type Name Description
    AbstractMaterialNode node
    ShaderGraphRequirements shaderGraphRequirements
    Returns
    Type Description
    System.String

    GetShaderString(Int32, Boolean)

    Declaration
    public string GetShaderString(int baseIndentLevel, bool finalNewline = true)
    Parameters
    Type Name Description
    System.Int32 baseIndentLevel
    System.Boolean finalNewline
    Returns
    Type Description
    System.String

    GetTemplatePath(String)

    Declaration
    public static string GetTemplatePath(string templateName)
    Parameters
    Type Name Description
    System.String templateName
    Returns
    Type Description
    System.String

    Indent()

    Declaration
    public void Indent()
    Back to top
    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