Skip to content

Commit

Permalink
com.unity.render-pipelines.core@12.0.0 in Unity 2021.2.0a17
Browse files Browse the repository at this point in the history
## [12.0.0] - 2021-01-11

### Changed
- ClearFlag.Depth does not implicitely clear stencil anymore. ClearFlag.Stencil added.
- The RTHandleSystem no longer requires a specific number of sample for MSAA textures. Number of samples can be chosen independently for all textures.

### Fixed
- Fixed missing warning UI about Projector component being unsupported (case 1300327).
- Fixed the display name of a Volume Parameter when is defined the attribute InspectorName
- Calculating correct rtHandleScale by considering the possible pixel rounding when DRS is on
- Problem on domain reload of Volume Parameter Ranges and UI values
- Fixed Right Align of additional properties on Volume Components Editors
- Fixed normal bias field of reference volume being wrong until the profile UI was displayed.
- Fixed L2 for Probe Volumes.
- Fixed assertion on compression of L1 coefficients for Probe Volume.

### Added
- Support for the PlayStation 5 platform has been added.
- Support for additional properties for Volume Components without custom editor
- Calculating correct rtHandleScale by considering the possible pixel rounding when DRS is on
- Support for the PlayStation 5 platform has been added.
- Support for the XboxSeries platform has been added.
- Added Editor window that allow showing an icon to browse the documentation
- New method DrawHeaders for VolumeComponentsEditors
- Unification of Material Editor Headers Scopes
- New API functions with no side effects in DynamicResolutionHandler, to retrieve resolved drs scale and to apply DRS on a size.
- Added a blitter for the SRPs.
- Added 2D texture atlases.
- New methods on CoreEditorDrawers, to allow adding a label on a group before rendering the internal drawers
- Method to generate a Texture2D of 1x1 with a plain color
- Red, Green, Blue Texture2D on CoreEditorStyles
- New API in DynamicResolutionHandler to handle multicamera rendering for hardware mode. Changing cameras and resetting scaling per camera should be safe.
- Added SpeedTree8MaterialUpgrader, which provides utilities for upgrading and importing SpeedTree 8 assets to scriptable render pipelines.
- Adding documentation links to Light Sections

### Changed
- Changed Window/Render Pipeline/Render Pipeline Debug to Window/Rendering/Render Pipeline Debugger
- Changed Window/Render Pipeline/Look Dev to Window/Analysis/Look Dev
- Changed Window/Render Pipeline/Render Graph Viewer to Window/Analysis/Render Graph Viewer
- Changed Window/Render Pipeline/Graphics Compositor to Window/Rendering/Graphics Compositor
- Volume Gizmo Color setting is now under Colors->Scene->Volume Gizmo
- Volume Gizmo alpha changed from 0.5 to 0.125
- Moved Edit/Render Pipeline/Generate Shader Includes to Edit/Rendering/Generate Shader Includes
- Moved Assets/Create/LookDev/Environment Library to Assets/Create/Rendering/Environment Library (Look Dev)
- Changed Nintendo Switch specific half float fixes in color conversion routines to all platforms.
- Improved load asset time for probe volumes.

### Added
- Added class for drawing shadow cascades `UnityEditor.Rendering.ShadowCascadeGUI.DrawShadowCascades`.
  • Loading branch information
Unity Technologies committed May 8, 2021
1 parent ed00aa4 commit 3a8d060
Show file tree
Hide file tree
Showing 59 changed files with 3,799 additions and 1,826 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed
- ClearFlag.Depth does not implicitely clear stencil anymore. ClearFlag.Stencil added.
- The RTHandleSystem no longer requires a specific number of sample for MSAA textures. Number of samples can be chosen independently for all textures.

### Fixed
- Fixed missing warning UI about Projector component being unsupported (case 1300327).
Expand Down Expand Up @@ -35,6 +36,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Method to generate a Texture2D of 1x1 with a plain color
- Red, Green, Blue Texture2D on CoreEditorStyles
- New API in DynamicResolutionHandler to handle multicamera rendering for hardware mode. Changing cameras and resetting scaling per camera should be safe.
- Added SpeedTree8MaterialUpgrader, which provides utilities for upgrading and importing SpeedTree 8 assets to scriptable render pipelines.
- Adding documentation links to Light Sections

### Changed
- Changed Window/Render Pipeline/Render Pipeline Debug to Window/Rendering/Render Pipeline Debugger
Expand All @@ -46,6 +49,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Moved Edit/Render Pipeline/Generate Shader Includes to Edit/Rendering/Generate Shader Includes
- Moved Assets/Create/LookDev/Environment Library to Assets/Create/Rendering/Environment Library (Look Dev)
- Changed Nintendo Switch specific half float fixes in color conversion routines to all platforms.
- Improved load asset time for probe volumes.

### Added
- Added class for drawing shadow cascades `UnityEditor.Rendering.ShadowCascadeGUI.DrawShadowCascades`.
Expand Down
2 changes: 2 additions & 0 deletions Documentation~/TableOfContents.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
* [SRP Core](index.md)
* [What's new](whats-new.md)
* [12](whats-new-12.md)
* Camera components
* [Free Camera](Free-Camera.md)
* [Camera Switcher](Camera-Switcher.md)
Expand Down
10 changes: 4 additions & 6 deletions Documentation~/rthandle-system-using.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ All operations related to `RTHandles` require an instance of the `RTHandleSystem

```c#
RTHandleSystem m_RTHandleSystem = new RTHandleSystem();
m_RTHandleSystem.Initialize(Screen.width, Screen.height, scaledRTsupportsMSAA: true, scaledRTMSAASamples: MSAASamples.MSAA4x);
m_RTHandleSystem.Initialize(Screen.width, Screen.height);
```
When you initialize the system, you must supply the starting resolution. The above code example uses the width and height of the screen. Because the RTHandle system only reallocates render textures when a Camera requires a resolution larger than the current maximum size, the internal `RTHandle` resolution can only increase from the value you pass in here. It is good practice to initialize this resolution to be the resolution of the main display. This means the system does not need to unnecessarily reallocate the render textures (and cause unwanted memory spikes) at the beginning of the application.

If you want to use multi-sample anti-aliasing (MSAA), you must declare the MSAA sample mode during initialization. In the example code above, the RTHandle system supports MSAA and uses the MSAA4x mode. The RTHandle system allocates all textures with the same number of samples. You can change the sample mode later, but this changes the sample mode for all automatically resized textures.

You must only call the `Initialize` function once at the beginning of the application. After this, you can use the initialized instance to allocate textures.

Because you allocate the majority of `RTHandles` from the same `RTHandleSystem` instance, the RTHandle system also provides a default global instance through the `RTHandles` static class. Rather than maintain your own instance of `RTHandleSystem`, this allows you to use the same API that you get with an instance, but not worry about the lifetime of the instance. Using the static instance, the initialization becomes this:

```c#
RTHandles.Initialize(Screen.width, Screen.height, scaledRTsupportsMSAA: true, scaledRTMSAASamples: MSAASamples.MSAA4x);
RTHandles.Initialize(Screen.width, Screen.height);
```

The code examples in the rest of this page use the default global instance.
Expand All @@ -29,7 +27,7 @@ The code examples in the rest of this page use the default global instance.
Before rendering with a Camera, you need to set the resolution the RTHandle system uses as a reference size. To do so, call the `SetReferenceSize` function.

```c#
RTHandles.SetReferenceSize(width, hight, msaaSamples);
RTHandles.SetReferenceSize(width, height);
```

Calling this function has two effects:
Expand Down Expand Up @@ -166,7 +164,7 @@ public void ReleaseBuffer(int bufferId);
In the same way that you provide the reference size for regular `RTHandleSystems`, you must do this for each instance of `BufferedRTHandleSystem`.

```c#
public void SwapAndSetReferenceSize(int width, int height, MSAASamples msaaSamples);
public void SwapAndSetReferenceSize(int width, int height);
```

This works the same way as regular RTHandleSystem but it also swaps the buffers internally so that the 0 index for `GetFrameRT` still references the current frame buffer. This slightly different way of handling Camera-specific buffers also has implications when you write shader code.
Expand Down
11 changes: 11 additions & 0 deletions Documentation~/whats-new-12.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# What's new in SRP Core version 12 / Unity 2021.2

This page contains an overview of new features, improvements, and issues resolved in version 12 of the Core Render Pipeline package, embedded in Unity 2021.2.

## Improvements

### RTHandle System and MSAA

The RTHandle System no longer requires you to specify the number of MSAA samples at initialization time. This means that you can now set the number of samples on a per texture basis, rather than for the whole system.

In practice, this means that the initialization APIs no longer require MSAA related parameters. The `Alloc` functions have replaced the `enableMSAA` parameter and enables you to explicitly set the number of samples.
7 changes: 7 additions & 0 deletions Documentation~/whats-new.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# What's new in SRP Core

This section contains information about changes to SRP Core. Each page contains a list of new features and, if relevant, a list of improvements and a list of resolved issues.

The list of pages is as follows:

- [12](whats-new-12.md)
24 changes: 22 additions & 2 deletions Editor/CoreEditorDrawers.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using UnityEditor.AnimatedValues;
using UnityEngine.Rendering;

namespace UnityEditor.Rendering
{
Expand Down Expand Up @@ -534,6 +537,20 @@ void IDrawer.Draw(TData data, Editor o)
return FoldoutGroup(title, mask, state, options, null, null, contentDrawers);
}

static string GetHelpURL<TEnum>(TEnum mask)
where TEnum : struct, IConvertible
{
var helpURLAttribute = (HelpURLAttribute)mask
.GetType()
.GetCustomAttributes(typeof(HelpURLAttribute), false)
.FirstOrDefault();

if (helpURLAttribute == null)
return string.Empty;

return $"{helpURLAttribute.URL}#{mask}";
}

// This one is private as we do not want to have unhandled advanced switch. Change it if necessary.
static IDrawer FoldoutGroup<TEnum, TState>(GUIContent title, TEnum mask, ExpandedState<TEnum, TState> state, FoldoutOption options, Enabler showAdditionalProperties, SwitchEnabler switchAdditionalProperties, params ActionDrawer[] contentDrawers)
where TEnum : struct, IConvertible
Expand All @@ -554,9 +571,12 @@ void IDrawer.Draw(TData data, Editor o)
else
{
CoreEditorUtils.DrawSplitter(isBoxed);
newExpended = CoreEditorUtils.DrawHeaderFoldout(title, expended, isBoxed,
newExpended = CoreEditorUtils.DrawHeaderFoldout(title,
expended,
isBoxed,
showAdditionalProperties == null ? (Func<bool>)null : () => showAdditionalProperties(data, owner),
switchAdditionalProperties == null ? (Action)null : () => switchAdditionalProperties(data, owner));
switchAdditionalProperties == null ? (Action)null : () => switchAdditionalProperties(data, owner),
GetHelpURL<TEnum>(mask));
}
if (newExpended ^ expended)
state[mask] = newExpended;
Expand Down
36 changes: 21 additions & 15 deletions Editor/CoreEditorUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public static bool DrawHeaderFoldout(string title, bool state, bool isBoxed = fa
/// <param name="hasMoreOptions"> [optional] Delegate used to draw the right state of the advanced button. If null, no button drawn. </param>
/// <param name="toggleMoreOptions"> [optional] Callback call when advanced button clicked. Should be used to toggle its state. </param>
/// <returns>return the state of the foldout header</returns>
public static bool DrawHeaderFoldout(GUIContent title, bool state, bool isBoxed = false, Func<bool> hasMoreOptions = null, Action toggleMoreOptions = null)
public static bool DrawHeaderFoldout(GUIContent title, bool state, bool isBoxed = false, Func<bool> hasMoreOptions = null, Action toggleMoreOptions = null, string documentationURL = "")
{
const float height = 17f;
var backgroundRect = GUILayoutUtility.GetRect(1f, height);
Expand Down Expand Up @@ -270,7 +270,7 @@ public static bool DrawHeaderFoldout(GUIContent title, bool state, bool isBoxed

// Context menu
var menuIcon = CoreEditorStyles.paneOptionsIcon;
var menuRect = new Rect(labelRect.xMax + 3f, labelRect.y + 1f, menuIcon.width, menuIcon.height);
var menuRect = new Rect(labelRect.xMax + 3f, labelRect.y + 1f, 16, 16);

// Add context menu for "Additional Properties"
Action<Vector2> contextAction = null;
Expand All @@ -285,6 +285,9 @@ public static bool DrawHeaderFoldout(GUIContent title, bool state, bool isBoxed
contextAction(new Vector2(menuRect.x, menuRect.yMax));
}

// Documentation button
ShowHelpButton(menuRect, documentationURL, title);

var e = Event.current;

if (e.type == EventType.MouseDown)
Expand Down Expand Up @@ -489,19 +492,7 @@ public static bool DrawHeaderToggle(GUIContent title, SerializedProperty group,
}

// Documentation button
if (!String.IsNullOrEmpty(documentationURL))
{
var documentationRect = contextMenuRect;
documentationRect.x -= 16 + 5;
documentationRect.y -= 1;

var documentationTooltip = $"Open Reference for {title.text}.";
var documentationIcon = new GUIContent(EditorGUIUtility.TrIconContent("_Help").image, documentationTooltip);
var documentationStyle = new GUIStyle("IconButton");

if (GUI.Button(documentationRect, documentationIcon, documentationStyle))
System.Diagnostics.Process.Start(documentationURL);
}
ShowHelpButton(contextMenuRect, documentationURL, title);

// Handle events
var e = Event.current;
Expand All @@ -524,6 +515,21 @@ public static bool DrawHeaderToggle(GUIContent title, SerializedProperty group,
return group.isExpanded;
}

static void ShowHelpButton(Rect contextMenuRect, string documentationURL, GUIContent title)
{
if (string.IsNullOrEmpty(documentationURL))
return;

var documentationRect = contextMenuRect;
documentationRect.x -= 16 + 5;
documentationRect.y -= 1;

var documentationIcon = new GUIContent(CoreEditorStyles.iconHelp, $"Open Reference for {title.text}.");

if (GUI.Button(documentationRect, documentationIcon, CoreEditorStyles.iconHelpStyle))
Help.BrowseURL(documentationURL);
}

static void OnContextClick(Vector2 position, Func<bool> hasMoreOptions, Action toggleMoreOptions)
{
var menu = new GenericMenu();
Expand Down
24 changes: 24 additions & 0 deletions Editor/Lighting/ISerializedLight.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
namespace UnityEditor.Rendering
{
/// <summary>
/// Interface to be implemented by each pipeline to hold the <see cref="SerializedObject"/> for a Light Editor
/// </summary>
public interface ISerializedLight
{
/// <summary>The base settings of the light</summary>
LightEditor.Settings settings { get; }
/// <summary>The light serialized</summary>
SerializedObject serializedObject { get; }
/// <summary>The additinal light data serialized</summary>
SerializedObject serializedAdditionalDataObject { get; }

/// <summary>Light Intensity Property</summary>
SerializedProperty intensity { get; }

/// <summary>Method that updates the <see cref="SerializedObject"/> of the Light and the Additional Light Data</summary>
void Update();

/// <summary>Method that applies the modified properties the <see cref="SerializedObject"/> of the Light and the Light Camera Data</summary>
void Apply();
}
}

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

97 changes: 0 additions & 97 deletions Editor/Lighting/ProbeVolume/InstancedProbeShader.shader

This file was deleted.

10 changes: 0 additions & 10 deletions Editor/Lighting/ProbeVolume/InstancedProbeShader.shader.meta

This file was deleted.

1 change: 0 additions & 1 deletion Editor/Lighting/ProbeVolume/ProbeGIBaking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ static public void Clear()
refVol.Clear();
refVol.SetTRS(refVolAuthoring.transform.position, refVolAuthoring.transform.rotation, refVolAuthoring.brickSize);
refVol.SetMaxSubdivision(refVolAuthoring.maxSubdivision);
refVol.SetNormalBias(refVolAuthoring.normalBias);
}

cellIndex2SceneReferences.Clear();
Expand Down
4 changes: 3 additions & 1 deletion Editor/Lighting/ProbeVolume/ProbePlacement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,13 @@ public static void SubdivisionAlgorithm(ProbeReferenceVolume.Volume cellVolume,
// Find the local max from all overlapping probe volumes:
float localMaxSubdiv = 0;
float localMinSubdiv = 0;
bool overlap = false;
foreach (ProbeReferenceVolume.Volume v in probeVolumes)
{
ProbeReferenceVolume.Volume vol = v;
if (ProbeVolumePositioning.OBBIntersect(ref vol, ref brickVolume))
{
overlap = true;
localMaxSubdiv = Mathf.Max(localMaxSubdiv, vol.maxSubdivisionMultiplier);
// Do we use max for min subdiv too?
localMinSubdiv = Mathf.Max(localMinSubdiv, vol.minSubdivisionMultiplier);
Expand All @@ -164,7 +166,7 @@ public static void SubdivisionAlgorithm(ProbeReferenceVolume.Volume cellVolume,
bool belowMinSubdiv = subdivisionLevel <= ProbeReferenceVolume.instance.GetMaxSubdivision(localMinSubdiv);

// Keep bricks that overlap at least one probe volume, and at least one influencer (mesh)
if (belowMinSubdiv || (belowMaxSubdiv && ShouldKeepBrick(probeVolumes, brickVolume) && ShouldKeepBrick(influenceVolumes, brickVolume)))
if ((belowMinSubdiv && overlap) || (belowMaxSubdiv && ShouldKeepBrick(probeVolumes, brickVolume) && ShouldKeepBrick(influenceVolumes, brickVolume)))
{
f.subdivide = true;

Expand Down
Loading

0 comments on commit 3a8d060

Please sign in to comment.