Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions com.unity.render-pipelines.core/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.

### Fixed
- Fixed XR support in CoreUtils.DrawFullscreen function.
- Fixed an issue causing Render Graph execution errors after a random amount of time.

## [12.1.2] - 2021-10-22

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ void OnGUI()
if (GUILayout.Button(Styles.resetButtonContent, EditorStyles.toolbarButton))
{
DebugManager.instance.Reset();
DestroyWidgetStates();
UpdateWidgetStates();
InternalEditorUtility.RepaintAllViews();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void RefreshEffectListEditor(VolumeProfile asset)
{
m_ComponentList.Clear();

asset.Sanitize();
asset?.Sanitize();

if (asset != null)
m_ComponentList.Init(asset, new SerializedObject(asset));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ class DebugUpdater : MonoBehaviour
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
static void RuntimeInit()
{
if (!Debug.isDebugBuild)
return;

#if DEVELOPMENT_BUILD || UNITY_EDITOR
if (DebugManager.instance.enableRuntimeUI)
EnableRuntime();
#endif
}

internal static void SetEnabled(bool enabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,21 @@ public bool IsValid()

static public void NewFrame(int executionIndex)
{
uint previousValidBit = s_CurrentValidBit;
// Scramble frame count to avoid collision when wrapping around.
s_CurrentValidBit = (uint)(((executionIndex >> 16) ^ (executionIndex & 0xffff) * 58546883) << 16);
// In case the current valid bit is 0, even though perfectly valid, 0 represents an invalid handle, hence we'll
// trigger an invalid state incorrectly. To account for this, we actually skip 0 as a viable s_CurrentValidBit and
// start from 1 again.
if (s_CurrentValidBit == 0)
// In the same spirit, s_SharedResourceValidBit is reserved for shared textures so we should never use it otherwise
// resources could be considered valid at frame N+1 (because shared) even though they aren't.
if (s_CurrentValidBit == 0 || s_CurrentValidBit == s_SharedResourceValidBit)
{
s_CurrentValidBit = 1 << 16;
// We need to make sure we don't pick the same value twice.
uint value = 1;
while (previousValidBit == (value << 16))
value++;
s_CurrentValidBit = (value << 16);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static bool enabled
/// <returns>Enumeration of actions</returns>
public static IEnumerator<Action<RenderTargetIdentifier, CommandBuffer>> GetCaptureActions(Camera camera)
{
if (!actionDict.TryGetValue(camera, out var actions))
if (!actionDict.TryGetValue(camera, out var actions) || actions.Count == 0)
return null;

return actions.GetEnumerator();
Expand Down
14 changes: 14 additions & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed objects belonging to preview scenes being marked as dirty during migration (case 1367204).
- Fixed compilation errors from Path Tracing on the PS5 build.
- Fixed option to force motion blur off when in XR.
- Fixed taa jitter for after post process materials (case 1380967).
- Fixed dirtiness handling in path tracing, when using multiple cameras at once (case 1376940).
- Fixed flickering / edge aliasing issue when DoF and TAAU or DLSS are enabled (case 1381858).
- Fixed rasterized accumulation motion blur when DoF is enabled (case 1378497).
- Fixed light mode not available after switching a light to area "Disc" or "Tube" (case 1372588).
- Fixed CoC size computation when dynamic resolution is enabled
- Fixed shadow cascade transition not working properly with bias.
- Fixed broken rendering when duplicating a camera while the Rendering Debugger is opened.
- Fixed screen space shadow debug view not showing when no shadows is available.
- Fixed nullref from debug menu in release build (case 1381556).
- Fixed debug window reset.
- Fixed camera bridge action in release build (case 1367866).
- Fixed contact shadow disappearing when shadowmask is used and no non-static object is available.
- Fixed atmospheric scattering being incorrectly enabled when scene lighting is disabled.

## [12.1.2] - 2021-10-22

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ If you set the **Surface Type** to **Transparent**, HDRP exposes options to set
| **Sorting Priority** | Allows you to change the rendering order of overlaid transparent surfaces. For more information and an example of usage, see the [Material sorting documentation](Renderer-And-Material-Priority.md#SortingByMaterial). |
| **Receive fog** | Enable the checkbox to allow fog to affect the transparent surface. When disabled, HDRP does not take this Material into account when it calculates the fog in the Scene. |
| **Back Then Front Rendering** | Enable the checkbox to make HDRP render this Material in two separate draw calls. HDRP renders the back face in the first draw call and the front face in the second. |
| **Transparent depth prepass** | Enable the checkbox to add polygons from the transparent surface to the depth buffer to improve their sorting. HDRP performs this operation before the lighting pass and this process improves GPU performance. |
| **Transparent depth postpass** | Enable the checkbox to add polygons to the depth buffer that post-processing uses. HDRP performs this operation before the lighting pass. Enabling this feature is useful if you want to use post-processing effects that use depth information, like [motion blur](Post-Processing-Motion-Blur.md) or [depth of field](Post-Processing-Depth-of-Field.md). |
| **Transparent depth prepass** | Enable the checkbox to add polygons from the transparent surface to the depth buffer to improve their sorting. HDRP performs this operation before the transparent lighting pass. |
| **Transparent depth postpass** | Enable the checkbox to add polygons from the transparent surface to the depth buffer so they affect post-processing. HDRP performs this operation after the lighting pass. Enabling this feature is useful when using post-processing effects that use depth information, like [motion blur](Post-Processing-Motion-Blur.md) or [depth of field](Post-Processing-Depth-of-Field.md). |
| **Transparent Writes Motion Vectors** | Enable the checkbox to make HDRP write motion vectors for transparent GameObjects that use this Material. This allows HDRP to process effects like motion blur for transparent objects. For more information on motion vectors, see the [motion vectors documentation](Motion-Vectors.md). |
| **Depth Write** | Enable the checkbox to make HDRP write depth values for transparent GameObjects that use this Material. |
| **Depth Test** | Use the drop-down to select the comparison function to use for the depth test. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ static void DrawGeneralContent(SerializedHDLight serialized, Editor owner, bool
EditorGUI.showMixedValue = false;

// Draw the mode, for Tube and Disc lights, there is only one choice, so we can disable the enum.
using (new EditorGUI.DisabledScope(serialized.areaLightShape == AreaLightShape.Tube || serialized.areaLightShape == AreaLightShape.Disc))
using (new EditorGUI.DisabledScope(updatedLightType == HDLightType.Area && (serialized.areaLightShape == AreaLightShape.Tube || serialized.areaLightShape == AreaLightShape.Disc)))
serialized.settings.DrawLightmapping();

if (updatedLightType == HDLightType.Area)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void EvaluateAtmosphericScattering(PositionInputs posInput, float3 V, out float3

#ifdef DEBUG_DISPLAY
// Don't sample atmospheric scattering when lighting debug more are enabled so fog is not visible
if (_DebugLightingMode >= DEBUGLIGHTINGMODE_DIFFUSE_LIGHTING && _DebugLightingMode <= DEBUGLIGHTINGMODE_EMISSIVE_LIGHTING)
if (_DebugLightingMode == DEBUGLIGHTINGMODE_MATCAP_VIEW || (_DebugLightingMode >= DEBUGLIGHTINGMODE_DIFFUSE_LIGHTING && _DebugLightingMode <= DEBUGLIGHTINGMODE_EMISSIVE_LIGHTING))
return;

if (_DebugShadowMapMode == SHADOWMAPDEBUGMODE_SINGLE_SHADOW || _DebugLightingMode == DEBUGLIGHTINGMODE_LUX_METER || _DebugLightingMode == DEBUGLIGHTINGMODE_LUMINANCE_METER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,12 @@ private void ConvertDirectionalLightToGPUFormat(

lightData.flareSize = Mathf.Max(lightRenderData.flareSize * Mathf.Deg2Rad, 5.960464478e-8f);
lightData.flareFalloff = lightRenderData.flareFalloff;

// On some vendors trigonometry has very bad precision, so we precompute what we can on CPU to avoid precision issues (case 1369376).
float radInner = 0.5f * lightData.angularDiameter;
lightData.flareCosInner = Mathf.Cos(radInner);
lightData.flareCosOuter = Mathf.Cos(radInner + lightData.flareSize);

lightData.flareTint = (Vector3)(Vector4)lightRenderData.flareTint;
lightData.surfaceTint = (Vector3)(Vector4)lightRenderData.surfaceTint;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ private void GetContactShadowMask(HDAdditionalLightData hdAdditionalLightData, B
return;

// Evaluate the contact shadow index of this light
contactShadowMask = 1 << m_ContactShadowIndex++;
contactShadowMask = 1 << m_ContactShadowIndex;
m_ContactShadowIndex++; // Update the index for next light that will need to cast contact shadows.

// If this light has ray traced contact shadow
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing) && hdAdditionalLightData.rayTraceContactShadow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,16 @@ struct DirectionalLightData

public float diffuseDimmer;
public float specularDimmer;

public float penumbraTint;
public float isRayTracedContactShadow;

public float distanceFromCamera; // -1 -> no sky interaction
public float angularDiameter; // Units: radians

public float flareFalloff;
public float flareCosInner;
public float flareCosOuter;
public float __unused__;

public Vector3 flareTint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ struct DirectionalLightData
float distanceFromCamera;
float angularDiameter;
float flareFalloff;
float flareCosInner;
float flareCosOuter;
float __unused__;
float3 flareTint;
float flareSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ float4 EvaluateLight_Directional(LightLoopContext lightLoopContext, PositionInpu
// Height fog attenuation.
{
// TODO: should probably unify height attenuation somehow...
float cosZenithAngle = L.y;
float cosZenithAngle = max(L.y, 0.001f);
float fragmentHeight = posInput.positionWS.y;
float3 oDepth = OpticalDepthHeightFog(_HeightFogBaseExtinction, _HeightFogBaseHeight,
_HeightFogExponents, cosZenithAngle, fragmentHeight);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ void DeferredContactShadow(uint2 groupThreadId : SV_GroupThreadID, uint2 groupId
// Do the contact shadow for the directional light
if (featureFlags & LIGHTFEATUREFLAGS_DIRECTIONAL)
{
if (_DirectionalShadowIndex >= 0)
for (uint i = 0; i < _DirectionalLightCount; ++i)
{
DirectionalLightData light = _DirectionalLightDatas[_DirectionalShadowIndex];
DirectionalLightData light = _DirectionalLightDatas[i];

if (light.contactShadowMask != 0 && light.isRayTracedContactShadow == 0.0)
{
Expand All @@ -214,6 +214,7 @@ void DeferredContactShadow(uint2 groupThreadId : SV_GroupThreadID, uint2 groupId
// we take full bits at one multiplied by contact shadow and filter the bit at the contact shadow index.
contactShadowMask |= light.contactShadowMask * occluded;
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,13 @@ TextureHandle RenderScreenSpaceShadows(RenderGraph renderGraph, HDCamera hdCamer
PrepassOutput prepassOutput, TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorsBuffer, TextureHandle historyValidityBuffer, TextureHandle rayCountTexture)
{
// If screen space shadows are not supported for this camera, we are done
if (!hdCamera.frameSettings.IsEnabled(FrameSettingsField.ScreenSpaceShadows) || !RequestedScreenSpaceShadows())
bool validConditions = hdCamera.frameSettings.IsEnabled(FrameSettingsField.ScreenSpaceShadows) && RequestedScreenSpaceShadows();
if (!validConditions)
{
// We push the debug texture anyway if we are not evaluating any screen space shadows.
PushFullScreenDebugTexture(m_RenderGraph, m_RenderGraph.defaultResources.whiteTextureXR, FullScreenDebugMode.ScreenSpaceShadows);
return m_RenderGraph.defaultResources.blackTextureArrayXR;
}

using (new RenderGraphProfilingScope(renderGraph, ProfilingSampler.Get(HDProfileId.ScreenSpaceShadows)))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ float EvalShadow_CascadedDepth_Blend_SplitIndex(HDShadowContext shadowContext, T
positionWS = basePositionWS + sd.cacheTranslationDelta.xyz;

/* normal based bias */
float worldTexelSize = sd.worldTexelSize;
float3 orig_pos = positionWS;
float3 normalBias = EvalShadow_NormalBias(sd.worldTexelSize, sd.normalBias, normalWS);
positionWS += normalBias;
Expand All @@ -283,6 +284,11 @@ float EvalShadow_CascadedDepth_Blend_SplitIndex(HDShadowContext shadowContext, T
if (alpha > 0.0)
{
LoadDirectionalShadowDatas(sd, shadowContext, index + shadowSplitIndex);

// We need to modify the bias as the world texel size changes between splits and an update is needed.
float biasModifier = (sd.worldTexelSize / worldTexelSize);
normalBias *= biasModifier;

float3 evaluationPosWS = basePositionWS + sd.cacheTranslationDelta.xyz + normalBias;
float3 posNDC;
posTC = EvalShadow_GetTexcoordsAtlas(sd, _CascadeShadowAtlasSize.zw, evaluationPosWS, posNDC, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ void KMain(uint3 dispatchThreadId : SV_DispatchThreadID)
float coc3 = cocBR.x;
float coc4 = cocBR.z;
#else
float coc1 = LOAD_TEXTURE2D_X(_InputCoCTexture, posInputs.positionSS - uint2(1u, 0u)).x; // Left
float coc2 = LOAD_TEXTURE2D_X(_InputCoCTexture, posInputs.positionSS - uint2(0u, 1u)).x; // Top
float coc3 = LOAD_TEXTURE2D_X(_InputCoCTexture, posInputs.positionSS + uint2(0u, 1u)).x; // Bottom
float coc4 = LOAD_TEXTURE2D_X(_InputCoCTexture, posInputs.positionSS + uint2(1u, 0u)).x; // Right
float2 coord = ClampAndScaleUVPostProcessTextureForPoint(posInputs.positionSS);
float coc1 = LOAD_TEXTURE2D_X(_InputCoCTexture, coord - uint2(1u, 0u)).x; // Left
float coc2 = LOAD_TEXTURE2D_X(_InputCoCTexture, coord - uint2(0u, 1u)).x; // Top
float coc3 = LOAD_TEXTURE2D_X(_InputCoCTexture, coord + uint2(0u, 1u)).x; // Bottom
float coc4 = LOAD_TEXTURE2D_X(_InputCoCTexture, coord + uint2(1u, 0u)).x; // Right
#endif

// Dejittered center sample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public void ResetIteration()
public uint height;
public bool skyEnabled;
public bool fogEnabled;
public ulong accelSize;

public float accumulatedWeight;
public uint currentIteration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,11 @@ void OnEnable()
m_Camera.allowMSAA = false; // We don't use this option in HD (it is legacy MSAA) and it produce a warning in the inspector UI if we let it
m_Camera.allowHDR = false;

// By doing that, we force the update of frame settings debug data once. Otherwise, when the Rendering Debugger is opened,
// Wrong data is registered to the undo system because it did not get the chance to be updated once.
FrameSettings dummy = new FrameSettings();
FrameSettingsHistory.AggregateFrameSettings(ref dummy, m_Camera, this, HDRenderPipeline.currentAsset, null);

RegisterDebug();

#if UNITY_EDITOR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,8 @@ public ScreenSpaceReflectionAlgorithm
MaterialPropertyBlock m_RecorderPropertyBlock = new MaterialPropertyBlock();
Rect? m_OverridePixelRect = null;

internal bool hasCaptureActions => m_RecorderCaptureActions != null;

// Keep track of the previous DLSS state
private DynamicResolutionHandler.UpsamplerScheduleType m_PrevUpsamplerSchedule = DynamicResolutionHandler.UpsamplerScheduleType.AfterPost;

Expand Down
Loading