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

Add Light Unit Slider (Light Intensity, Temperature, Exposure) #1691

Merged
merged 66 commits into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
c50c090
Initial commit of light unit slider drawer
johnpars Aug 4, 2020
ed31fbb
missing meta file
johnpars Aug 4, 2020
ffdf772
First pass slider + icon draw, rect management
johnpars Aug 4, 2020
4432994
Functionality for slider markers with tooltip, and light unit slider …
johnpars Aug 6, 2020
950dc1c
Move drawing functionality into the light unit levels, to handle the …
johnpars Aug 6, 2020
ee928af
Add the indentation disable scope
johnpars Aug 6, 2020
e0501ae
Horizontally clamp the markers onto the slider
johnpars Aug 6, 2020
5472b5a
Move to light unit directory and rename
johnpars Aug 6, 2020
8d44351
Begin moving light unit values into a table
johnpars Aug 7, 2020
5ecf620
Move light unit slider values into tables and construct the slider wi…
johnpars Aug 7, 2020
2417dee
Swap in the updated icons from the light unit sheet.
johnpars Aug 24, 2020
f642d7d
Add slider thumb tooltip
johnpars Aug 24, 2020
27f36fd
Add tooltip formatting to display abbreviated level values
johnpars Aug 24, 2020
83489d8
Add the light unit to the slider tooltips
johnpars Aug 25, 2020
ecbef13
Add missing meta file
johnpars Aug 25, 2020
f1dfdcb
Update editor resources for light unit icons
johnpars Aug 25, 2020
728b16b
General cleanup of light unit slider functionality
johnpars Aug 25, 2020
716b09c
Scale up the marker tooltip for easier disovery. Display caution value
johnpars Aug 25, 2020
7de2d01
Initial integration of light unit slider into light UI for light inte…
johnpars Aug 25, 2020
694767d
Merge latest HDRP/staging
johnpars Aug 27, 2020
692f287
Fix light unit marker clamping
johnpars Aug 27, 2020
65f7a7a
Add to changelog
johnpars Aug 27, 2020
1068fb8
Initial implementation of exponential slider
johnpars Sep 2, 2020
bfba82e
Fill in the remaining light value tables, implement light unit slider…
johnpars Sep 3, 2020
2b974d5
Fix the draw exposure slider to read from the exposure descriptor
johnpars Sep 8, 2020
a651d65
Initial implementation of temperature slider
johnpars Sep 10, 2020
1362f35
Switch to using indent scopes
johnpars Sep 10, 2020
891df86
Fix linear mapping from value range to slider range (account for < 0)
johnpars Sep 10, 2020
e6d4123
No markers for temperature slider
johnpars Sep 10, 2020
5ab14b0
Initial integration of light unit temperature slider into HD light UI
johnpars Sep 10, 2020
b547b6e
Fix incorrect temperature tooltip
johnpars Sep 10, 2020
b7ca6e0
Add comments, comply with code standard, refactor light unit tooltip …
johnpars Sep 11, 2020
c54798d
Change the color temperature toggle into the popup dropdown
johnpars Sep 11, 2020
736503e
Refactor icon loading to support editor skinning (dark/light mode)
johnpars Sep 11, 2020
16ebe5e
Move the final light unit icons into the main directory, and remove t…
johnpars Sep 11, 2020
dc6bef4
Undo un-intentional push of assembly friending to local dev package
johnpars Sep 11, 2020
e5e03b6
Fix marker colors with respect to editor theme
johnpars Sep 11, 2020
980a792
Initial implementation piecewise light unit slider
johnpars Sep 14, 2020
f18f35d
Add interactivity to piecewise slider
johnpars Sep 14, 2020
e277b02
Ensure that the current function piece is being used when moving the …
johnpars Sep 14, 2020
7a5401c
Handle the out of bounds piecewise slider case
johnpars Sep 14, 2020
a146be3
Use the piecewise slider for all light intensity units and exposure
johnpars Sep 14, 2020
667f283
Improve light unit tooltip, improve caution icon quality
johnpars Sep 14, 2020
d9d0b2d
Initial integration of light unit slider into exposure volume component
johnpars Sep 14, 2020
c78f8c3
Improve the drawing of slider in the exposure volume
johnpars Sep 14, 2020
a9c3846
Initial implementation of custom slider range distributions (for Lux)…
johnpars Sep 15, 2020
8481837
Change min exposure range to -5, and clamp the value to slider to 0-1
johnpars Sep 15, 2020
38543a9
Update Lux tooltips
johnpars Sep 15, 2020
5d9af9c
Update exposure tooltips
johnpars Sep 15, 2020
949b54f
Fix exposure slider to allow horizontal scrolling in the text field
johnpars Sep 15, 2020
52ba1a2
Add clamp support for temperature slider
johnpars Sep 15, 2020
24f61b3
Update temperature icon to the one in the table
johnpars Sep 15, 2020
b3d5ad9
Add the above/below caution tooltip for exposure
johnpars Sep 15, 2020
ac2f677
Update lite theme color for markers
johnpars Sep 15, 2020
611a937
Square off the marker shape
johnpars Sep 15, 2020
2963f35
Change the caution value to the upper limit of the value ranges
johnpars Sep 16, 2020
9a1468d
Enable filter/temperature mode by default for all lights
johnpars Sep 16, 2020
91fb8e6
Initial refactor of light intensity slider to use lumens internally
johnpars Sep 16, 2020
34df675
Directly use vector range as key into the piece-wise function map
johnpars Sep 16, 2020
77a7804
Simplify piece-wise function evaluation
johnpars Sep 16, 2020
738b5ce
String interpolation for tooltip
johnpars Sep 16, 2020
b0948ac
Merge latest HDRP/staging
johnpars Sep 17, 2020
e2c05b8
Implement various improvements to conform to code standards, add comm…
johnpars Sep 17, 2020
7cc0030
Remove the abbreviation for light unit value tooltip, show the full t…
johnpars Sep 17, 2020
57daf9e
Improve the internal lumen conversion to properly handle spot reflect…
johnpars Sep 18, 2020
7d1bfbe
Update changelog
johnpars Sep 18, 2020
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
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 @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added option for 11-11-10 format for cube reflection probes.
- Added an optional check in the HDRP DXR Wizard to verify 64 bits target architecture
- Added option to display timing stats in the debug menu as an average over 1 second.
- Added a light unit slider to provide users more context when authoring physically based values.

### Fixed
- Fixed several issues with physically-based DoF (TAA ghosting of the CoC buffer, smooth layer transitions, etc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ sealed class Styles
public readonly GUIContent lightBounceIntensity = new GUIContent("Indirect Multiplier", "Controls the intensity of the indirect light this Light contributes to the Scene. A value of 0 with a Realtime Light causes HDRP to remove it from realtime global illumination. A value of 0 for Baked and Mixed Lights cause them to no longer emit indirect lighting. This has no effect if you disable both Realtime and Baked global illumination.");
public readonly GUIContent indirectBounceShadowWarning = new GUIContent("HDRP does not support real-time indirect bounce shadowing for Spot and Point lights.");
public readonly GUIContent color = new GUIContent("Color", "Specifies the color this Light emits.");
public readonly GUIContent useColorTemperature = new GUIContent("Color Temperature", "When enabled, HDRP uses Temperature mode for this Light's color.");
public readonly GUIContent lightAppearance = new GUIContent("Light Appearance", "Specifies the mode for how HDRP calculates this Light's color.");
public readonly GUIContent colorFilter = new GUIContent("Filter", "Specifies a color which tints the Light source.");
public readonly GUIContent colorTemperature = new GUIContent("Temperature", "Specifies a temperature (in Kelvin) HDRP uses to correlate a color for the Light. For reference, White is 6500K.");
public readonly GUIContent areaLightCookie = new GUIContent("Cookie", "Cookie mask currently assigned to the area light.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ enum AdvancedMode

readonly static ExpandedState<Expandable, Light> k_ExpandedState = new ExpandedState<Expandable, Light>(~(-1), "HDRP");

readonly static LightUnitSliderUIDrawer k_LightUnitSliderUIDrawer = new LightUnitSliderUIDrawer();

public static readonly CED.IDrawer Inspector;

static bool GetAdvanced(AdvancedMode mask, SerializedHDLight serialized, Editor owner)
Expand Down Expand Up @@ -511,9 +513,13 @@ static void DrawLightIntensityUnitPopup(Rect rect, SerializedHDLight serialized,
}
}

static void ConvertLightIntensity(LightUnit oldLightUnit, LightUnit newLightUnit, SerializedHDLight serialized, Editor owner)
internal static void ConvertLightIntensity(LightUnit oldLightUnit, LightUnit newLightUnit, SerializedHDLight serialized, Editor owner)
{
serialized.intensity.floatValue = ConvertLightIntensity(oldLightUnit, newLightUnit, serialized, owner, serialized.intensity.floatValue);
}

internal static float ConvertLightIntensity(LightUnit oldLightUnit, LightUnit newLightUnit, SerializedHDLight serialized, Editor owner, float intensity)
{
float intensity = serialized.intensity.floatValue;
Light light = (Light)owner.target;

// For punctual lights
Expand Down Expand Up @@ -577,7 +583,7 @@ static void ConvertLightIntensity(LightUnit oldLightUnit, LightUnit newLightUnit
break; // do nothing
}

serialized.intensity.floatValue = intensity;
return intensity;
}

static void DrawLightIntensityGUILayout(SerializedHDLight serialized, Editor owner)
Expand All @@ -591,19 +597,11 @@ static void DrawLightIntensityGUILayout(SerializedHDLight serialized, Editor own
float indent = k_IndentPerLevel * EditorGUI.indentLevel;

Rect lineRect = EditorGUILayout.GetControlRect();
Rect valueRect = lineRect;
Rect labelRect = lineRect;
labelRect.width = EditorGUIUtility.labelWidth;

// We use PropertyField to draw the value to keep the handle at left of the field
// This will apply the indent again thus we need to remove it time for alignment
valueRect.width += indent - k_ValueUnitSeparator - k_UnitWidth;
Rect unitRect = valueRect;
unitRect.x += valueRect.width - indent + k_ValueUnitSeparator;
unitRect.width = k_UnitWidth + .5f;

//handling of prefab overrides in a parent label
GUIContent parentLabel = s_Styles.lightIntensity;
GUIContent parentLabel = s_Styles.lightIntensity;
parentLabel = EditorGUI.BeginProperty(labelRect, parentLabel, serialized.intensity);
parentLabel = EditorGUI.BeginProperty(labelRect, parentLabel, serialized.lightUnit);
{
Expand All @@ -612,6 +610,25 @@ static void DrawLightIntensityGUILayout(SerializedHDLight serialized, Editor own
EditorGUI.EndProperty();
EditorGUI.EndProperty();

// Draw the light unit slider + icon + tooltip
Rect lightUnitSliderRect = lineRect; // TODO: Move the value and unit rects to new line
lightUnitSliderRect.x += EditorGUIUtility.labelWidth + k_ValueUnitSeparator;
lightUnitSliderRect.width -= EditorGUIUtility.labelWidth + k_ValueUnitSeparator;

var lightType = serialized.type;
var lightUnit = serialized.lightUnit.GetEnumValue<LightUnit>();
k_LightUnitSliderUIDrawer.Draw(lightType, lightUnit, serialized.intensity, lightUnitSliderRect, serialized, owner);

// We use PropertyField to draw the value to keep the handle at left of the field
// This will apply the indent again thus we need to remove it time for alignment
Rect valueRect = EditorGUILayout.GetControlRect();
labelRect.width = EditorGUIUtility.labelWidth;
valueRect.width += indent - k_ValueUnitSeparator - k_UnitWidth;
Rect unitRect = valueRect;
unitRect.x += valueRect.width - indent + k_ValueUnitSeparator;
unitRect.width = k_UnitWidth + .5f;

// Draw the unit textfield
EditorGUI.PropertyField(valueRect, serialized.intensity, s_Styles.empty);
DrawLightIntensityUnitPopup(unitRect, serialized, owner);

Expand All @@ -627,12 +644,43 @@ static void DrawEmissionContent(SerializedHDLight serialized, Editor owner)
{
if (GraphicsSettings.lightsUseLinearIntensity && GraphicsSettings.lightsUseColorTemperature)
{
EditorGUILayout.PropertyField(serialized.settings.useColorTemperature, s_Styles.useColorTemperature);
// Use the color temperature bool to create a popup dropdown to choose between the two modes.
var colorTemperaturePopupValue = Convert.ToInt32(serialized.settings.useColorTemperature.boolValue);
var lightAppearanceOptions = new [] { "Color", "Filter and Temperature" };
colorTemperaturePopupValue = EditorGUILayout.Popup(s_Styles.lightAppearance, colorTemperaturePopupValue, lightAppearanceOptions);
serialized.settings.useColorTemperature.boolValue = Convert.ToBoolean(colorTemperaturePopupValue);

if (serialized.settings.useColorTemperature.boolValue)
{
EditorGUI.indentLevel += 1;
EditorGUILayout.PropertyField(serialized.settings.color, s_Styles.colorFilter);
SliderWithTexture(s_Styles.colorTemperature, serialized.settings.colorTemperature, serialized.settings);

// Light unit slider
const int k_ValueUnitSeparator = 2;
var lineRect = EditorGUILayout.GetControlRect();
var labelRect = lineRect;
labelRect.width = EditorGUIUtility.labelWidth;
EditorGUI.LabelField(labelRect, s_Styles.colorTemperature);

var temperatureSliderRect = lineRect;
temperatureSliderRect.x += EditorGUIUtility.labelWidth + k_ValueUnitSeparator;
temperatureSliderRect.width -= EditorGUIUtility.labelWidth + k_ValueUnitSeparator;
k_LightUnitSliderUIDrawer.DrawTemperatureSlider(serialized.settings, serialized.settings.colorTemperature, temperatureSliderRect);

// Value and unit label
// Match const defined in EditorGUI.cs
const int k_IndentPerLevel = 15;
const int k_UnitWidth = 100 + k_IndentPerLevel;
int indent = k_IndentPerLevel * EditorGUI.indentLevel;
Rect valueRect = EditorGUILayout.GetControlRect();
valueRect.width += indent - k_ValueUnitSeparator - k_UnitWidth;
Rect unitRect = valueRect;
unitRect.x += valueRect.width - indent + k_ValueUnitSeparator;
unitRect.width = k_UnitWidth + .5f;

EditorGUI.PropertyField(valueRect, serialized.settings.colorTemperature, s_Styles.empty);
EditorGUI.Popup(unitRect, 0, new[] {"Kelvin"});

EditorGUI.indentLevel -= 1;
}
else
Expand Down

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