Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
68b41a4
[Port] [6000.0] Initialized APV bakeDiffuseLighting
svc-reach-platform-support Jul 22, 2025
1b12a0c
[UUM-110269][6000.0] Fix Rendergraph 2D builders
kennytann Jul 22, 2025
d012efe
[Backport] [6000.0] Render Graph - Disable FBF for PS4 & PS5
YohannVaastUnity Jul 25, 2025
4f99ce8
[Port] [6000.0] [UUM-97906] [URP] Fix flipped projection params
svc-reach-platform-support Jul 28, 2025
f806552
Disable unstable tests
AngelaDematte Jul 28, 2025
602fb5a
[Port] [6000.0] Docs feedback fixes Jul 2025
svc-reach-platform-support Jul 28, 2025
d15c4b1
[Port] [6000.0] DOCG-6833 Add missing landing pages to VFX Graph manual
markg-unity Jul 28, 2025
d648f9f
[Port] [6000.0] [ShaderGraph] Add toggle to override the shader varia…
svc-reach-platform-support Jul 29, 2025
fcf3dc2
[Port] [6000.0] More descriptive APV inspector warning message for En…
svc-reach-platform-support Jul 31, 2025
22584e6
Add guard for null current baking set
belgaard Jul 31, 2025
54781bf
Port/6000.0/2d/staging/tilemap/uum 111921
ChuanXin-Unity Aug 1, 2025
cd34d81
Disabling unstable tests
Daniel-Dobzinski Aug 1, 2025
6f15f38
[Port] [6000.0] [SRP] [Volume] [UUM-111415] Redraw all views after Vo…
svc-reach-platform-support Aug 3, 2025
3637c37
[Backport 6.0][AMDUnityPlugin] fix DX12 crash when FSR2 is toggled on…
volkan-unity Aug 3, 2025
cbaea99
[Port] [6000.0] [UUM-111510]The Game view and Scene view fail to rend…
svc-reach-platform-support Aug 3, 2025
cceaebe
[Port] [6000.0] URP: Fix ZBin clamp
svc-reach-platform-support Aug 4, 2025
1b2f3a7
[Port] [6000.0] DOCG-7386 Improve HDRP ambient occlusion documentation
svc-reach-platform-support Aug 4, 2025
d438b7f
[Port] [6000.0] [HDRP] Fix the issue with water fade
Aug 6, 2025
2597845
[6000.0] Force enable reflection probe blending with atlas when GRD i…
vincent-breysse Aug 11, 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
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public override void OnInspectorGUI()

if (ProbeVolumeLightingTab.GetLightingSettings().realtimeGI)
{
EditorGUILayout.HelpBox("Adaptive Probe Volumes are not supported when using Enlighten.", MessageType.Warning, wide: true);
EditorGUILayout.HelpBox("Adaptive Probe Volumes are not supported when using Realtime Global Illumination(Enlighten).", MessageType.Warning, wide: true);
drawInspector = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1656,12 +1656,18 @@ void InitializePersistentElements()

void OnGraphRegistered(RenderGraph graph)
{
if (m_RegisteredGraphs.ContainsKey(graph))
return;

m_RegisteredGraphs.Add(graph, new HashSet<string>());
RebuildHeaderUI();
}

void OnGraphUnregistered(RenderGraph graph)
{
if (!m_RegisteredGraphs.ContainsKey(graph))
return;

m_RegisteredGraphs.Remove(graph);
RebuildHeaderUI();
if (m_RegisteredGraphs.Count == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,14 @@ public void OnGUI()

// Even if the asset is not dirty, the list of component may have been changed by another inspector.
// In this case, only the hash will tell us that we need to refresh.
if (asset.isDirty || asset.GetComponentListHashCode() != m_CurrentHashCode)
if (asset.dirtyState != VolumeProfile.DirtyState.None || asset.GetComponentListHashCode() != m_CurrentHashCode)
{
RefreshEditors();
VolumeManager.instance.OnVolumeProfileChanged(asset);
asset.isDirty = false;

if ((asset.dirtyState & VolumeProfile.DirtyState.DirtyByProfileReset) != 0)
UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
asset.dirtyState = VolumeProfile.DirtyState.None;
}

if (m_IsDefaultVolumeProfile && VolumeManager.instance.isInitialized && m_EditorsByCategory.Count == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ public bool UpdateShaderVariablesProbeVolumes(CommandBuffer cmd, ProbeVolumesOpt

parameters.skyOcclusionIntensity = skyOcclusion ? probeVolumeOptions.skyOcclusionIntensityMultiplier.value : 0.0f;
parameters.skyOcclusionShadingDirection = skyOcclusion && skyOcclusionShadingDirection;
parameters.regionCount = m_CurrentBakingSet.bakedMaskCount;
parameters.regionLayerMasks = supportRenderingLayers ? m_CurrentBakingSet.bakedLayerMasks : 0xFFFFFFFF;
parameters.regionCount = m_CurrentBakingSet != null ? m_CurrentBakingSet.bakedMaskCount : 0;
parameters.regionLayerMasks = (supportRenderingLayers && m_CurrentBakingSet != null) ? m_CurrentBakingSet.bakedLayerMasks : 0xFFFFFFFF;
parameters.worldOffset = probeVolumeOptions.worldOffset.value;
UpdateConstantBuffer(cmd, parameters);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ void EvaluateAPVL1L2(APVSample apvSample, float3 N, out float3 diffuseLighting)
// -------------------------------------------------------------
void EvaluateAdaptiveProbeVolume(APVSample apvSample, float3 normalWS, out float3 bakeDiffuseLighting)
{
bakeDiffuseLighting = float3(0.0f, 0.0f, 0.0f);
if (apvSample.status != APV_SAMPLE_STATUS_INVALID)
{
apvSample.Decode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ void SetRenderAttachment(TextureHandle tex, int index, AccessFlags flags = Acces
/// to match the index passed to SetInputAttachment for this texture.
///
/// </summary>
/// <remarks>
/// This API is not universally supported across all platforms. In particular, using input attachments in combination with MSAA may be unsupported on certain targets.
/// To ensure compatibility, use `RenderGraphUtils.IsFramebufferFetchSupportedOnCurrentPlatform` to verify support at runtime, as platform capabilities may vary.
/// </remarks>
/// <param name="tex">Texture to use during this pass.</param>
/// <param name="index">Index the shader will use to access this texture.</param>
/// <param name="flags">How this pass will access the texture. Default value is set to AccessFlag.Read. Writing is currently not supported on any platform. </param>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using UnityEngine.Experimental.Rendering;
using static UnityEngine.Rendering.RenderGraphModule.RenderGraph;

namespace UnityEngine.Rendering.RenderGraphModule
{
Expand Down Expand Up @@ -399,6 +400,8 @@ public void SetRenderAttachment(TextureHandle tex, int index, AccessFlags flags,

public void SetInputAttachment(TextureHandle tex, int index, AccessFlags flags, int mipLevel, int depthSlice)
{
CheckFrameBufferFetchEmulationIsSupported(tex);

CheckUseFragment(tex, false);
ResourceHandle result = UseResource(tex.handle, flags);
// Note the version for the attachments is a bit arbitrary so we just use the latest for now
Expand Down Expand Up @@ -513,5 +516,24 @@ void CheckResource(in ResourceHandle res, bool checkTransientReadWrite = false)
}
}
}

[Conditional("DEVELOPMENT_BUILD"), Conditional("UNITY_EDITOR")]
void CheckFrameBufferFetchEmulationIsSupported(in TextureHandle tex)
{
if (enableValidityChecks)
{
if (!Util.RenderGraphUtils.IsFramebufferFetchEmulationSupportedOnCurrentPlatform())
{
throw new InvalidOperationException($"This API is not supported on the current platform: {SystemInfo.graphicsDeviceType}");
}

if (!Util.RenderGraphUtils.IsFramebufferFetchEmulationMSAASupportedOnCurrentPlatform())
{
var sourceInfo = m_RenderGraph.GetRenderTargetInfo(tex);
if (sourceInfo.bindMS)
throw new InvalidOperationException($"This API is not supported with MSAA attachments on the current platform: {SystemInfo.graphicsDeviceType}");
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public static partial class RenderGraphUtils
/// <returns>Returns true if the shader features required by the copy pass is supported for MSAA, otherwise will it return false.</returns>
public static bool CanAddCopyPassMSAA()
{
if (!IsFramebufferFetchEmulationMSAASupportedOnCurrentPlatform())
return false;

return Blitter.CanCopyMSAA();
}

Expand All @@ -27,9 +30,53 @@ public static bool CanAddCopyPassMSAA()
/// <returns>Returns true if the shader features required by the copy pass is supported for MSAA, otherwise will it return false.</returns>
public static bool CanAddCopyPassMSAA(in TextureDesc sourceDesc)
{
if (!IsFramebufferFetchEmulationMSAASupportedOnCurrentPlatform())
return false;

return Blitter.CanCopyMSAA(sourceDesc);
}

internal static bool IsFramebufferFetchEmulationSupportedOnCurrentPlatform()
{
#if PLATFORM_WEBGL
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES3)
return false;
#endif
return true;
}

internal static bool IsFramebufferFetchEmulationMSAASupportedOnCurrentPlatform()
{
// TODO: Temporarily disable this utility pending a more efficient solution for supporting or disabling framebuffer fetch emulation on PS4/PS5.
return (SystemInfo.graphicsDeviceType != GraphicsDeviceType.PlayStation4
&& SystemInfo.graphicsDeviceType != GraphicsDeviceType.PlayStation5 && SystemInfo.graphicsDeviceType != GraphicsDeviceType.PlayStation5NGGC);
}

/// <summary>
/// Determines whether framebuffer fetch is supported on the current platform for the given texture.
/// This includes checking both general support for framebuffer fetch emulation and specific support
/// for multisampled (MSAA) textures.
/// </summary>
/// <param name="graph">The RenderGraph adding this pass to.</param>
/// <param name="tex">The texture handle to validate for framebuffer fetch compatibility.</param>
/// <returns>
/// Returns true if framebuffer fetch is supported on the current platform for the given texture;
/// otherwise, returns false.
/// </returns>
public static bool IsFramebufferFetchSupportedOnCurrentPlatform(this RenderGraph graph, in TextureHandle tex)
{
if (!IsFramebufferFetchEmulationSupportedOnCurrentPlatform())
return false;

if (!IsFramebufferFetchEmulationMSAASupportedOnCurrentPlatform())
{
var sourceInfo = graph.GetRenderTargetInfo(tex);
if (sourceInfo.msaaSamples > 1)
return sourceInfo.bindMS;
}
return true;
}

class CopyPassData
{
public bool isMSAA;
Expand Down Expand Up @@ -90,7 +137,7 @@ public static void AddCopyPass(
// It would have 1 if the MSAA pass is not able to be used for target and 2 otherwise.
// https://docs.unity3d.com/2017.4/Documentation/Manual/SL-ShaderCompileTargets.html
// https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-to-get-sample-position
if (isMSAA && !Blitter.CanCopyMSAA(sourceDesc))
if (isMSAA && !CanAddCopyPassMSAA(sourceDesc))
throw new ArgumentException("Target does not support MSAA for AddCopyPass. Please use the blit alternative or use non MSAA textures.");

using (var builder = graph.AddRasterRenderPass<CopyPassData>(passName, out var passData, file, line))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,28 @@ public sealed class VolumeProfile : ScriptableObject
/// A dirty check used to redraw the profile inspector when something has changed. This is
/// currently only used in the editor.
/// </summary>
[NonSerialized]
public bool isDirty = true; // Editor only, doesn't have any use outside of it
[Obsolete("This field was only public for editor access. #from(6000.0)")]
public bool isDirty
{
get => dirtyState != DirtyState.None;
set
{
if (value)
dirtyState |= DirtyState.Other;
else
dirtyState &= ~DirtyState.Other;
}
}

[Flags] internal enum DirtyState
{
None = 0,
DirtyByComponentChange = 1,
DirtyByProfileReset = 2,
Other = 4
}

internal DirtyState dirtyState;

void OnEnable()
{
Expand Down Expand Up @@ -55,9 +75,7 @@ internal void OnDisable()
/// Volume Profile editor when you modify the Asset via script instead of the Inspector.
/// </summary>
public void Reset()
{
isDirty = true;
}
=> dirtyState |= DirtyState.DirtyByProfileReset;

/// <summary>
/// Adds a <see cref="VolumeComponent"/> to this Volume Profile.
Expand Down Expand Up @@ -99,7 +117,7 @@ public VolumeComponent Add(Type type, bool overrides = false)
#endif
component.SetAllOverridesTo(overrides);
components.Add(component);
isDirty = true;
dirtyState |= DirtyState.DirtyByComponentChange;
return component;
}

Expand Down Expand Up @@ -141,7 +159,7 @@ public void Remove(Type type)
if (toRemove >= 0)
{
components.RemoveAt(toRemove);
isDirty = true;
dirtyState |= DirtyState.DirtyByComponentChange;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ protected IEnumerator Warmup()
class RuntimeProfilerTests : RuntimeProfilerTestBase
{
[UnityTest]
[UnityPlatform(exclude = new RuntimePlatform[] { RuntimePlatform.WindowsPlayer })] // Unstable: https://jira.unity3d.com/browse/UUM-112472
public IEnumerator RuntimeProfilerGivesNonZeroOutput()
{
if ((Application.platform == RuntimePlatform.LinuxPlayer ||
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Ambient occlusion
# Assign an ambient occlusion texture

The High Definition Render Pipeline (HDRP) uses ambient occlusion to approximate ambient light on a GameObject’s surface that has been cast by details present in the Material but not the surface geometry. Since these details don't exist on the model, you must provide an ambient occlusion Texture for HDRP to occlude indirect lighting (lighting from Lightmaps, [Light Probes](https://docs.unity3d.com/Manual/LightProbes.html) or Ambient Light Probes). HDRP also uses the ambient occlusion Texture to calculate specular occlusion. It calculates specular occlusion from the Camera's view vector and the ambient occlusion Texture to dim reflections in cavities.
To assign an [ambient occlusion texture](ambient-occlusion-introduction.md) to a GameObject, follow these steps:

To generate an ambient occlusion Texture, you can use external software like:
1. Use an external software package to create a single-channel ambient occlusion texture that maps the corners and crevices where light is occluded. Use values closer to `0` to indicate more occlusion, and values closer to `1` to indicate less occlusion.

* xNormal
* Substance Designer or Painter
* Knald
1. Create a [mask map](Mask-Map-and-Detail-Map.md#MaskMap) texture, and use the ambient occlusion texture as the green channel.

When authoring ambient occlusion Textures, be aware that a value of 0 specifies an area that's fully occluded and a value of 1 specifies an area that's fully visible.
1. Import the mask map texture into Unity.

When you create the Texture, you must apply it to a Material. To do this, you must use the green channel of a [mask map](Mask-Map-and-Detail-Map.md#MaskMap).
1. Select a material in the **Project** window, then drag the mask map texture into the **Occlusion** (⊙) property of the **Inspector** window.

HDRP also uses the ambient occlusion texture to calculate specular occlusion, by reducing the intensity of reflections in corners.

**Note**: Ambient occlusion in a Lit Shader using [deferred rendering](Forward-And-Deferred-Rendering.md) affects emission due to a technical constraint. Lit Shaders that use [forward rendering](Forward-And-Deferred-Rendering.md) don't have this constraint and don't affect emission.

## Properties
For more information about ambient occlusion texture properties in an HDRP material, refer to the material in [Materials and surfaces](materials-and-surfaces.md).

The ambient occlusion properties are located in the **Mask Map** section of the **Surface Inputs** foldout of your material's **Inspector** window.
## Additional resources

| Property | Description |
| ------------------------------- | ------------------------------------------------------------ |
| **Mask Map - Green channel** | Assign the ambient occlusion map in the green channel of the **Mask Map** Texture. HDRP uses the green channel of this map to calculate ambient occlusion. |
| **Ambient Occlusion Remapping** | Remaps the ambient occlusion map in the green channel of the **Mask Map** between the minimum and maximum values you define on the slider. These values are between 0 and 1.<br/><br/>&#8226; Drag the left handle to the right to make the ambient occlusion more subtle.<br/>&#8226; Drag the right handle to the left to apply ambient occlusion to the whole Material. This is useful when the GameObject this Material is on is occluded by a dynamic GameObject.<br/><br/>This property only appears when you assign a Texture to the **Mask Map**. |
- [Screen space ambient occlusion (SSAO)](Override-Ambient-Occlusion.md)
- [Ray-traced ambient occlusion (RTAO)](Ray-Traced-Ambient-Occlusion.md)
- [Mask and detail maps](Mask-Map-and-Detail-Map.md#MaskMap)
- [Textures](https://docs.unity3d.com/Manual/Textures-landing.html)
Loading