Skip to content

Fix Light overlap #444

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 6 commits into from
May 18, 2020
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
26 changes: 26 additions & 0 deletions com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,32 @@ public static bool IsSceneLightingDisabled(Camera camera)
return disabled;
}

/// <summary>
/// Returns true if the "Light Overlap" scene view draw mode is enabled.
/// </summary>
/// <param name="camera">Input camera.</param>
/// <returns>True if "Light Overlap" is enabled in the scene view associated with the input camera.</returns>
public static bool IsLightOverlapDebugEnabled(Camera camera)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing documentaoitn

{
bool enabled = false;
#if UNITY_EDITOR
if (camera.cameraType == CameraType.SceneView)
{
// Determine whether the "LightOverlap" mode is enabled for the current view.
for (int i = 0; i < UnityEditor.SceneView.sceneViews.Count; i++)
{
var sv = UnityEditor.SceneView.sceneViews[i] as UnityEditor.SceneView;
if (sv.camera == camera && sv.cameraMode.drawMode == UnityEditor.DrawCameraMode.LightOverlap)
{
enabled = true;
break;
}
}
}
#endif
return enabled;
}

#if UNITY_EDITOR
static Func<List<UnityEditor.MaterialEditor>> materialEditors;

Expand Down
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 @@ -610,6 +610,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed various multi-editing issues when changing Emission parameters.
- Fixed error when undo a Reflection Probe removal in a prefab instance. (case 1244047)
- Tentative fix for missing include in depth of field shaders.
- Fixed the light overlap scene view draw mode (wasn't working at all).

### Changed
- Improve MIP selection for decals on Transparents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@
// Tile size of this compute
#define DEBUG_LIGHT_VOLUME_TILE_SIZE 8

// The pixel radius to switch on the edge color
#define RADIUS_PIXEL_BORDER 1

// Input Runtime textures
TEXTURE2D_X_FLOAT(_DebugLightCountBuffer);
TEXTURE2D_X(_DebugColorAccumulationBuffer);

// Data used for the computation
Texture2D<float4> _ColorGradientTexture;
int _MaxDebugLightCount;
// The pixel radius to switch on the edge color
float _BorderRadius;

// output texture
RW_TEXTURE2D_X(float4, _DebugLightVolumesTexture);
Expand Down Expand Up @@ -58,9 +57,9 @@ void LightVolumeColors(uint3 dispatchThreadId : SV_DispatchThreadID, uint2 group
// Look around this pixel to check if this should be displayed as a border
float maxLightCount = lightCount;
bool isBorder = false;
for (int radiusX = -RADIUS_PIXEL_BORDER; radiusX <= RADIUS_PIXEL_BORDER; ++radiusX)
for (float radiusX = -_BorderRadius; radiusX <= _BorderRadius; ++radiusX)
{
for (int radiusY = -RADIUS_PIXEL_BORDER; radiusY <= RADIUS_PIXEL_BORDER; ++radiusY)
for (float radiusY = -_BorderRadius; radiusY <= _BorderRadius; ++radiusY)
{
// Compute the target pixel
int2 targetpixel = int2((uint)currentPixelCoordinate.x + radiusX, (uint)currentPixelCoordinate.y + radiusY);
Expand Down
Loading