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

Avoid having screen space overlays being rendered by the camera when HDR is off #6324

Merged
merged 159 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from 156 commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
5945333
[HDRP] Fix AxF debug output in certain configurations (#4641)
pmavridis May 26, 2021
64a6c13
Fix SSR accumulation white flash (#4648)
FrancescoC-unity May 26, 2021
f49b710
Display Info Box when MSAA + ray tracing is onr (#4627)
FrancescoC-unity May 26, 2021
05cc16a
Fix distortion when resizing the window in player builds with the Gra…
pmavridis May 28, 2021
2325e3f
Add support for the camera bridge in the graphics compositor (#4599)
pmavridis May 28, 2021
c09379f
Merge branch 'master' into hd/bugfix
sebastienlagarde May 28, 2021
b5962c9
Fix Jittered Project Matrix Infinite Far Clip Plane (#4638)
johnpars May 29, 2021
77b6b7f
Fixed a memory leak related to not disposing of the RTAS at the end H…
anisunity May 29, 2021
bf941a9
Fix custom pass utils Blur + Copy overdraw. (#4623)
alelievr May 29, 2021
806dfbe
Fix draw procedural invalid pass idx 1 on first template load (#4632)
FrancescoC-unity May 29, 2021
88779ea
Changed light reset to preserve type (#4624)
adrien-de-tocqueville May 29, 2021
30fffd5
Revert "Add support for the camera bridge in the graphics compositor …
sebastienlagarde May 29, 2021
aabbb4b
AxF carpaint: Fix a compilation issue on Vulkan until the cpp HLSLcc …
slunity May 29, 2021
dfdb311
Revert "Revert "Add support for the camera bridge in the graphics com…
sebastienlagarde May 29, 2021
891fda0
revert: Fix distortion when resizing the window in player builds with…
sebastienlagarde May 29, 2021
7b17e06
Merge branch 'master' into hd/bugfix
sebastienlagarde May 29, 2021
32df1bf
Merge branch 'master' into hd/bugfix
sebastienlagarde May 29, 2021
8fd1108
Fixed the ray traced sub subsurface scattering debug mode not display…
anisunity May 29, 2021
0032b9c
Fix for discrepancies in saturation and intensity between screen spac…
FrancescoC-unity May 29, 2021
41716f0
Fix a Divide-by-Zero Warning for some Anisotropic Models (Fabric, Lit…
johnpars May 29, 2021
333c800
[HDRP] Fix VfX lit particle AOV output color space (#4646)
pmavridis May 29, 2021
809316c
[HDRP][Path Tracing] Fixed transparent unlit (#4605)
eturquin May 31, 2021
7b1ad29
Merge branch 'master' into hd/bugfix
sebastienlagarde May 31, 2021
08a578d
Fix distortion with MSAA (#4711)
sebastienlagarde May 31, 2021
3c418c0
Fix contact shadow debug views (#4720)
FrancescoC-unity May 31, 2021
352f65d
Update Decal-Projector.md (#4695)
adrien-de-tocqueville May 31, 2021
acc5073
[HDRP] Fixed nullref when deleting the texture asset assigned in a lo…
alelievr May 31, 2021
fd54a00
Merge branch 'master' into hd/bugfix
sebastienlagarde May 31, 2021
1672dc6
Fix decal layer enum (#4753)
sebastienlagarde Jun 2, 2021
c40c5c5
Fix typo
sebastienlagarde Jun 3, 2021
b443d6e
Fixed reflection probes being injected into the ray tracing light clu…
anisunity Jun 7, 2021
bc1d498
Ignore hybrid duplicated reflection probes during light baking (#4663)
adrien-de-tocqueville Jun 7, 2021
99bc6fd
Fix double sided option moving when toggling it in the material UI (#…
alelievr Jun 7, 2021
4a184af
Merge branch 'master' into hd/bugfix
sebastienlagarde Jun 7, 2021
d2368ba
Fix formatting
sebastienlagarde Jun 7, 2021
e5521be
Merge branch 'master' into hd/bugfix
sebastienlagarde Jun 7, 2021
97a953e
Fix volumetric fog in planar reflections (#4736)
FrancescoC-unity Jun 7, 2021
419850b
Fix motion blur compute dispatch size (#4737)
adrien-de-tocqueville Jun 7, 2021
fc7efde
- Updated the recursive rendering documentation (case 1338639). (#4759)
anisunity Jun 7, 2021
ca93d88
Fix issue with OnDemand directional shadow map being corrupted when r…
FrancescoC-unity Jun 7, 2021
c674c41
Fix cropping issue with the compositor camera bridge (#4802)
pmavridis Jun 7, 2021
e47a172
Fix for unused resources in depth of field (#4796)
Adrian1066 Jun 8, 2021
131d1cd
Merge branch 'master' into hd/bugfix
sebastienlagarde Jun 8, 2021
666d37f
Merge branch 'master' into hd/bugfix
sebastienlagarde Jun 9, 2021
61518ea
Removing the word Radii from exposure settings (#4854)
FrancescoC-unity Jun 9, 2021
85ebbc2
[HDRP][Path Tracing] Support for shadow mattes (#4745)
eturquin Jun 10, 2021
ad127f5
Revert "[HDRP][Path Tracing] Support for shadow mattes (#4745)"
sebastienlagarde Jun 10, 2021
2c08712
Fixed the transparent cutoff not working properly in semi-transparent…
anisunity Jun 10, 2021
83ddbed
Use non jittered projection in outline pass (#4836)
adrien-de-tocqueville Jun 10, 2021
2d9d391
[HDRP][Path Tracing] Sky settings now properly taken into account whe…
eturquin Jun 10, 2021
30cbb05
Fix Resolution Issues for Physically Based Depth of Field (#4848)
johnpars Jun 14, 2021
5c6b711
Fixed bug introduced by sky-for-recorder support. (#4906)
eturquin Jun 14, 2021
3cb7354
[Fogbugz 1341576] Memory leaks when the player is paused, and the use…
kecho Jun 15, 2021
1ee6c2d
Merge branch 'master' into hd/bugfix
sebastienlagarde Jun 16, 2021
7615d7b
[HDRP] Fixed shadergraph double save (#4916)
alelievr Jun 16, 2021
be0e48e
Merge master
sebastienlagarde Jun 16, 2021
30135ea
Write 0 instead of micro sized motion vectors + fix extremely fast ve…
FrancescoC-unity Jun 16, 2021
df51161
[HDRP] Fix material upgrader (#4821)
alelievr Jun 16, 2021
2bc152b
[HDRP] Fix custom pass volume not executed in scene view (#4860)
alelievr Jun 16, 2021
bac78c1
Merge branch 'master' of https://github.com/Unity-Technologies/Graphi…
JulienIgnace-Unity Jun 17, 2021
b0442c6
Fix reflection probe tootltip (#4890)
adrien-de-tocqueville Jun 17, 2021
51af23d
Updated the Physically Based Sky documentation for baked lights (#4891)
adrien-de-tocqueville Jun 17, 2021
7f5b564
Fixed remapping of depth pyramid debug (#4893)
JulienIgnace-Unity Jun 17, 2021
24b3ea9
Fix wobble-like (or tearing-like) SSAO issues when temporal reproject…
FrancescoC-unity Jun 17, 2021
3f2772b
Fix Asymmetric Projection Matrices and Fog / Pathtracing (#4926)
johnpars Jun 17, 2021
4d1c13c
Merge branch 'master' into hd/bugfix
sebastienlagarde Jun 17, 2021
0bc3a8b
Merge master
sebastienlagarde Jun 18, 2021
0833363
Revert: Fix wobble-like (or tearing-like) SSAO issues when temporal r…
sebastienlagarde Jun 18, 2021
b307e87
Merge branch 'master' into hd/bugfix
sebastienlagarde Jun 18, 2021
2f4a545
Fix GBuffer depth debug mode (#5054)
adrien-de-tocqueville Jul 6, 2021
1772558
Fixed Volume Gizmo size when rescaling parent GameObject (#4915)
adrien-de-tocqueville Jul 8, 2021
d88d1eb
Fix Vertex Color Mode documentation (#4976)
adrien-de-tocqueville Jul 8, 2021
6692daf
Merge master
sebastienlagarde Jul 8, 2021
8ef3637
Fix wobble-like (or tearing-like) SSAO issues when temporal reproject…
FrancescoC-unity Jul 8, 2021
5dd669e
Fix formatting in NestedOverrideCameraRendering
sebastienlagarde Jul 8, 2021
a299cb8
[HDRP] Fix white flash with SSR when resetting camera history (#5089)
pmavridis Jul 9, 2021
8c39e99
[Fobguz # 1348357] VFX Particle templates missing stencil flags (#5080)
kecho Jul 9, 2021
c5dd9c6
Merge branch 'master' into hd/bugfix
sebastienlagarde Jul 12, 2021
df294f7
Fix object disappearing from lookdev (#5063)
alelievr Jul 13, 2021
ce1f22a
merge master
sebastienlagarde Jul 13, 2021
ae9e7a6
[HDRP] Fix render object after taa jittering (#5088)
alelievr Jul 13, 2021
883197e
Fix GC alloc in hd/bugfix branch (#5134)
alelievr Jul 13, 2021
eeb2ce5
Fix refraction tile artifacts near reflection probe edges (#4727)
FrancescoC-unity Jul 13, 2021
feb034c
Fix camera rotation uncontrollable with low framerate (#5076)
alelievr Jul 20, 2021
f4b940e
Clearing out render targets and randmo write targets on pipeline dest…
kecho Jul 20, 2021
455ebc2
Fixed a null ref exception when adding a new environment to the libra…
JulienIgnace-Unity Jul 22, 2021
f20b3d8
FogBugz#1348462 - Wait for accessing the HDProjectSettings instance a…
alex-vazquez Jul 22, 2021
8722fe0
Fix nullref in volume system after deleting a volume object (#5161)
alelievr Jul 26, 2021
21fdf2e
merge master
sebastienlagarde Jul 26, 2021
bc579c7
[HDRP] Fix APV UI loosing focus when changing a param (#5219)
alelievr Jul 26, 2021
a9cc22e
Merge branch 'master' into hd/bugfix
sebastienlagarde Jul 26, 2021
3a75e92
Small changes (#5220)
FrancescoC-unity Jul 27, 2021
9bf35af
Fix update order in Graphics Compositor causing jumpy camera updates …
pmavridis Jul 28, 2021
bf1b3e0
Prevent material from having infinite intensity (#5132)
adrien-de-tocqueville Jul 28, 2021
b6876a7
merge master
sebastienlagarde Jul 28, 2021
1bfc26e
[HDRP] Adding limitations of decal emissive positive contribution to …
remi-chapelain Jul 29, 2021
72d81c0
[HDRP] Fix issue with path tracing when switching between non-persist…
pmavridis Jul 29, 2021
77957b5
removed undesired files
sebastienlagarde Jul 29, 2021
bd814d5
Fix log base (#5260)
adrien-de-tocqueville Jul 29, 2021
7e2ffce
[HDRP] Fixed mask value stored by the LayerMaskParameter class (#5250)
eturquin Jul 30, 2021
d292c63
[HDRP][DXR] Make vertex color default to 1.0 instead of 0.0 (#5268)
eturquin Jul 30, 2021
556b0b3
Merge branch 'master' into hd/bugfix
sebastienlagarde Jul 30, 2021
87c680e
Fix issue with 0-sized dispatch with extremely low resolutions (#5272)
FrancescoC-unity Aug 2, 2021
3d50437
Merge branch 'master' into hd/bugfix
sebastienlagarde Aug 2, 2021
6057424
merge master
sebastienlagarde Aug 3, 2021
b7d7011
[HDRP] Fix incorrect light list indexing when TAA is enabled (#5287)
pmavridis Aug 3, 2021
660c292
merge master
sebastienlagarde Aug 5, 2021
16e98f0
Fix incorrect additiona velocity for alembic (#5304)
sebastienlagarde Aug 5, 2021
452a1ab
Fixed LUT initialization in Wireframe mode (#5156)
adrien-de-tocqueville Aug 5, 2021
b306e57
[HDRP] [LightExplorer] Fix missing refreshwhen editing property with …
RSlysz Aug 10, 2021
b7ef709
Merge branch 'master' of https://github.com/Unity-Technologies/Graphi…
JulienIgnace-Unity Aug 16, 2021
0f55c10
Changed Ambient Mode to Dynamic by default (#5350)
JulienIgnace-Unity Aug 16, 2021
2320588
Hd/fix framesettings ordering (#5323)
RSlysz Aug 16, 2021
5efb85a
Bugfix 1357311: Fixed old ray tracing material conversion (#5364)
JarkkoUnity Aug 19, 2021
cd8bd25
Bugfix 1358480: Fixed missing tooltip for "Tessellation Mode" (#5365)
JarkkoUnity Aug 24, 2021
314d2aa
[HDRP] Fix HD template (particularly visible in path tracing) (#5319)
eturquin Aug 24, 2021
d5ff09e
merge master
sebastienlagarde Aug 24, 2021
88819d9
Revert: Changed Ambient Mode to Dynamic by default #5350
sebastienlagarde Aug 25, 2021
31fbb1a
merge master
sebastienlagarde Aug 25, 2021
069186f
Merge master
sebastienlagarde Aug 25, 2021
558b3d6
Fixed a null ref exception when no opaque objects are rendered. (#5463)
JulienIgnace-Unity Aug 30, 2021
ab78e9f
Fix slope scale depth bias when depth offset is ON (#5466)
FrancescoC-unity Aug 31, 2021
46bf4f0
[HDRP] Fix spot shadow sampling when using custom spot angle (#5439)
alelievr Aug 31, 2021
5abdf18
Fix darkening in SSR fade (#5472)
FrancescoC-unity Aug 31, 2021
0996bd3
[HDRP] Improve path traced subsurface scattering for transmissive sur…
pmavridis Sep 1, 2021
b522d8b
Fix missing context menu for 'Post Anti-Aliasing' in Camera (1357283)…
RSlysz Sep 1, 2021
b4cebb2
Force allocate texture if no fallback is available (#5130)
adrien-de-tocqueville Sep 1, 2021
0c13561
Merge master
sebastienlagarde Sep 12, 2021
7e170a1
Update path tracer screenshots
sebastienlagarde Sep 12, 2021
ca75d7a
Update 2314_Shadow_CustonAngle.png
sebastienlagarde Sep 12, 2021
09f80a2
Merge branch 'master' into hd/bugfix
sebastienlagarde Sep 12, 2021
b1adf78
Merge branch 'master' into hd/bugfix
sebastienlagarde Sep 12, 2021
08ab02e
Merge branch 'master' into hd/bugfix
sebastienlagarde Oct 4, 2021
4314b7c
Fix range compression factor clamping (#5892)
adrien-de-tocqueville Oct 4, 2021
9b9e0ac
Fixed tooltip not showing on labels in ShaderGraphs (#5877)
adrien-de-tocqueville Oct 4, 2021
8461997
Proper format for copy history (#5796)
FrancescoC-unity Oct 7, 2021
6fc01a7
Fix shadow mask fade and optimize it at same time (#5911)
FrancescoC-unity Oct 12, 2021
cd674d3
Fix wrong format for contact shadows and shadow atlas default texture…
FrancescoC-unity Oct 12, 2021
eb69030
Fixed an issue where probe being forced realtime would cause perf to …
JulienIgnace-Unity Oct 12, 2021
b89b414
Mark anchor override as not supported for probes (#5939)
adrien-de-tocqueville Oct 12, 2021
195c9e3
Merge branch 'master' into hd/bugfix
sebastienlagarde Oct 12, 2021
e34bfc8
Merge branch 'master' into hd/bugfix
sebastienlagarde Oct 15, 2021
48ddd1c
Revert: Fix shadow mask fade and optimize it at same time #5911
sebastienlagarde Oct 15, 2021
41b6418
Merge branch 'master' into hd/bugfix
sebastienlagarde Oct 15, 2021
ab8de68
Merge branch 'master' into hd/bugfix
kecho Oct 26, 2021
d323a87
Add info on After post-process info box (#6125)
FrancescoC-unity Oct 26, 2021
cfbda5e
Dynamic Ambient improvement and doc update (#5951)
JulienIgnace-Unity Nov 4, 2021
de69692
Merge branch 'master' into hd/bugfix
sebastienlagarde Nov 4, 2021
5c727d4
[SRP] Fix issue when changing volume profiles at runtime with a scrip…
pmavridis Nov 4, 2021
0827329
Fix NaN on Intel GPU when using PBR Sky and rendering sun disk (#6145)
FrancescoC-unity Nov 5, 2021
f18b0c7
Fix Luminance/EV conversion when LightMeterCalibrationConstant is cha…
adrien-de-tocqueville Nov 5, 2021
65497f0
Fix formmating
sebastienlagarde Nov 8, 2021
015d64e
Merge branch 'master' into hd/bugfix
sebastienlagarde Nov 8, 2021
a34f336
Fixed range fields for depth of field
adrien-de-tocqueville Nov 15, 2021
b5bf454
Revert "Fixed range fields for depth of field"
adrien-de-tocqueville Nov 15, 2021
3423722
Render UI classically when not HDR
FrancescoC-unity Nov 17, 2021
15d6bc1
Merge branch 'master' into HDRP/screen-space-overlay-standard-behaviour
sebastienlagarde Nov 25, 2021
22994eb
Update CHANGELOG.md
sebastienlagarde Nov 25, 2021
0325bbe
Update HDRenderPipeline.cs
sebastienlagarde Nov 25, 2021
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
3 changes: 3 additions & 0 deletions com.unity.render-pipelines.core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added new DebugUI widget types: ProgressBarValue and ValueTuple
- Added common support code for FSR

### Fixed
- Fixed issue when changing volume profiles at runtime with a script (case 1364256).

## [13.1.0] - 2021-09-24

### Added
Expand Down
2 changes: 2 additions & 0 deletions com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ void RefreshEffectListEditor(VolumeProfile asset)
{
m_ComponentList.Clear();

asset.Sanitize();

if (asset != null)
m_ComponentList.Init(asset, new SerializedObject(asset));
}
Expand Down
10 changes: 10 additions & 0 deletions com.unity.render-pipelines.core/Runtime/Volume/VolumeProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,5 +313,15 @@ internal int GetComponentListHashCode()
return hash;
}
}

/// <summary>
/// Removes any components that were destroyed externally from the iternal list of components
/// </summary>
internal void Sanitize()
{
for (int i = components.Count - 1; i >= 0; i--)
if (components[i] == null)
components.RemoveAt(i);
}
}
}
2 changes: 2 additions & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed Shadow Matte not appearing in ray tracing effects (case 1364005).
- Fixed Crash issue when adding an area light on its own.
- Fixed rendertarget ColorMask in Forward with virtual texturing and transparent motion vectors.
- Fixed light unit conversion after changing mid gray value.
- Fix for screen space overlay rendered by camera when HDR is disabled.

### Changed
- Use RayTracingAccelerationStructure.CullInstances to filter Renderers and populate the acceleration structure with ray tracing instances for improved CPU performance on the main thread.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In the High Definition Render Pipeline (HDRP), there are two parts to environmen
Essentially, you use the visual environment to control how the sky looks in your Scene and use the lighting environment to control how the sky contributes to indirect ambient lighting.

## Visual Environment
The Visual Environment is a Volume override that tells HDRP what type of [sky](HDRP-Features.md#sky) and [fog](HDRP-Features.md#fog) you want to see through Cameras that the Volume affects. For information on how to customize Visual Environments, see the [Visual Environment](Override-Visual-Environment.md) documentation.
The Visual Environment is a Volume override that tells HDRP what type of [sky](HDRP-Features.md#sky) you want to see through Cameras that the Volume affects. For information on how to customize Visual Environments, see the [Visual Environment](Override-Visual-Environment.md) documentation.

Your Unity Project’s [HDRP Asset](HDRP-Asset.md) has the following properties that also affect all Visual Environments:

Expand Down Expand Up @@ -66,7 +66,15 @@ HDRP uses the ambient Light Probe as the final fallback for indirect diffuse lig
- Mesh Renderers that have their **Light Probe Mode** set to **Off**
- Volumetric fog if the Global Light Probe dimmer is set to a value above 0

The ambient Light Probe can be static (generated only once) or dynamic (updated at runtime).**Note**: If there is a **Light Probe group** in your Scene and you have computed indirect ambient lighting, then the Ambient Light Probe only affects Mesh Renderers that have their **Light Probe Mode** set to **Off**, and that have **Volumetric fog** (if it’s enabled in the Scene).
The ambient Light Probe can be static (generated only once from the static lighting sky set in the HDRP **Environment (HDRP)**panel) or dynamic (updated at runtime from the sky currently in use).

***\*Note\****: If there is a ***\*Light Probe group\**** in your Scene and you have computed indirect ambient lighting, then the Ambient Light Probe only affects Mesh Renderers that have their ***\*Light Probe Mode\**** set to ***\*Off\****, and that have ***\*Volumetric fog\**** (if it’s enabled in the Scene).

### Limitation of Dynamic Ambient mode

The Ambient Light Probe always affects your scene one frame late after HDRP calculates it. This is because HDRP calculates Ambient Light Probes on the GPU and then uses asynchronous readback on the CPU.

As a result, the ambient lighting might not match the actual lighting and cause visual artifacts. This can happen when you use the dynamic ambient mode and use reflection probes that update on demand.

## Ambient Reflection Probe

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ namespace UnityEditor.Rendering.HighDefinition
/// </summary>
public class EmissionUIBlock : MaterialUIBlock
{
static float s_MaxEvValue = Mathf.Floor(LightUtils.ConvertLuminanceToEv(float.MaxValue)) - 1;
// Max EV Value. Equals to LightUtils.ConvertLuminanceToEv(float.MaxValue)
// Literal value to avoid precision issue with max float and to be independent of ColorUtils.s_LightMeterCalibrationConstant.
static float s_MaxEvValue = 130.0f;

/// <summary>Options for emission block features. Use this to control which fields are visible.</summary>
[Flags]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ internal static class Styles

public static GUIContent opaqueCullModeText = new GUIContent("Cull Mode", "For opaque objects, change the cull mode of the object.");

public static string afterPostProcessZTestInfoBox = "After post-process material wont be ZTested. Enable the \"ZTest For After PostProcess\" checkbox in the Frame Settings to force the depth-test if the TAA is disabled.";
public static string afterPostProcessInfoBox = "If After post-process objects don't render, make sure to enable \"After Post-process\" in the frame settings.\nAfter post-process material wont be ZTested. Enable the \"ZTest For After PostProcess\" checkbox in the Frame Settings to force the depth-test if the TAA is disabled.";

public static readonly GUIContent[] displacementModeLitNames = new GUIContent[] { new GUIContent("None"), new GUIContent("Vertex displacement"), new GUIContent("Pixel displacement") };
public static readonly int[] displacementModeLitValues = new int[] { (int)DisplacementMode.None, (int)DisplacementMode.Vertex, (int)DisplacementMode.Pixel };
Expand Down Expand Up @@ -590,7 +590,7 @@ protected void DrawSurfaceGUI()

void ShowAfterPostProcessZTestInfoBox()
{
EditorGUILayout.HelpBox(Styles.afterPostProcessZTestInfoBox, MessageType.Info);
EditorGUILayout.HelpBox(Styles.afterPostProcessInfoBox, MessageType.Info);
}

void SurfaceTypePopup()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace UnityEngine.Rendering.HighDefinition
/// </summary>
class LightUtils
{
static float s_LuminanceToEvFactor = Mathf.Log(100f / ColorUtils.s_LightMeterCalibrationConstant, 2);
static float s_EvToLuminanceFactor = -Mathf.Log(100f / ColorUtils.s_LightMeterCalibrationConstant, 2);
static float s_LuminanceToEvFactor => Mathf.Log(100f / ColorUtils.s_LightMeterCalibrationConstant, 2);
static float s_EvToLuminanceFactor => -Mathf.Log(100f / ColorUtils.s_LightMeterCalibrationConstant, 2);

// Physical light unit helper
// All light unit are in lumen (Luminous power)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,8 @@ protected override void Render(ScriptableRenderContext renderContext, Camera[] c
return;
#endif

SupportedRenderingFeatures.active.rendersUIOverlay = HDROutputIsActive();

#if UNITY_2021_1_OR_NEWER
if (!m_ValidAPI || cameras.Count == 0)
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ static class HDShaderIDs
public static readonly int _SpaceEmissionMultiplier = Shader.PropertyToID("_SpaceEmissionMultiplier");

public static readonly int _RenderSunDisk = Shader.PropertyToID("_RenderSunDisk");
public static readonly int _SunDiskCosines = Shader.PropertyToID("_SunDiskCosines");

public static readonly int _ColorSaturation = Shader.PropertyToID("_ColorSaturation");
public static readonly int _AlphaSaturation = Shader.PropertyToID("_AlphaSaturation");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Shader "Hidden/HDRP/Sky/PbrSky"

#pragma vertex Vert

// #pragma enable_d3d11_debug_symbols
#pragma editor_sync_compilation
#pragma target 4.5
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
Expand All @@ -26,6 +25,13 @@ Shader "Hidden/HDRP/Sky/PbrSky"
float _GroundEmissionMultiplier;
float _SpaceEmissionMultiplier;

// Inner and outer cosine computed as:
// float radInner = 0.5 * light.angularDiameter
// float cosInner = cos(radInner); // (In _SunDiskCosines.x)
// float cosOuter = cos(radInner + light.flareSize); // (In _SunDiskCosines.y)
// We need to pass it over instead of computing it here because on some vendors trigonometry has very bad precision, so we precompute what we can on CPU to have better precision.
float4 _SunDiskCosines;

// Sky framework does not set up global shader variables (even per-view ones),
// so they can contain garbage. It's very difficult to not include them, however,
// since the sky framework includes them internally in many header files.
Expand Down Expand Up @@ -111,8 +117,9 @@ Shader "Hidden/HDRP/Sky/PbrSky"
float LdotV = -dot(L, V);
float rad = acos(LdotV);
float radInner = 0.5 * light.angularDiameter;
float cosInner = cos(radInner);
float cosOuter = cos(radInner + light.flareSize);

float cosInner = _SunDiskCosines.x;
float cosOuter = _SunDiskCosines.y;

float solidAngle = TWO_PI * (1 - cosInner);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,14 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo
}
s_PbrSkyMaterialProperties.SetInt(HDShaderIDs._HasSpaceEmissionTexture, hasSpaceEmissionTexture);

// We need to pass it over instead of computing it here because on some vendors trigonometry has very bad precision, so we precompute what we can on CPU to have better precision.
// We can safely retrieve HDAdditionalLightData as for PBR sky the sunlight is always going to be an HDRP light.
var lightData = builtinParams.sunLight.gameObject.GetComponent<HDAdditionalLightData>();
float radInner = 0.5f * lightData.angularDiameter * Mathf.Deg2Rad;
float cosInner = Mathf.Cos(radInner);
float cosOuter = Mathf.Cos(radInner + lightData.flareSize);
s_PbrSkyMaterialProperties.SetVector(HDShaderIDs._SunDiskCosines, new Vector4(cosInner, cosOuter, 0, 0));

s_PbrSkyMaterialProperties.SetInt(HDShaderIDs._RenderSunDisk, renderSunDisk ? 1 : 0);

int pass = (renderForCubemap ? 0 : 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ struct CachedSkyContext

public void Reset()
{
// We keep around the renderer and the rendering context to avoid useless allocation if they get reused.
// We keep around the rendering context to avoid useless allocation if they get reused.
hash = 0;
refCount = 0;
if (renderingContext != null)
renderingContext.Reset();
}

public void Cleanup()
Expand Down Expand Up @@ -882,14 +884,15 @@ public void UpdateEnvironment(HDCamera hdCamera,
// Debug.Log("Update Sky Lighting");
RenderSkyToCubemap(skyContext);

if (updateAmbientProbe)
if (updateAmbientProbe && !renderingContext.computeAmbientProbeRequested)
{
using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.UpdateSkyAmbientProbe)))
{
cmd.SetComputeBufferParam(m_ComputeAmbientProbeCS, m_ComputeAmbientProbeKernel, m_AmbientProbeOutputBufferParam, renderingContext.ambientProbeResult);
cmd.SetComputeTextureParam(m_ComputeAmbientProbeCS, m_ComputeAmbientProbeKernel, m_AmbientProbeInputCubemap, renderingContext.skyboxCubemapRT);
cmd.DispatchCompute(m_ComputeAmbientProbeCS, m_ComputeAmbientProbeKernel, 1, 1, 1);
cmd.RequestAsyncReadback(renderingContext.ambientProbeResult, renderingContext.OnComputeAmbientProbeDone);
renderingContext.computeAmbientProbeRequested = true;

// When the profiler is enabled, we don't want to submit the render context because
// it will break all the profiling sample Begin() calls issued previously, which leads
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ internal class SkyRenderingContext
public bool supportsConvolution { get; private set; } = false;

internal bool ambientProbeIsReady = false;
public bool computeAmbientProbeRequested = false;

public SkyRenderingContext(int resolution, int bsdfCount, bool supportsConvolution, SphericalHarmonicsL2 ambientProbe, string name)
{
Expand All @@ -40,6 +41,12 @@ public SkyRenderingContext(int resolution, int bsdfCount, bool supportsConvoluti
}
}

public void Reset()
{
ambientProbeIsReady = false;
computeAmbientProbeRequested = false;
}

public void Cleanup()
{
RTHandles.Release(skyboxCubemapRT);
Expand Down