Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
79f01d7
Improved 2023 support.
Cameron-Micka May 7, 2024
659cb08
Version bump.
Cameron-Micka May 7, 2024
76df246
Merge branch 'main' of https://github.com/microsoft/MixedReality-Grap…
Cameron-Micka May 22, 2024
5ec9853
Merge branch 'main' of https://github.com/microsoft/MixedReality-Grap…
Cameron-Micka Jul 27, 2024
376d2aa
UNITY_6000_0_OR_NEWER support.
Cameron-Micka Oct 2, 2024
301277c
Convert tabs to spaces.
Cameron-Micka Oct 3, 2024
531a303
Bump package version.
Cameron-Micka Oct 3, 2024
2f979b2
Merge branch 'main' of https://github.com/Cameron-Micka/MixedReality-…
Cameron-Micka Nov 19, 2024
9e4b4a0
Merge branch 'main' of https://github.com/microsoft/MixedReality-Grap…
Cameron-Micka Nov 19, 2024
e7443e5
Merge branch 'main' of https://github.com/microsoft/MixedReality-Grap…
Cameron-Micka Dec 2, 2024
bc4489a
Project update and remove unneeded deps.
Cameron-Micka Dec 2, 2024
62afd9d
Extra comments.
Cameron-Micka Dec 2, 2024
a06e99b
Package update.
Cameron-Micka Dec 2, 2024
25d58bf
Merge branch 'main' of https://github.com/microsoft/MixedReality-Grap…
Cameron-Micka Dec 2, 2024
04ee6d0
WIP real time area lights.
Cameron-Micka Mar 3, 2025
2cfd203
LUTs
Cameron-Micka Mar 3, 2025
4d53168
Pass in shader data.
Cameron-Micka Mar 3, 2025
0b581fd
Working real time area light in forward renderer.
Cameron-Micka Mar 3, 2025
d54cc80
Cleanup.
Cameron-Micka Mar 3, 2025
62f42b2
Remove angle.
Cameron-Micka Mar 3, 2025
6a5cfa5
Multi-light support.
Cameron-Micka Mar 3, 2025
946c206
Move to experimental.
Cameron-Micka Mar 3, 2025
30d5626
Add base color.
Cameron-Micka Mar 3, 2025
584e1c1
Light source visualization.
Cameron-Micka Mar 4, 2025
e549bba
Animation test.
Cameron-Micka Mar 4, 2025
a321dfc
WIP texture based diffuse.
Cameron-Micka Mar 4, 2025
9e54c41
Cleanup.
Cameron-Micka Mar 4, 2025
0cfbf9a
Movie area lights.
Cameron-Micka Mar 4, 2025
674a1c0
Common area light shader include.
Cameron-Micka Mar 5, 2025
7a943ee
Add shader graph example.
Cameron-Micka Mar 5, 2025
468ed7e
Merge branch 'main' of https://github.com/microsoft/MixedReality-Grap…
Cameron-Micka Mar 19, 2025
fcc312f
Cleanup wip.
Cameron-Micka Mar 19, 2025
7b3b287
Fixing artifact in area light.
Cameron-Micka Mar 19, 2025
ade9aa6
WIP abstarct filtering logic from area light.
Cameron-Micka Mar 19, 2025
20b9b5e
Improved bluring.
Cameron-Micka Mar 20, 2025
80ceb04
Optimize filter.
Cameron-Micka Mar 20, 2025
40fa98a
Remove old video.
Cameron-Micka Mar 20, 2025
0de40fd
WIP light sorting.
Cameron-Micka Mar 21, 2025
9b8e857
Better area light culling.
Cameron-Micka Mar 21, 2025
9f75ef3
Bug fixes.
Cameron-Micka Mar 24, 2025
33f5782
Turns off area light shader calculations when no lights are present.
Cameron-Micka Mar 24, 2025
34c72e0
Keyword optimizations and samples.
Cameron-Micka Mar 25, 2025
550822d
Sample improvements and bug fixes.
Cameron-Micka Mar 25, 2025
1c22264
Fix precision issues.
Cameron-Micka Mar 25, 2025
e641fb9
Make shaders a bit easier to use.
Cameron-Micka Mar 25, 2025
4884814
Spacing fixes.
Cameron-Micka Mar 25, 2025
9b497c9
Better handles.
Cameron-Micka Mar 26, 2025
cd7cb67
PR feedback.
Cameron-Micka Mar 26, 2025
68c6731
Fix typo.
Cameron-Micka Mar 26, 2025
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using UnityEditor;
using UnityEngine;

namespace Microsoft.MixedReality.GraphicsTools.Editor
{
/// <summary>
/// Improves object selection and adds a shortcut to create a configured game object and component from the game object context menu.
/// </summary>
[CustomEditor(typeof(AreaLight))]
public class AreaLightInspector : UnityEditor.Editor
{
private void OnSceneGUI()
{
AreaLight light = target as AreaLight;

if (light == null)
{
return;
}

if (light.enabled)
{
Handles.color = light.Color;
}
else
{
Handles.color = Color.gray;
}

EditorGUI.BeginChangeCheck();
Vector2 size = DrawRectHandles(light.transform.rotation, light.transform.position, light.Size);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(light, "Adjust Area Light Size");
light.Size = size;
}

// Draw the area light's normal only if it will not overlap with the current tool.
if (!((Tools.current == Tool.Move || Tools.current == Tool.Scale) && Tools.pivotRotation == PivotRotation.Local))
{
Handles.DrawLine(light.transform.position, light.transform.position + light.transform.forward);
}

Handles.color = new Color(255.0f / 255.0f, 165.0f / 255.0f, 0.0f / 255.0f); // Orange.

// Different visual representation for runtime and edit mode because runtime using CullingGroup to cull lights.
if (Application.isPlaying)
{
var bounds = light.SphereBoundsWorldSpace;
Handles.RadiusHandle(Quaternion.identity, bounds.position, bounds.radius);
}
else
{
var bounds = light.BoundsWorldSpace;
Handles.DrawWireCube(bounds.center, bounds.size);
}

if (light.CullingActive)
{
Handles.Label(light.transform.position, $"Visible: {light.IsVisible}\nDist: {light.Distance.ToString("n1")}");
}
}

private bool HasFrameBounds() { return true; }
Comment thread
Cameron-Micka marked this conversation as resolved.

private Bounds OnGetFrameBounds()
{
var light = target as AreaLight;
Debug.Assert(light != null);
return light.BoundsWorldSpace;
}

[MenuItem("GameObject/Light/Graphics Tools/Area Light")]
private static void CreateAreaLight(MenuCommand menuCommand)
{
GameObject gameObject = InspectorUtilities.CreateGameObjectFromMenu<AreaLight>(menuCommand);

if (gameObject != null)
{
gameObject.transform.position = new Vector3(0.0f, 1.0f, 0.0f);
gameObject.transform.rotation = Quaternion.Euler(0.0f, 180.0f, 0.0f);
}
}

private static float SizeSlider(Vector3 p, Vector3 d, float r)
{
Vector3 position = p + d * r;
float size = HandleUtility.GetHandleSize(position);
bool temp = GUI.changed;
GUI.changed = false;
position = Handles.Slider(position, d, size * 0.03f, Handles.DotHandleCap, 0.0f);

if (GUI.changed)
{
r = Vector3.Dot(position - p, d);
}

GUI.changed |= temp;
return r;
}
private static Color ToActiveColorSpace(Color color)
{
return (QualitySettings.activeColorSpace == ColorSpace.Linear) ? color.linear : color;
}

private static Vector2 DrawRectHandles(Quaternion rotation, Vector3 position, Vector2 size)
{
Vector3 up = rotation * Vector3.up;
Vector3 right = rotation * Vector3.right;

float halfWidth = 0.5f * size.x;
float halfHeight = 0.5f * size.y;

Vector3 topRight = position + up * halfHeight + right * halfWidth;
Vector3 bottomRight = position - up * halfHeight + right * halfWidth;
Vector3 bottomLeft = position - up * halfHeight - right * halfWidth;
Vector3 topLeft = position + up * halfHeight - right * halfWidth;

// Draw the rectangle.
Handles.DrawLine(topRight, bottomRight);
Handles.DrawLine(bottomRight, bottomLeft);
Handles.DrawLine(bottomLeft, topLeft);
Handles.DrawLine(topLeft, topRight);

// Give handles twice the alpha of the lines.
Color originalColor = Handles.color;
Color color = Handles.color;
color.a = Mathf.Clamp01(Handles.color.a * 2);
Handles.color = ToActiveColorSpace(color);

// Draw the handles.
halfHeight = SizeSlider(position, up, halfHeight);
halfHeight = SizeSlider(position, -up, halfHeight);
halfWidth = SizeSlider(position, right, halfWidth);
halfWidth = SizeSlider(position, -right, halfWidth);

size.x = Mathf.Max(0.0f, 2.0f * halfWidth);
size.y = Mathf.Max(0.0f, 2.0f * halfHeight);

Handles.color = originalColor;

return size;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ public void ApplyBlur(ref RenderTexture source, ref RenderTexture destination)
Debug.LogWarning("Null blur source texture.");
return;
}

if (useDualBlur)
{
dualBlur.ApplyBlur("AcrylicLayer" + index + "_Blur", source, settings.blurPasses);
Expand Down Expand Up @@ -409,6 +410,17 @@ public void ApplyBlur(ref RenderTexture source, ref RenderTexture destination)
}
}

public void ApplyDualBlur(ref RenderTexture source, int iterations)
{
if (source == null)
{
Debug.LogWarning("Null blur source texture.");
return;
}

dualBlur.ApplyBlur("AcrylicLayer" + index + "_Blur", source, iterations);
}

public void SetBlendSource(RenderTexture input, bool both)
{
InitRenderTexture(ref blendSource[blendSourceIndex], input.width, input.height, 0, "BlendSource");
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading