Unity-Technologies / ShaderGraph-Custom-Lighting

A sample project showcasing a simple method to calculate custom lighting inside of Shader Graph for the Lightweight Render Pipeline. Includes a sample toon shaded scene and example assets. Built for Unity 2019.2 .
272 stars 156 forks source link

Errors and pink shader on Water material #1

Open MlleDR opened 5 years ago

MlleDR commented 5 years ago

Hello,

I just wanted to report this bug. I downloaded the project and while opening the main scene, I saw that the Water shader has errors and is pink in the scene.

image

image

Error 1

UnityEngine.GUILayoutUtility.BeginLayoutGroup (UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options, System.Type layoutType) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayoutUtility.cs:311)
UnityEngine.GUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, System.Boolean alwaysShowHorizontal, System.Boolean alwaysShowVertical, UnityEngine.GUIStyle horizontalScrollbar, UnityEngine.GUIStyle verticalScrollbar, UnityEngine.GUIStyle background, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:360)
UnityEngine.GUILayout.BeginScrollView (UnityEngine.Vector2 scrollPosition, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:349)
UnityEditor.ShaderInspector.ShaderErrorListUI (UnityEngine.Object shader, UnityEditor.ShaderMessage[] messages, UnityEngine.Vector2& scrollPosition) (at C:/buildslave/unity/build/Editor/Mono/Inspector/ShaderInspector.cs:181)
UnityEditor.ShaderInspector.ShowShaderErrors (UnityEngine.Shader s) (at C:/buildslave/unity/build/Editor/Mono/Inspector/ShaderInspector.cs:301)
UnityEditor.ShaderInspector.ShowShaderCodeArea (UnityEngine.Shader s) (at C:/buildslave/unity/build/Editor/Mono/Inspector/ShaderInspector.cs:156)
UnityEditor.ShaderInspector.OnInspectorGUI () (at C:/buildslave/unity/build/Editor/Mono/Inspector/ShaderInspector.cs:85)
UnityEditor.UIElements.InspectorElement+<CreateIMGUIInspectorFromEditor>c__AnonStorey1.<>m__0 () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:496)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Error 2

Shader error in 'Shader Graphs/Water': syntax error: unexpected integer constant at line 90 (on d3d11)

Compiling Fragment program
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR

Error 3


Compiling Fragment program
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR

Error 4

Shader error in 'Shader Graphs/Water': syntax error: unexpected integer constant at line 759 (on d3d11)

Compiling Fragment program with UNITY_PASS_SHADOWCASTER
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR

Error 5

Shader error in 'Shader Graphs/Water': incorrect number of arguments to numeric-type constructor at line 760 (on d3d11)

Compiling Fragment program with UNITY_PASS_SHADOWCASTER
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR
discostudio commented 5 years ago

Yes, same here :( Pink on water shader. No news?

M3talen commented 5 years ago

Same here

zORg-alex commented 3 years ago

Got it working. I've peeked at https://blogs.unity3d.com/2021/02/05/introducing-shader-graphs-new-master-stack/ They used Unity 2020.2 and same function. Remove `#ifndef CUSTOM_LIGHTING_INCLUDED

define CUSTOM_LIGHTING_INCLUDED`

and #endif at the end. and use #ifdef SHADERGRAPH_PREVIEW instead of #if SHADERGRAPH_PREVIEW

No need to include anything. Just plain functions. Seems that it was removed for simplicity. I tried this on 2020 LTS version. Works.