Skip to content

Commit 1823215

Browse files
sebastienlagardeFrancescoC-unityakerfootanisunityAntoine Lelievre
authored
Merge Hd/bugfix (#2973)
* Fix random warnings (#2972) * Fix FreeCamera speed boost controls (#2967) Two issues: 1. Holding Shift key during mouse-look with right mouse button would only boost speed for a single frame because it was checking GetKeyDown. Fixed by checking GetKey. 2. The Shift key only gives a speed boost when mouse-looking with RMB, but the Fire input (LMB by default) should always work. However, there was an issue where Fire would not boost the camera if the RMB was held down. This change fixes that so Fire will always boost and Shift will still only boost during mouse-look. * Fixed an issue with the frame count management for the volumetric fog (case 1299251). (#2947) * [HDRP] Fix coat normal space (#2888) * Fix coat normal space * Update CHANGELOG.md Co-authored-by: Sebastien Lagarde <[email protected]> * Avoid issues causing faulty transitions in shadows (resulting in no shadows with unconventional aspect ratio) (#2776) * Fixed volume component tooltips using the same parameter name (#2754) * Use the proper history info for Bicubic resampling in TAA (#2759) * Use proper info for previous buffer info * changelog * Fixed lookdev movement (#2757) Co-authored-by: sebastienlagarde <[email protected]> * [HDRP] Fix issue with saving some quality settings in volume overrides (#2758) * Fix issue with saving some quality settings volume overrides * Fix typo in changelog Co-authored-by: sebastienlagarde <[email protected]> * [HDRP] Fixed NullReferenceException in HDRenderPipeline.UpgradeResourcesIfNeeded (case 1292524) (#2765) * fix issue with confusing text (#2766) * Fix * Fix white dots * Changelog * Rename the sunrise icon to fix typo, causing issue with 2x resolution loading. (#2809) * [HDRP] Rename HDRP to HD Render Pipeline in menu item (#2819) * [HDRP] Update HDRP menu in shader graph * Update CHANGELOG.md * HDRP/Fix package version showing package after the last "verified" package (#2783) * Fix typo * Remove last version checker from wizard and add link to package manager instead * Update CHANGELOG.md * Update documentation * Update Render-Pipeline-Wizard.md Co-authored-by: Sebastien Lagarde <[email protected]> * Revert bad changelog merge * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: Adrien de Tocqueville <[email protected]> Co-authored-by: sebastienlagarde <[email protected]> Co-authored-by: Pavlos Mavridis <[email protected]> Co-authored-by: John Parsaie <[email protected]> Co-authored-by: Remi Slysz <[email protected]> * Fixed invalid loop length for probe baking (case 1289680) (#2830) * Fixed invalid loop length for probe baking (case 1289680) # Conflicts: # com.unity.render-pipelines.high-definition/CHANGELOG.md # Conflicts: # com.unity.render-pipelines.high-definition/CHANGELOG.md * Update CHANGELOG.md Co-authored-by: sebastienlagarde <[email protected]> * Fix volumetric fog with XR single-pass (#2823) * fix volumetric fog with XR single-pass rendering * update changelog Co-authored-by: sebastienlagarde <[email protected]> * [HDRP] Fix rendering issues for the first frame (#2836) * Fix first frame exposure, depth pyramid / AO * Update changelog * Comment * Typo * Add missing RenderGraphBuilder.ReadTexture call * Move ComputePackedMipChainInfo at the beginning of ExecuteWithRenderGraph Co-authored-by: sebastienlagarde <[email protected]> * Update 5001_Fog_FogFallback.png * Revert "Update 5001_Fog_FogFallback.png" This reverts commit 2653b9c. * Update 5001_Fog_FogFallback.unity * Fix AOV API for render graph (#2909) * Fix AOV api in rendergraph # Conflicts: # com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs * Update changelog * Fix a small discrepancy in the marker placement in light intensity sliders (#2924) * Update CHANGELOG.md * Fix issue with VT spewing errors when transparent and opaque are disabled (#2925) * Fix * Changelog Co-authored-by: sebastienlagarde <[email protected]> * Fixed a bug in the sphere-aabb light cluster (case 1294767). (#2920) Co-authored-by: sebastienlagarde <[email protected]> * Move EndCameraRendering callback out of the profiling scope (#2917) * Move EndCameraRendering callback out of the profiling scope * added a comment Co-authored-by: sebastienlagarde <[email protected]> * Fixed baked light being included into the ray tracing light cluster (case 1296203). (#2915) Co-authored-by: sebastienlagarde <[email protected]> * Handle all enums the same way for UI (#2913) Co-authored-by: sebastienlagarde <[email protected]> * Changed the message when the graphics device doesn't support ray tracing (case 1287355). (#2916) * [HDRP] Fix default blocks for Hair and Eye shader graphs (#2919) * Fixed default eye shader blocks * Fix missing emission block in hair shader * Updated changelog Co-authored-by: sebastienlagarde <[email protected]> * Init scene camera debug framesettings (#2931) * Fixed using the wrong method to define if a light should be included in the light cluster depending on its baking status. (#2932) * - Fixed using the wrong method to define if a light should be included in the light cluster depending on its baking status. * Update CHANGELOG.md Co-authored-by: sebastienlagarde <[email protected]> * [HDRP] Change the behavior of custom passes when the volume is disabled (#2930) * Changed the behavior of custom passes when the Custom Pass Volume component is disabled * Updated changelog * Fixed display of LOD Bias and maximum level in frame settings when using Quality Levels (#2921) * Fixed display of LOD Bias and maximum level in frame settings when using Quality Levels * Update changelog Co-authored-by: sebastienlagarde <[email protected]> * Fixed an issue when trying to open a look dev env library when Look Dev is not supported. (#2929) * Fixed an issue when trying to open a look dev env library when Look Dev is not supported. * Update changelog Co-authored-by: sebastienlagarde <[email protected]> * Enable Reflector for Spotlight by default * - Fixed shader graph not supporting indirectdxr multibounce (case 1294694). (#2933) Co-authored-by: sebastienlagarde <[email protected]> * Fixed the planar depth texture not being properly created and rendered to (case 1299617). (#2926) * Fixed the planar depth texture not being properly created and rendered to (case 1299617). * adding comment Co-authored-by: sebastienlagarde <[email protected]> * Fixed an issue with the frame count management for the volumetric fog (case 1299251). * Update CHANGELOG.md Co-authored-by: Antoine Lelievre <[email protected]> Co-authored-by: Sebastien Lagarde <[email protected]> Co-authored-by: FrancescoC-unity <[email protected]> Co-authored-by: Adrien de Tocqueville <[email protected]> Co-authored-by: Pavlos Mavridis <[email protected]> Co-authored-by: John Parsaie <[email protected]> Co-authored-by: Remi Slysz <[email protected]> Co-authored-by: Frédéric Vauchelles <[email protected]> Co-authored-by: Fabien Houlmann <[email protected]> Co-authored-by: JulienIgnace-Unity <[email protected]> * - Changed the convergance time of ssgi to 16 frames. (#2912) - Changed the preset values for ssgi. - Fixed an issue with half res ssgi upscale. Co-authored-by: sebastienlagarde <[email protected]> * Fix BakeCloudShadows warning * Cleanup CubeToPanoMaterial not used * Revert: Fixed an issue with the frame count management for the volumetric fog (case 1299251). #2947 Co-authored-by: FrancescoC-unity <[email protected]> Co-authored-by: Alex Kerfoot <[email protected]> Co-authored-by: anisunity <[email protected]> Co-authored-by: Antoine Lelievre <[email protected]> Co-authored-by: Adrien de Tocqueville <[email protected]> Co-authored-by: Pavlos Mavridis <[email protected]> Co-authored-by: John Parsaie <[email protected]> Co-authored-by: Remi Slysz <[email protected]> Co-authored-by: Frédéric Vauchelles <[email protected]> Co-authored-by: Fabien Houlmann <[email protected]> Co-authored-by: JulienIgnace-Unity <[email protected]>
1 parent a15acdc commit 1823215

File tree

13 files changed

+59
-78
lines changed

13 files changed

+59
-78
lines changed

com.unity.render-pipelines.core/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111

1212
### Fixed
1313
- Fixed ACES tonemaping for Nintendo Switch by forcing some shader color conversion functions to full float precision.
14+
- Fixed a bug in FreeCamera which would only provide a speed boost for the first frame when pressing the Shfit key.
1415

1516
## [10.2.0] - 2020-10-19
1617

com.unity.render-pipelines.core/Runtime/Camera/FreeCamera.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ void UpdateInputs()
151151
inputRotateAxisX += (Input.GetAxis(kRightStickX) * m_LookSpeedController * Time.deltaTime);
152152
inputRotateAxisY += (Input.GetAxis(kRightStickY) * m_LookSpeedController * Time.deltaTime);
153153

154-
leftShift = Input.GetKeyDown(KeyCode.LeftShift);
154+
leftShift = Input.GetKey(KeyCode.LeftShift);
155155
fire1 = Input.GetAxis("Fire1") > 0.0f;
156156

157157
inputChangeSpeed = Input.GetAxis(kSpeedAxis);
@@ -192,10 +192,8 @@ void Update()
192192
transform.localRotation = Quaternion.Euler(newRotationX, newRotationY, transform.localEulerAngles.z);
193193

194194
float moveSpeed = Time.deltaTime * m_MoveSpeed;
195-
if (leftShiftBoost)
196-
moveSpeed *= leftShift ? m_Turbo : 1.0f;
197-
else
198-
moveSpeed *= fire1 ? m_Turbo : 1.0f;
195+
if (fire1 || leftShiftBoost && leftShift)
196+
moveSpeed *= m_Turbo;
199197
transform.position += transform.forward * moveSpeed * inputVertical;
200198
transform.position += transform.right * moveSpeed * inputHorizontal;
201199
transform.position += Vector3.up * moveSpeed * inputYAxis;

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3030
- Fixed computation of geometric normal in path tracing (case 1293029).
3131
- Fixed issues with path-traced volumetric scattering (cases 1295222, 1295234).
3232
- Fixed the default background color for previews to use the original color.
33+
- Fixed an issue with half res ssgi upscale.
3334

3435
### Changed
3536
- Removed the material pass probe volumes evaluation mode.
@@ -43,6 +44,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
4344
- Removed the upscale radius from the RTR.
4445
- Density Volumes can now take a 3D RenderTexture as mask, the mask can use RGBA format for RGB fog.
4546
- Decreased the minimal Fog Distance value in the Density Volume to 0.05.
47+
- Changed the convergence time of ssgi to 16 frames and the preset value
4648

4749
## [10.3.0] - 2020-12-01
4850

com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ bool UsesQualityMode()
2626
/// The thickness of the depth buffer value used for the ray marching step
2727
/// </summary>
2828
[Tooltip("Controls the thickness of the depth buffer used for ray marching.")]
29-
public ClampedFloatParameter depthBufferThickness = new ClampedFloatParameter(0.01f, 0, 1.0f);
29+
public ClampedFloatParameter depthBufferThickness = new ClampedFloatParameter(0.2f, 0.0f, 0.5f);
3030

3131
GlobalIllumination()
3232
{

com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,10 @@ internal class LightLoopTextureCaches
319319
public List<Vector4> env2DCaptureForward { get; private set; }
320320
public List<Vector4> env2DAtlasScaleOffset {get; private set; } = new List<Vector4>();
321321

322-
Material m_CubeToPanoMaterial;
323-
324322
public void Initialize(HDRenderPipelineAsset hdrpAsset, RenderPipelineResources defaultResources, IBLFilterBSDF[] iBLFilterBSDFArray)
325323
{
326324
var lightLoopSettings = hdrpAsset.currentPlatformRenderPipelineSettings.lightLoopSettings;
327325

328-
m_CubeToPanoMaterial = CoreUtils.CreateEngineMaterial(defaultResources.shaders.cubeToPanoPS);
329-
330326
lightCookieManager = new LightCookieManager(hdrpAsset, k_MaxCacheSize);
331327

332328
env2DCaptureVP = new List<Matrix4x4>();
@@ -365,8 +361,6 @@ public void Cleanup()
365361
reflectionProbeCache.Release();
366362
reflectionPlanarProbeCache.Release();
367363
lightCookieManager.Release();
368-
369-
CoreUtils.Destroy(m_CubeToPanoMaterial);
370364
}
371365

372366
public void NewFrame()

com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.RenderGraph.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class ConvertSSGIPassData
121121

122122
TextureHandle ConvertSSGI(RenderGraph renderGraph, HDCamera hdCamera, bool halfResolution, TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle inoutputBuffer0, TextureHandle inoutputBuffer1)
123123
{
124-
using (var builder = renderGraph.AddRenderPass<ConvertSSGIPassData>("Upscale SSGI", out var passData, ProfilingSampler.Get(HDProfileId.SSGIUpscale)))
124+
using (var builder = renderGraph.AddRenderPass<ConvertSSGIPassData>("Upscale SSGI", out var passData, ProfilingSampler.Get(HDProfileId.SSGIConvert)))
125125
{
126126
builder.EnableAsyncCompute(false);
127127

com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.compute

Lines changed: 33 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
// Epslon value used for the computation
2626
#define GI_TRACE_EPS 0.00024414
2727

28+
#define PERCEPTUAL_SPACE
29+
2830
// Input depth pyramid texture
2931
TEXTURE2D_X(_DepthTexture);
3032
// Input texture that holds the offset for every level of the depth pyramid
@@ -42,6 +44,7 @@ CBUFFER_START(UnityScreenSpaceGlobalIllumination)
4244
int _IndirectDiffuseProbeFallbackBias;
4345
float4 _ColorPyramidUvScaleAndLimitPrevFrame;
4446
int _SsrStencilBit;
47+
int _IndirectDiffuseFrameIndex;
4548
CBUFFER_END
4649

4750
// Output texture that holds the hit point NDC coordinates
@@ -62,7 +65,7 @@ bool RayMarch(float3 positionWS, float3 sampleDir, float3 normalWS, float2 posit
6265
// We start tracing from the center of the current pixel, and do so up to the far plane.
6366
float3 rayOrigin = float3(positionSS + 0.5, deviceDepth);
6467

65-
float3 sampledPosWS = positionWS + sampleDir * 0.01;
68+
float3 sampledPosWS = positionWS + sampleDir * 0.001;
6669
float3 sampledPosNDC = ComputeNormalizedDeviceCoordinatesWithZ(sampledPosWS, UNITY_MATRIX_VP); // Jittered
6770
float3 sampledPosSS = float3(sampledPosNDC.xy * _ScreenSize.xy, sampledPosNDC.z);
6871

@@ -206,27 +209,20 @@ void TRACE_GLOBAL_ILLUMINATION(uint3 dispatchThreadId : SV_DispatchThreadID, uin
206209
uint2 currentCoord = dispatchThreadId.xy;
207210

208211
#if HALF_RES
209-
// Fetch the mipoffset for the second mip (half res)
210-
int2 mipOffset = _DepthPyramidMipLevelOffsets[1];
211-
// Grab the depth of the half res pixel (better than grabbing a random one across the 4 candidates or averaging)
212-
float deviceDepth = LOAD_TEXTURE2D_X(_DepthTexture, mipOffset + currentCoord).x;
213212
// Compute the full resolution pixel for the inputs that do not have a pyramid
214-
uint2 fullResCoord = currentCoord * 2;
215-
#else
213+
currentCoord = currentCoord * 2;
214+
#endif
215+
216216
// Read the depth value as early as possible
217217
float deviceDepth = LOAD_TEXTURE2D_X(_DepthTexture, currentCoord).x;
218-
#endif
218+
219219
// Initialize the hitpoint texture to a miss
220-
_IndirectDiffuseHitPointTextureRW[COORD_TEXTURE2D_X(currentCoord)] = float2(99.0, 0.0);
220+
_IndirectDiffuseHitPointTextureRW[COORD_TEXTURE2D_X(dispatchThreadId.xy)] = float2(99.0, 0.0);
221221

222222
// Read the pixel normal
223223
NormalData normalData;
224-
#if HALF_RES
225-
// For half resolution, we take the top left corner (0, 0) in the upscaled 2x2 pixel neighborhood
226-
DecodeFromNormalBuffer(fullResCoord.xy, normalData);
227-
#else
228224
DecodeFromNormalBuffer(currentCoord.xy, normalData);
229-
#endif
225+
230226
// Generete a new direction to follow
231227
float2 newSample;
232228
newSample.x = GetBNDSequenceSample(currentCoord.xy, _RaytracingFrameIndex, 0);
@@ -241,11 +237,7 @@ void TRACE_GLOBAL_ILLUMINATION(uint3 dispatchThreadId : SV_DispatchThreadID, uin
241237
// If this is a background pixel, we flag the ray as a dead ray (we are also trying to keep the usage of the depth buffer the latest possible)
242238
bool killRay = deviceDepth == UNITY_RAW_FAR_CLIP_VALUE;
243239
// Convert this to a world space position (camera relative)
244-
#if HALF_RES
245-
PositionInputs posInput = GetPositionInput(fullResCoord, _ScreenSize.zw, deviceDepth, UNITY_MATRIX_I_VP, GetWorldToViewMatrix(), 0);
246-
#else
247240
PositionInputs posInput = GetPositionInput(currentCoord, _ScreenSize.zw, deviceDepth, UNITY_MATRIX_I_VP, GetWorldToViewMatrix(), 0);
248-
#endif
249241

250242
// Compute the view direction (world space)
251243
float3 viewWS = GetWorldSpaceNormalizeViewDir(posInput.positionWS);
@@ -266,7 +258,7 @@ void TRACE_GLOBAL_ILLUMINATION(uint3 dispatchThreadId : SV_DispatchThreadID, uin
266258
// recompute it using the last value of 't', which would result in an overshoot.
267259
// It also needs to be precisely at the center of the pixel to avoid artifacts.
268260
float2 hitPositionNDC = floor(rayPos.xy) * _ScreenSize.zw + (0.5 * _ScreenSize.zw); // Should we precompute the half-texel bias? We seem to use it a lot.
269-
_IndirectDiffuseHitPointTextureRW[COORD_TEXTURE2D_X(currentCoord)] = hitPositionNDC;
261+
_IndirectDiffuseHitPointTextureRW[COORD_TEXTURE2D_X(dispatchThreadId.xy)] = hitPositionNDC;
270262
}
271263
}
272264

@@ -310,19 +302,14 @@ void REPROJECT_GLOBAL_ILLUMINATION(uint3 dispatchThreadId : SV_DispatchThreadID,
310302
uint2 currentCoord = groupId * INDIRECT_DIFFUSE_TILE_SIZE + groupThreadId;
311303

312304
#if HALF_RES
313-
// Fetch the mipoffset for the second mip (given that we are in half res)
314-
int2 mipOffset = _DepthPyramidMipLevelOffsets[1];
315-
float deviceDepth = LOAD_TEXTURE2D_X(_DepthTexture, mipOffset + currentCoord).x;
316-
317305
// Compute the full resolution pixel for the inputs that do not have a pyramid
318-
uint2 fullResCoord = currentCoord * 2;
319-
#else
320-
// Fetch the depth of the current pixel
321-
float deviceDepth = LOAD_TEXTURE2D_X(_DepthTexture, currentCoord).x;
306+
currentCoord = currentCoord * 2;
322307
#endif
323308

309+
float deviceDepth = LOAD_TEXTURE2D_X(_DepthTexture, currentCoord).x;
310+
324311
// Read the hit point ndc position to fetch
325-
float2 hitPositionNDC = LOAD_TEXTURE2D_X(_IndirectDiffuseHitPointTexture, currentCoord).xy;
312+
float2 hitPositionNDC = LOAD_TEXTURE2D_X(_IndirectDiffuseHitPointTexture, dispatchThreadId.xy).xy;
326313

327314
// Grab the depth of the hit point
328315
float hitPointDepth = LOAD_TEXTURE2D_X(_DepthTexture, hitPositionNDC * _ScreenSize.xy).x;
@@ -336,7 +323,7 @@ void REPROJECT_GLOBAL_ILLUMINATION(uint3 dispatchThreadId : SV_DispatchThreadID,
336323

337324
// Fetch the motion vector of the current target pixel
338325
float2 motionVectorNDC;
339-
DecodeMotionVector(SAMPLE_TEXTURE2D_X_LOD(_CameraMotionVectorsTexture, s_linear_clamp_sampler, min(hitPositionNDC, 1.0f - 0.5f * _ScreenSize.zw) * _RTHandleScale.xy, 0), motionVectorNDC);
326+
DecodeMotionVector(SAMPLE_TEXTURE2D_X_LOD(_CameraMotionVectorsTexture, s_linear_clamp_sampler, hitPositionNDC, 0), motionVectorNDC);
340327

341328
float2 prevFrameNDC = hitPositionNDC - motionVectorNDC;
342329
float2 prevFrameUV = prevFrameNDC * _ColorPyramidUvScaleAndLimitPrevFrame.xy;
@@ -366,20 +353,17 @@ void REPROJECT_GLOBAL_ILLUMINATION(uint3 dispatchThreadId : SV_DispatchThreadID,
366353

367354
// We need to recreate the direction that was generated
368355
float2 newSample;
369-
newSample.x = GetBNDSequenceSample(currentCoord.xy, _RaytracingFrameIndex, 0);
370-
newSample.y = GetBNDSequenceSample(currentCoord.xy, _RaytracingFrameIndex, 1);
356+
newSample.x = GetBNDSequenceSample(currentCoord.xy, _IndirectDiffuseFrameIndex, 0);
357+
newSample.y = GetBNDSequenceSample(currentCoord.xy, _IndirectDiffuseFrameIndex, 1);
371358

372359
// Read the pixel normal
373360
NormalData normalData;
374-
#if HALF_RES
375-
// For half resolution, we take the top left corner (0, 0) in the upscaled 2x2 pixel neighborhood
376-
DecodeFromNormalBuffer(fullResCoord.xy, normalData);
377-
#else
378361
DecodeFromNormalBuffer(currentCoord.xy, normalData);
379-
#endif
380362

363+
#ifdef PERCEPTUAL_SPACE
381364
// We tone map the signal. Due to the very small budget for denoising, we need to compress the range of the signal
382365
color = color / (1.0 + color);
366+
#endif
383367

384368
// Re-compute the direction that was used to do the generation
385369
float3 sampleDir = SampleHemisphereCosine(newSample.x, newSample.y, normalData.normalWS);
@@ -392,8 +376,8 @@ void REPROJECT_GLOBAL_ILLUMINATION(uint3 dispatchThreadId : SV_DispatchThreadID,
392376
// We are simply interested to know if the intersected pixel was moving, so we multiply it by a big number
393377
// TODO: make this process not binary
394378
// Write the output to the target pixel
395-
_IndirectDiffuseTexture0RW[COORD_TEXTURE2D_X(currentCoord)] = float4(outYSH);
396-
_IndirectDiffuseTexture1RW[COORD_TEXTURE2D_X(currentCoord)] = float4(outCoCg, invalid ? 0.0 : 1.0, length(motionVectorNDC * 10000.0f));
379+
_IndirectDiffuseTexture0RW[COORD_TEXTURE2D_X(dispatchThreadId.xy)] = float4(outYSH);
380+
_IndirectDiffuseTexture1RW[COORD_TEXTURE2D_X(dispatchThreadId.xy)] = float4(outCoCg, invalid ? 0.0 : 1.0, length(motionVectorNDC * 10000.0f));
397381
}
398382

399383
void ConvertYCoCgToRGBUtil(float4 inYSH, float2 inCoCg, float3 inNormal, out float3 outColor)
@@ -423,54 +407,47 @@ void CONVERT_YCOCG_TO_RGB(uint3 dispatchThreadId : SV_DispatchThreadID, uint2 gr
423407
UNITY_XR_ASSIGN_VIEW_INDEX(dispatchThreadId.z);
424408

425409
// Fetch the current pixel coordinate
426-
uint2 currentCoord = groupId * INDIRECT_DIFFUSE_TILE_SIZE + groupThreadId;
410+
uint2 currentCoord = dispatchThreadId.xy;
427411

428412
// If the depth of this pixel is the depth of the background, we can end the process right away
429413
#if HALF_RES
430-
// Fetch the mipoffset for the second mip (given that we are in half res)
431-
int2 mipOffset = _DepthPyramidMipLevelOffsets[1];
432-
float deviceDepth = LOAD_TEXTURE2D_X(_DepthTexture, mipOffset + currentCoord).x;
414+
currentCoord = currentCoord * 2;
415+
#endif
433416

434-
// Compute the full resolution pixel for the inputs that do not have a pyramid
435-
uint2 fullResCoord = currentCoord * 2;
436-
#else
437417
// Fetch the depth of the current pixel
438418
float deviceDepth = LOAD_TEXTURE2D_X(_DepthTexture, currentCoord).x;
439-
#endif
419+
440420
if (deviceDepth == UNITY_RAW_FAR_CLIP_VALUE)
441421
{
442-
_IndirectDiffuseTexture0RW[COORD_TEXTURE2D_X(currentCoord)] = float4(0.0, 0.0, 0.0, 0.0);
422+
_IndirectDiffuseTexture0RW[COORD_TEXTURE2D_X(dispatchThreadId.xy)] = float4(0.0, 0.0, 0.0, 0.0);
443423
return;
444424
}
445425

446426
// Fetch the normal
447427
NormalData normalData;
448-
#if HALF_RES
449-
// For half resolution, we take the top left corner (0, 0) in the upscaled 2x2 pixel neighborhood
450-
DecodeFromNormalBuffer(fullResCoord.xy, normalData);
451-
#else
452428
DecodeFromNormalBuffer(currentCoord.xy, normalData);
453-
#endif
454429

455430
// Convert the signal back to a color
456431
float3 color;
457-
float4 ySH = _IndirectDiffuseTexture0RW[COORD_TEXTURE2D_X(currentCoord)];
458-
float3 cocgB = LOAD_TEXTURE2D_X(_IndirectDiffuseTexture1, currentCoord).xyz;
432+
float4 ySH = _IndirectDiffuseTexture0RW[COORD_TEXTURE2D_X(dispatchThreadId.xy)];
433+
float3 cocgB = LOAD_TEXTURE2D_X(_IndirectDiffuseTexture1, dispatchThreadId.xy).xyz;
459434
ConvertYCoCgToRGBUtil(ySH, cocgB.xy, normalData.normalWS, color);
460435

436+
#ifdef PERCEPTUAL_SPACE
461437
// We invert the tonemap
462438
color = color / (1.0 - color);
463439

464440
// The mulitplication is wrong, but with all the approximations that we need to compensate a bit
465441
// the fact that the signal was significantly attenuated (due to blurring in tonemapped space to reduce the blobbyness).
466442
// This has been experimentally tested. However, it needs more testing and potetially reverted if found more harmful than useful
467-
color *= (lerp(2.5, 1.0, cocgB.z));
443+
color *= (lerp(5.0, 1.0, cocgB.z));
444+
#endif
468445

469446
// Does this pixel recieve SSGI?
470447
uint stencilValue = GetStencilValue(LOAD_TEXTURE2D_X(_StencilTexture, currentCoord));
471448
if ((stencilValue & _SsrStencilBit) == 0)
472449
cocgB.z = 0.0;
473450

474451
// Output the color as well as the blend factor
475-
_IndirectDiffuseTexture0RW[COORD_TEXTURE2D_X(currentCoord)] = float4(color, cocgB.z);
452+
_IndirectDiffuseTexture0RW[COORD_TEXTURE2D_X(dispatchThreadId.xy)] = float4(color, cocgB.z);
476453
}

com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,16 @@ SSGIConvertParameters PrepareSSGIConvertParameters(HDCamera hdCamera, bool halfR
215215
SSGIConvertParameters parameters = new SSGIConvertParameters();
216216

217217
// Set the camera parameters
218-
parameters.texWidth = hdCamera.actualWidth;
219-
parameters.texHeight = hdCamera.actualHeight;
218+
if (!halfResolution)
219+
{
220+
parameters.texWidth = hdCamera.actualWidth;
221+
parameters.texHeight = hdCamera.actualHeight;
222+
}
223+
else
224+
{
225+
parameters.texWidth = hdCamera.actualWidth / 2;
226+
parameters.texHeight = hdCamera.actualHeight / 2;
227+
}
220228
parameters.viewCount = hdCamera.viewCount;
221229

222230
// Grab the right kernel

com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/DebugDensityVolumeAtlas.shader

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Shader "Hidden/HDRP/DebugDensityVolumeAtlas"
4141

4242
float3 GetUVs(float2 texcoords)
4343
{
44-
return float3(texcoords * float2(1, _TextureSize.x / _TextureSize.y) * _TextureSize, _Slice) + _Offset;
44+
return float3(texcoords * float2(1, _TextureSize.x / _TextureSize.y) * _TextureSize.xy, _Slice) + _Offset;
4545
}
4646

4747
float4 Color(Varyings input) : SV_Target

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/GlobalLightingQualitySettings.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ internal GlobalLightingQualitySettings()
4444
SSRMaxRaySteps[(int)ScalableSettingLevelParameter.Level.High] = 64;
4545

4646
/* Screen Space Global Illumination */
47-
SSGIRaySteps[(int)ScalableSettingLevelParameter.Level.Low] = 24;
48-
SSGIRaySteps[(int)ScalableSettingLevelParameter.Level.Medium] = 32;
49-
SSGIRaySteps[(int)ScalableSettingLevelParameter.Level.High] = 64;
47+
SSGIRaySteps[(int)ScalableSettingLevelParameter.Level.Low] = 32;
48+
SSGIRaySteps[(int)ScalableSettingLevelParameter.Level.Medium] = 64;
49+
SSGIRaySteps[(int)ScalableSettingLevelParameter.Level.High] = 96;
5050

5151
SSGIFullResolution[(int)ScalableSettingLevelParameter.Level.Low] = false;
5252
SSGIFullResolution[(int)ScalableSettingLevelParameter.Level.Medium] = true;
5353
SSGIFullResolution[(int)ScalableSettingLevelParameter.Level.High] = true;
5454

55-
SSGIFilterRadius[(int)ScalableSettingLevelParameter.Level.Low] = 2;
55+
SSGIFilterRadius[(int)ScalableSettingLevelParameter.Level.Low] = 3;
5656
SSGIFilterRadius[(int)ScalableSettingLevelParameter.Level.Medium] = 5;
5757
SSGIFilterRadius[(int)ScalableSettingLevelParameter.Level.High] = 7;
5858

0 commit comments

Comments
 (0)