Skip to content

Commit 9d21b73

Browse files
author
AleMC
committed
Revert "Add toggle in 'Lit' shader to enable real-time main light per material (Unity-Technologies#11)"
This reverts commit a87a54c.
1 parent 6b1801f commit 9d21b73

File tree

4 files changed

+7
-35
lines changed

4 files changed

+7
-35
lines changed

com.unity.render-pipelines.universal/Editor/ShaderGUI/Shaders/LitShader.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,11 @@ public override void DrawSurfaceInputs(Material material)
7878
// material main advanced options
7979
public override void DrawAdvancedOptions(Material material)
8080
{
81-
// (ASG) added 'realtimeMainLight' property.
82-
if (litProperties.reflections != null && litProperties.highlights != null && litProperties.realtimeMainLight != null)
81+
if (litProperties.reflections != null && litProperties.highlights != null)
8382
{
8483
EditorGUI.BeginChangeCheck();
8584
materialEditor.ShaderProperty(litProperties.highlights, LitGUI.Styles.highlightsText);
8685
materialEditor.ShaderProperty(litProperties.reflections, LitGUI.Styles.reflectionsText);
87-
materialEditor.ShaderProperty(litProperties.realtimeMainLight, LitGUI.Styles.realtimeMainLightText);
8886
if(EditorGUI.EndChangeCheck())
8987
{
9088
MaterialChanged(material);

com.unity.render-pipelines.universal/Editor/ShaderGUI/ShadingModels/LitGUI.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ public static class Styles
4444
new GUIContent("Environment Reflections",
4545
"When enabled, the Material samples reflections from the nearest Reflection Probes or Lighting Probe.");
4646

47-
// (ASG)
48-
public static GUIContent realtimeMainLightText =
49-
new GUIContent("Real-time Main Light",
50-
"When enabled, real-time main light will be blended with baked lighting.");
51-
5247
public static GUIContent heightMapText = new GUIContent("Height Map",
5348
"Specifies the Height Map (G) for this Material.");
5449

@@ -94,8 +89,6 @@ public struct LitProperties
9489
// Advanced Props
9590
public MaterialProperty highlights;
9691
public MaterialProperty reflections;
97-
// (ASG)
98-
public MaterialProperty realtimeMainLight;
9992

10093
public MaterialProperty clearCoat; // Enable/Disable dummy property
10194
public MaterialProperty clearCoatMap;
@@ -122,8 +115,6 @@ public LitProperties(MaterialProperty[] properties)
122115
// Advanced Props
123116
highlights = BaseShaderGUI.FindProperty("_SpecularHighlights", properties, false);
124117
reflections = BaseShaderGUI.FindProperty("_EnvironmentReflections", properties, false);
125-
// (ASG)
126-
realtimeMainLight = BaseShaderGUI.FindProperty("_RealtimeMainLight", properties, false);
127118

128119
clearCoat = BaseShaderGUI.FindProperty("_ClearCoat", properties, false);
129120
clearCoatMap = BaseShaderGUI.FindProperty("_ClearCoatMap", properties, false);
@@ -303,10 +294,6 @@ public static void SetMaterialKeywords(Material material)
303294
if (material.HasProperty("_EnvironmentReflections"))
304295
CoreUtils.SetKeyword(material, "_ENVIRONMENTREFLECTIONS_OFF",
305296
material.GetFloat("_EnvironmentReflections") == 0.0f);
306-
// (ASG)
307-
if (material.HasProperty("_RealtimeMainLight"))
308-
CoreUtils.SetKeyword(material, "_REALTIME_MAIN_LIGHT_ON",
309-
material.GetFloat("_RealtimeMainLight") != 0.0f);
310297
if (material.HasProperty("_OcclusionMap"))
311298
CoreUtils.SetKeyword(material, "_OCCLUSIONMAP", material.GetTexture("_OcclusionMap"));
312299

com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -867,33 +867,25 @@ half4 UniversalFragmentPBR(InputData inputData, SurfaceData surfaceData)
867867
half4 shadowMask = half4(1, 1, 1, 1);
868868
#endif
869869

870-
#if defined(_REALTIME_MAIN_LIGHT_ON) // (ASG)
871-
Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, shadowMask);
872-
#endif
870+
// Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, shadowMask);
873871

874872
#if defined(_SCREEN_SPACE_OCCLUSION)
875873
AmbientOcclusionFactor aoFactor = GetScreenSpaceAmbientOcclusion(inputData.normalizedScreenSpaceUV);
876874
mainLight.color *= aoFactor.directAmbientOcclusion;
877875
surfaceData.occlusion = min(surfaceData.occlusion, aoFactor.indirectAmbientOcclusion);
878876
#endif
879877

880-
#if defined(_REALTIME_MAIN_LIGHT_ON) // (ASG)
881-
MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI);
882-
#endif
883-
878+
// MixRealtimeAndBakedGI(mainLight, inputData.normalWS, inputData.bakedGI);
884879
half3 giDirectionWS = SafeNormalize(inputData.bakedGI_directionWS);
885880
half3 gi = GlobalIllumination(brdfData, brdfLightmaps, brdfDataClearCoat, surfaceData.clearCoatMask,
886881
inputData.bakedGI, giDirectionWS, surfaceData.occlusion,
887882
inputData.normalWS, inputData.viewDirectionWS);
888883
half3 color = half3(0,0,0);
889884
color += gi;
890-
891-
#if defined(_REALTIME_MAIN_LIGHT_ON) // (ASG)
892-
color += LightingPhysicallyBased(brdfData, brdfDataClearCoat,
893-
mainLight,
894-
inputData.normalWS, inputData.viewDirectionWS,
895-
surfaceData.clearCoatMask, specularHighlightsOff);
896-
#endif
885+
// color += LightingPhysicallyBased(brdfData, brdfDataClearCoat,
886+
// mainLight,
887+
// inputData.normalWS, inputData.viewDirectionWS,
888+
// surfaceData.clearCoatMask, specularHighlightsOff);
897889

898890
#ifdef _ADDITIONAL_LIGHTS
899891
uint pixelLightCount = GetAdditionalLightsCount();

com.unity.render-pipelines.universal/Shaders/Lit.shader

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ Shader "Universal Render Pipeline/Lit"
2323
[ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0
2424
[ToggleOff] _EnvironmentReflections("Environment Reflections", Float) = 1.0
2525

26-
// (ASG)
27-
[Toggle] _RealtimeMainLight("Real-time Main Light", Float) = 0
28-
2926
_BumpScale("Scale", Float) = 1.0
3027
_BumpMap("Normal Map", 2D) = "bump" {}
3128

@@ -118,7 +115,6 @@ Shader "Universal Render Pipeline/Lit"
118115
#pragma multi_compile _ _COLOR_TRANSFORM_IN_FORWARD
119116
// If HDR_GRADING is on, then the tonemap algorithm is encoded in the HDR LUT
120117
#pragma multi_compile _ _HDR_GRADING _TONEMAP_ACES _TONEMAP_NEUTRAL
121-
#pragma shader_feature_local_fragment _REALTIME_MAIN_LIGHT_ON
122118

123119
// -------------------------------------
124120
// Universal Pipeline keywords
@@ -408,7 +404,6 @@ Shader "Universal Render Pipeline/Lit"
408404
#pragma multi_compile _ _COLOR_TRANSFORM_IN_FORWARD
409405
// If HDR_GRADING is on, then the tonemap algorithm is encoded in the HDR LUT
410406
#pragma multi_compile _ _HDR_GRADING _TONEMAP_ACES _TONEMAP_NEUTRAL
411-
#pragma shader_feature_local_fragment _REALTIME_MAIN_LIGHT_ON
412407

413408
// -------------------------------------
414409
// Universal Pipeline keywords

0 commit comments

Comments
 (0)