Skip to content

Hide light shadow near plane gizmo when shadows are disabled #3114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed regression in Wizard that not fix runtime ressource anymore (case 1287627)
- Fixed error in Depth Of Field near radius blur calculation (case 1306228).
- Fixed a reload bug when using objects from the scene in the lookdev (case 1300916).
- Fixed light gizmo showing shadow near plane when shadows are disabled.

### Changed
- Change the source value for the ray tracing frame index iterator from m_FrameCount to the camera frame count (case 1301356).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ static Vector4 DrawOrthoFrustumHandle(Vector4 widthHeightMaxRangeMinRange, bool
public static void DrawHandles(HDAdditionalLightData additionalData, Editor owner)
{
Light light = additionalData.legacyLight;
float shadowNearPlane = light.shadows != LightShadows.None ? additionalData.shadowNearPlane : 0.0f;

Color wireframeColorAbove = (owner as HDLightEditor).legacyLightColor;
Color handleColorAbove = GetLightHandleColor(wireframeColorAbove);
Expand All @@ -550,10 +551,10 @@ public static void DrawHandles(HDAdditionalLightData additionalData, Editor owne
Vector3 outterAngleInnerAngleRange = new Vector3(light.spotAngle, light.spotAngle * additionalData.innerSpotPercent01, light.range);
Handles.zTest = UnityEngine.Rendering.CompareFunction.Greater;
Handles.color = wireframeColorBehind;
DrawSpotlightWireframe(outterAngleInnerAngleRange, additionalData.shadowNearPlane);
DrawSpotlightWireframe(outterAngleInnerAngleRange, shadowNearPlane);
Handles.zTest = UnityEngine.Rendering.CompareFunction.LessEqual;
Handles.color = wireframeColorAbove;
DrawSpotlightWireframe(outterAngleInnerAngleRange, additionalData.shadowNearPlane);
DrawSpotlightWireframe(outterAngleInnerAngleRange, shadowNearPlane);
EditorGUI.BeginChangeCheck();
Handles.zTest = UnityEngine.Rendering.CompareFunction.Greater;
Handles.color = handleColorBehind;
Expand All @@ -578,10 +579,10 @@ public static void DrawHandles(HDAdditionalLightData additionalData, Editor owne
Vector4 aspectFovMaxRangeMinRange = new Vector4(additionalData.aspectRatio, light.spotAngle, light.range);
Handles.zTest = UnityEngine.Rendering.CompareFunction.Greater;
Handles.color = wireframeColorBehind;
DrawSpherePortionWireframe(aspectFovMaxRangeMinRange, additionalData.shadowNearPlane);
DrawSpherePortionWireframe(aspectFovMaxRangeMinRange, shadowNearPlane);
Handles.zTest = UnityEngine.Rendering.CompareFunction.LessEqual;
Handles.color = wireframeColorAbove;
DrawSpherePortionWireframe(aspectFovMaxRangeMinRange, additionalData.shadowNearPlane);
DrawSpherePortionWireframe(aspectFovMaxRangeMinRange, shadowNearPlane);
EditorGUI.BeginChangeCheck();
Handles.zTest = UnityEngine.Rendering.CompareFunction.Greater;
Handles.color = handleColorBehind;
Expand All @@ -606,10 +607,10 @@ public static void DrawHandles(HDAdditionalLightData additionalData, Editor owne
Vector4 widthHeightMaxRangeMinRange = new Vector4(additionalData.shapeWidth, additionalData.shapeHeight, light.range);
Handles.zTest = UnityEngine.Rendering.CompareFunction.Greater;
Handles.color = wireframeColorBehind;
DrawOrthoFrustumWireframe(widthHeightMaxRangeMinRange, additionalData.shadowNearPlane);
DrawOrthoFrustumWireframe(widthHeightMaxRangeMinRange, shadowNearPlane);
Handles.zTest = UnityEngine.Rendering.CompareFunction.LessEqual;
Handles.color = wireframeColorAbove;
DrawOrthoFrustumWireframe(widthHeightMaxRangeMinRange, additionalData.shadowNearPlane);
DrawOrthoFrustumWireframe(widthHeightMaxRangeMinRange, shadowNearPlane);
EditorGUI.BeginChangeCheck();
Handles.zTest = UnityEngine.Rendering.CompareFunction.Greater;
Handles.color = handleColorBehind;
Expand Down