Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Bug Alpha Clipping broken in Application Spacewarp URP 2022.2 fork

Discussion in 'VR' started by NoteMEdown, Jan 12, 2024.

  1. NoteMEdown

    NoteMEdown

    Joined:
    Sep 6, 2018
    Posts:
    6
    I am currently using the 2022.2 URP fork for motion vectors. After much troubleshooting, I found that enabling Alpha Clipping or Allow Material Override in a shader graph return an error, and do not work.

    The error is :

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.Rendering.Universal.ShaderGraph.CorePasses.AddAlphaClipControlToPass (UnityEditor.ShaderGraph.PassDescriptor& pass, UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget target) (at ./Library/PackageCache/com.unity.render-pipelines.universal@428604577a/Editor/ShaderGraph/Targets/UniversalTarget.cs:858)
    3. UnityEditor.Rendering.Universal.ShaderGraph.CorePasses.MotionVectors (UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget target) (at ./Library/PackageCache/com.unity.render-pipelines.universal@428604577a/Editor/ShaderGraph/Targets/UniversalTarget.cs:1090)
    4. UnityEditor.Rendering.Universal.ShaderGraph.UniversalLitSubTarget+SubShaders.LitComputeDotsSubShader (UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget target, UnityEditor.Rendering.Universal.ShaderGraph.WorkflowMode workflowMode, System.String renderType, System.String renderQueue, System.String disableBatchingTag, System.Boolean complexLit, System.Boolean blendModePreserveSpecular) (at ./Library/PackageCache/com.unity.render-pipelines.universal@428604577a/Editor/ShaderGraph/Targets/UniversalLitSubTarget.cs:370)
    5. UnityEditor.Rendering.Universal.ShaderGraph.UniversalLitSubTarget.Setup (UnityEditor.ShaderGraph.TargetSetupContext& context) (at ./Library/PackageCache/com.unity.render-pipelines.universal@428604577a/Editor/ShaderGraph/Targets/UniversalLitSubTarget.cs:93)
    6. UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget.Setup (UnityEditor.ShaderGraph.TargetSetupContext& context) (at ./Library/PackageCache/com.unity.render-pipelines.universal@428604577a/Editor/ShaderGraph/Targets/UniversalTarget.cs:360)
    7. UnityEditor.ShaderGraph.Generator..ctor (UnityEditor.ShaderGraph.GraphData graphData, UnityEditor.ShaderGraph.AbstractMaterialNode outputNode, UnityEditor.ShaderGraph.GenerationMode mode, System.String primaryShaderName, UnityEditor.ShaderGraph.Target[] targets, UnityEditor.ShaderGraph.AssetCollection assetCollection, System.Boolean humanReadable) (at ./Library/PackageCache/com.unity.shadergraph@428604577a/Editor/Generation/Processors/Generator.cs:111)
    8. UnityEditor.ShaderGraph.Drawing.PreviewManager.CompileMasterNodeShader () (at ./Library/PackageCache/com.unity.shadergraph@428604577a/Editor/Drawing/PreviewManager.cs:1251)
    9. UnityEditor.ShaderGraph.Drawing.PreviewManager.KickOffShaderCompilations () (at ./Library/PackageCache/com.unity.shadergraph@428604577a/Editor/Drawing/PreviewManager.cs:828)
    10. UnityEditor.ShaderGraph.Drawing.PreviewManager.UpdateShaders () (at ./Library/PackageCache/com.unity.shadergraph@428604577a/Editor/Drawing/PreviewManager.cs:882)
    11. UnityEditor.ShaderGraph.Drawing.PreviewManager.RenderPreviews (UnityEditor.EditorWindow editorWindow, System.Boolean requestShaders) (at ./Library/PackageCache/com.unity.shadergraph@428604577a/Editor/Drawing/PreviewManager.cs:534)
    12. UnityEditor.ShaderGraph.Drawing.GraphEditorView.HandleGraphChanges (System.Boolean wasUndoRedoPerformed) (at ./Library/PackageCache/com.unity.shadergraph@428604577a/Editor/Drawing/Views/GraphEditorView.cs:685)
    13. UnityEditor.ShaderGraph.Drawing.MaterialGraphEditWindow.Update () (at ./Library/PackageCache/com.unity.shadergraph@428604577a/Editor/Drawing/MaterialGraphEditWindow.cs:384)
    14. UnityEditor.HostView.SendUpdate () (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    15. UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <ae93fefe62eb49e6b9ef3807ffd33dc7>:0)
    Which ends at the function:

    internal static void AddAlphaClipControlToPass(ref PassDescriptor pass, UniversalTarget target)
    {
    if (target.allowMaterialOverride)
    pass.keywords.Add(CoreKeywordDescriptors.AlphaTestOn);
    else if (target.alphaClip)
    pass.defines.Add(CoreKeywordDescriptors.AlphaTestOn, 1);
    }


    Any help in resolving this would be life saving.
     
  2. NoteMEdown

    NoteMEdown

    Joined:
    Sep 6, 2018
    Posts:
    6
  3. KevinXR

    KevinXR

    Unity Technologies

    Joined:
    Jan 19, 2023
    Posts:
    24
    Thanks for identifying this @NoteMEdown . I'll make sure it gets routed to the right team here at Unity.