Skip to content
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

View Space Lighting Tool #2691

Merged
merged 77 commits into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
d12f748
first commit
skhiat Nov 12, 2020
0643310
Adding UI Angles
skhiat Nov 16, 2020
68b4760
Backup
skhiat Nov 18, 2020
ea82a50
Test Version
skhiat Nov 18, 2020
fcac70c
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
skhiat Nov 19, 2020
1840ba5
Fix undocumented
skhiat Nov 19, 2020
15e34c1
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
skhiat Nov 19, 2020
614af80
Add Change Log & Doc
skhiat Nov 20, 2020
7902c81
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
skhiat Nov 20, 2020
b5d1f8a
Fix formating
skhiat Nov 20, 2020
539adf1
Updated images and manual doc
JordanL8 Nov 20, 2020
6223990
Added .md extensions to toc links
JordanL8 Nov 20, 2020
fd2515b
Improve API Doc
skhiat Nov 23, 2020
dc7d135
Merge branch 'HDRP/ViewSpaceLightingTool' of github.com:Unity-Technol…
skhiat Nov 23, 2020
5ae23b2
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
skhiat Nov 23, 2020
af325cc
Improves API Doc
skhiat Nov 23, 2020
55fed55
Improve the API Doc of ClickAction.cs
skhiat Nov 23, 2020
e5fb7ee
Updated documentation for CommandAction and made small tweaks to Clic…
JordanL8 Nov 23, 2020
d6499d0
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
skhiat Nov 23, 2020
a27e852
Merge branch 'HDRP/ViewSpaceLightingTool' of github.com:Unity-Technol…
skhiat Nov 23, 2020
25db119
Updated control docs and find and replace for gui state
JordanL8 Nov 23, 2020
46ab466
Merge branch 'HDRP/ViewSpaceLightingTool' of https://github.com/Unity…
JordanL8 Nov 23, 2020
42d5135
Doc review pass on DefaultControl, GenericControl, GenericDefaultCont…
JordanL8 Nov 23, 2020
3a85449
Improve UI
skhiat Nov 23, 2020
5848a91
Merge branch 'HDRP/ViewSpaceLightingTool' of github.com:Unity-Technol…
skhiat Nov 23, 2020
80887f3
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
skhiat Nov 23, 2020
a5b34f2
Update UI to have dropDown instead of toggle with boolean
skhiat Nov 24, 2020
02415e1
Reviewed GUIState
JordanL8 Nov 24, 2020
2e1d340
Reviewed GUISystem
JordanL8 Nov 24, 2020
f74aa0b
Reviewed handle manipulator
JordanL8 Nov 24, 2020
2eeac5f
Reviewed GUIState, HoveredControlAction, and IGUIState.
JordanL8 Nov 24, 2020
3940874
Reviewed LayoutData and SliderAction
JordanL8 Nov 24, 2020
11d857f
Change UI & doc
skhiat Nov 24, 2020
8111b05
Merge branch 'HDRP/ViewSpaceLightingTool' of github.com:Unity-Technol…
skhiat Nov 24, 2020
5f269b5
Removed interface references
JordanL8 Nov 24, 2020
25941d6
Merge branch 'HDRP/ViewSpaceLightingTool' of https://github.com/Unity…
JordanL8 Nov 24, 2020
4c93ef9
Update View-Lighting-Tool.md
JordanL8 Nov 24, 2020
cf348a1
Fix rounding issue
skhiat Nov 24, 2020
d0d0ca3
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
skhiat Nov 24, 2020
8d046f8
Fix color scheme (version 1.)
skhiat Nov 24, 2020
fd90c5e
Reviewed LightAnchror.cs
JordanL8 Nov 26, 2020
045bcd3
Reviewed LightAnchror.cs
JordanL8 Nov 26, 2020
fc3ec5c
Remove dependencies to GUIFramework & rename variables
skhiat Nov 30, 2020
1061638
Merge branch 'master' of https://github.com/Unity-Technologies/Graphi…
skhiat Nov 30, 2020
0e1ab7e
Update style dark & light mode
skhiat Nov 30, 2020
b73c386
Add new mode (wip) for Light Anchor
skhiat Dec 1, 2020
e5e22e3
Merge branch 'master' of https://github.com/Unity-Technologies/Graphi…
skhiat Dec 1, 2020
ee6fef9
Remove target with Anchor
skhiat Dec 1, 2020
2164d1b
Merge branch 'master' of https://github.com/Unity-Technologies/Graphi…
skhiat Dec 2, 2020
1f98b55
Fix formating
skhiat Dec 2, 2020
25a76aa
UX Pass + update image doc related to this change
skhiat Dec 4, 2020
f5d3679
Cleanup & remove unused functions
skhiat Dec 18, 2020
164be65
Cleanup & document behavior
skhiat Dec 18, 2020
26658cc
Proper message when setup is not done properly
skhiat Dec 18, 2020
01d0f9f
Fix missing icon
skhiat Dec 18, 2020
507a6b8
Fix doc url & tooltip
skhiat Dec 18, 2020
03f9a3c
Merge branch 'master' of https://github.com/Unity-Technologies/Graphi…
skhiat Dec 21, 2020
3b22b1c
Merge branch 'master' of https://github.com/Unity-Technologies/Graphi…
skhiat Jan 5, 2021
65c72eb
Rename axis
skhiat Jan 5, 2021
bc7ea7a
Merge branch 'master' of github.cds.internal.unity3d.com:unity/Graphi…
skhiat Jan 5, 2021
fb25274
Fix Undo Roll
skhiat Jan 5, 2021
b9ec74d
Fix light anchor flickering
skhiat Jan 5, 2021
b94db02
Fix missing icon
skhiat Jan 5, 2021
ee85895
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
skhiat Jan 6, 2021
b80c477
delete file
skhiat Jan 6, 2021
e3ffd3d
Fix edit euler angle by input field
skhiat Jan 6, 2021
a2b11d5
Fix build player
skhiat Jan 6, 2021
d6442f8
Disable multi-edit
skhiat Jan 6, 2021
dd04ac3
Remove unused function
skhiat Jan 12, 2021
a1bb9f9
Replace new GUIContent by EditorGUIUtility.TrTextContent
skhiat Jan 12, 2021
04f3724
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
skhiat Jan 12, 2021
ee0a29d
Replace new GUIContent to EditorGUIUtility.TrTextContent
skhiat Jan 12, 2021
a98b18d
Build fix & add tool top description for buttons common
skhiat Jan 12, 2021
335ee0a
Fix Undo UI for roll
skhiat Jan 12, 2021
7c01b3d
Fix build
skhiat Jan 13, 2021
5425163
Merge branch 'master' of github.com:Unity-Technologies/Graphics into …
skhiat Jan 13, 2021
696cb80
Fix Undo for Roll
skhiat Jan 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions com.unity.render-pipelines.core/CHANGELOG.md
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
Version Updated
The version number for this package has increased due to a version update of a related graphics package.

### Added
- New View Lighting Tool, a component which allow to setup light in the camera space

## [10.2.0] - 2020-10-19

Version Updated
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,8 +1,8 @@
* [SRP Core](index)
* [SRP Core](index.md)
skhiat marked this conversation as resolved.
Show resolved Hide resolved

* Camera components
* [Free Camera](Free-Camera)
* [Camera Switcher](Camera-Switcher)
* [Free Camera](Free-Camera.md)
* [Camera Switcher](Camera-Switcher.md)

* [Render Graph](render-graph-system.md)
* [Benefits of the render graph system](render-graph-benefits.md)
Expand All @@ -13,7 +13,7 @@
* [RTHandle fundamentals](rthandle-system-fundamentals.md)
* [Using the RTHandle system](rthandle-system-using.md)


* [Look Dev](Look-Dev)
* [Look Dev](Look-Dev.md)
* [Environment Library](Look-Dev-Environment-Library.md)

* [Environment Library](Look-Dev-Environment-Library)
* [View Lighting Tool](view-lighting-tool.md)
@@ -0,0 +1,24 @@
## View Lighting tool

The View Lighting tool allows you to set up lighting in camera space. It uses the main Camera (the one that renders to the Game view) to set the orientation of the Light using spherical coordinates, and it uses a target and distance to set the position of the Light.

Since the View Lighting tool uses camera-space, it is especially useful when setting up lighting for cinematics.

## Using the View Lighting tool

The View Lighting tool uses the Light Anchor component to position and orient the Light. When this component is attached to a Light, you can use a custom Scene view gizmo to position the Light, and use the component's Inspector to orient the Light.

To get started with the View Lighting tool:

1. In the Scene view or Hierarchy, select a GameObject with an attached Light component.
2. In the Inspector click **Add Component > Rendering > Light Anchor**.
3. To use the Light Anchor gizmo, click the custom tool button then, in the drop-down, click **Light Anchor**.<br/>![](Images/view-lighting-tool-gizmo.png)
4. You can now use the gizmo to move the Light's target. This gizmo also shows you a visualization of the yaw, pitch, and roll from the target to the Light. To change the yaw, pitch, and roll, as well as the distance from the Light to the target, see [Light Anchor](#light-anchor).

### Light Anchor

The Light Anchor controls the Light's orientation and the distance it is from the target position. **Yaw** and **Pitch** control the orientation and **Distance** controls the distance between the Light and the target. If the Light has a cookie or uses [IES](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest/index.html?subfolder=/manual/IES-Profile.html), **Roll** controls the orientation of the cookie or IES profile.

![](Images/view-lighting-tool-light-anchor.png)

The Light Anchor component also includes a list of **Presets** that you can use to quickly set the Light's orientation relative to the Game view.

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

@@ -0,0 +1,81 @@
using System;
using UnityEngine;

namespace UnityEditor
{
/// <summary>
/// Represents an Action to process when the user clicks a particular mouse button a certain number of times.
/// </summary>
public class ClickAction : HoveredControlAction
{
private int m_Button;
private bool m_UseEvent;
/// <summary>
/// The number of button clicks required to satisfy the trigger condition
/// </summary>
public int clickCount = 1;
/// <summary>
/// The Action to execute when the user satisfies the trigger condition.
/// </summary>
public Action<IGUIState, Control> onClick;
private int m_ClickCounter = 0;

/// <summary>
/// Initializes and returns an instance of ClickAction
/// </summary>
/// <param name="control">Current control</param>
/// <param name="button">The mouse button to check for.</param>
/// <param name="useEvent">Whether to Use the current event after the trigger condition has been met.</param>
public ClickAction(Control control, int button, bool useEvent = true) : base(control)
{
m_Button = button;
m_UseEvent = useEvent;
}

/// <summary>
/// Checks to see if the trigger condition has been met or not.
/// </summary>
/// <param name="guiState">The current state of the custom editor.</param>
/// <returns>Returns `true` if the trigger condition has been met. Otherwise, returns false.</returns>
protected override bool GetTriggerCondition(IGUIState guiState)
{
if (guiState.mouseButton == m_Button && guiState.eventType == EventType.MouseDown)
{
if (guiState.clickCount == 1)
m_ClickCounter = 0;

++m_ClickCounter;

if (m_ClickCounter == clickCount)
return true;
}

return false;
}

/// <summary>
/// Calls the methods in its invocation list when the trigger conditions are met.
/// </summary>
/// <param name="guiState">The current state of the custom editor.</param>
protected override void OnTrigger(IGUIState guiState)
{
base.OnTrigger(guiState);

if (onClick != null)
onClick(guiState, hoveredControl);

if (m_UseEvent)
guiState.UseEvent();
}

/// <summary>
/// Checks to see if the finish condition has been met or not. For a ClickAction, this is always `true`.
/// </summary>
/// <param name="guiState">The current state of the custom editor.</param>
/// <returns>Returns `true`.</returns>
protected override bool GetFinishCondition(IGUIState guiState)
{
return true;
}
}
}

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

@@ -0,0 +1,70 @@
using System;
using UnityEngine;

namespace UnityEditor
{
/// <summary>
/// Represents an Action to process when the custom editor validates a command.
/// </summary>
public class CommandAction : GUIAction
{
private string m_CommandName;

/// <summary>
/// The Action to execute.
/// </summary>
public Action<IGUIState> onCommand;

/// <summary>
/// Initializes and returns an instance of CommandAction
/// </summary>
/// <param name="commandName">The name of the command. When the custom editor validates a command with this name, it triggers the action.</param>
public CommandAction(string commandName)
{
m_CommandName = commandName;
}

/// <summary>
/// Checks to see if the trigger condition has been met or not.
/// </summary>
/// <param name="guiState">The current state of the custom editor.</param>
/// <returns>Returns `true` if the trigger condition has been met. Otherwise, returns `false`.</returns>
protected override bool GetTriggerCondition(IGUIState guiState)
{
if (guiState.eventType == EventType.ValidateCommand && guiState.commandName == m_CommandName)
{
guiState.UseEvent();
return true;
}

return false;
}

/// <summary>
/// Checks to see if the finish condition has been met or not.
/// </summary>
/// <param name="guiState">The current state of the custom editor.</param>
/// <returns>Returns `true` if the trigger condition is finished. Otherwise, returns `false`.</returns>
protected override bool GetFinishCondition(IGUIState guiState)
{
if (guiState.eventType == EventType.ExecuteCommand && guiState.commandName == m_CommandName)
{
guiState.UseEvent();

return true;
}

return false;
}

/// <summary>
/// Calls the methods in its invocation list when the finish condition is met.
/// </summary>
/// <param name="guiState">The current state of the custom editor.</param>
protected override void OnFinish(IGUIState guiState)
{
if (onCommand != null)
onCommand(guiState);
}
}
}

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