From 67ae3c3328be12f658bfde65ec28fab4af7ba233 Mon Sep 17 00:00:00 2001 From: sebastienlagarde Date: Mon, 2 Aug 2021 22:24:00 +0200 Subject: [PATCH 1/6] Merge Hd/bugfix #5255 --- .../Editor/Volume/Drawers/IntParameterDrawer.cs | 3 ++- .../CHANGELOG.md | 6 ++++++ .../Documentation~/Decal-Projector.md | 5 +++-- .../Documentation~/Decal-Shader.md | 2 +- .../Editor/Material/UIBlocks/EmissionUIBlock.cs | 6 ++++-- .../Runtime/Compositor/CompositionManager.cs | 4 ++-- .../Runtime/Lighting/LightLoop/LightLoop.hlsl | 3 ++- .../Runtime/Lighting/LightUtils.cs | 9 +++++---- .../VolumetricLighting/VolumetricLighting.cs | 4 ++-- .../Runtime/Material/Lit/Lit.hlsl | 4 ---- .../RenderPipeline/PathTracing/PathTracing.cs | 7 +++++++ .../Raytracing/Shaders/RaytracingIntersection.hlsl | 12 +++++++++--- 12 files changed, 43 insertions(+), 22 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/Volume/Drawers/IntParameterDrawer.cs b/com.unity.render-pipelines.core/Editor/Volume/Drawers/IntParameterDrawer.cs index 67c2fc98c09..a0d6f1ab202 100644 --- a/com.unity.render-pipelines.core/Editor/Volume/Drawers/IntParameterDrawer.cs +++ b/com.unity.render-pipelines.core/Editor/Volume/Drawers/IntParameterDrawer.cs @@ -116,7 +116,8 @@ public override bool OnGUI(SerializedDataParameter parameter, GUIContent title) if (value.propertyType != SerializedPropertyType.LayerMask) return false; - value.intValue = EditorGUILayout.MaskField(title, value.intValue, InternalEditorUtility.layers); + value.intValue = InternalEditorUtility.ConcatenatedLayersMaskToLayerMask( + EditorGUILayout.MaskField(title, InternalEditorUtility.LayerMaskToConcatenatedLayersMask(value.intValue), InternalEditorUtility.layers)); return true; } } diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index ccc507fcab8..d10872d5d82 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -24,6 +24,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed the FreeCamera and SimpleCameraController mouse rotation unusable at low framerate (case 1340344). - Fixed warning "Releasing render texture that is set to be RenderTexture.active!" on pipeline disposal / hdrp live editing. - Fixed a nullref in volume system after deleting a volume object (case 1348374). +- Fixed update order in Graphics Compositor causing jumpy camera updates (case 1345566). +- Fixed material inspector that allowed setting intensity to an infinite value. +- Fixed issue when switching between non-persistent cameras when path tarcing is enabled (case 1337843). +- Fixed issue with the LayerMaskParameter class storing an erroneous mask value (case 1345515). +- Fixed issue with vertex color defaulting to 0.0 when not defined, in ray/path tracing (case 1348821). +- Fix issue with a compute dispatch being with 0 threads on extremely small resolutions. ## [10.6.0] - 2021-04-29 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Decal-Projector.md b/com.unity.render-pipelines.high-definition/Documentation~/Decal-Projector.md index 21c74bf2764..882a9062e6b 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Decal-Projector.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Decal-Projector.md @@ -49,8 +49,9 @@ Using the Inspector allows you to change all of the Decal Projector properties, ## Limitations -- The Decal Projector can affect opaque Materials with either a [Decal Shader](Decal-Shader.md) or a [Decal Master Stack](master-stack-decal.md). However, it can only affect transparent Materials with the [Decal Shader](Decal-Shader.md). -- Decal Emissive isn't supported on Transparent Material. +- The Decal Projector can affect opaque Materials with either a [Decal Shader](Decal-Shader.md) or a [Decal Master Stack](master-stack-decal.md). However, it can only affect transparent Materials with the [Decal Shader](Decal-Shader.md). +- Emissive decals isn't supported on Transparent Material. +- Emissive decals always give an additive positive contribution. This property does not affect the existing emissive properties of the Materials assigned to a GameObject. - The **Receive Decals** property of Materials in HDRP does not affect emissive decals. HDRP always renders emissive decals unless you use Decal Layers, which can disable emissive decals on a Layer by Layer basis. - If you project a decal onto a transparent surface, HDRP ignores the decal's Texture tiling. - In **Project Settings > Graphics**, if **Instancing Variants** is set to **Strip All**, Unity strips the Decal Shader this component references when you build your Project. This happens even if you include the Shader in the **Always Included Shaders** list. If Unity strips the Shader during the build process, the decal does not appear in your built Application. diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Decal-Shader.md b/com.unity.render-pipelines.high-definition/Documentation~/Decal-Shader.md index 98d74451cdf..f3ce9b8b3cc 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Decal-Shader.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Decal-Shader.md @@ -15,7 +15,7 @@ These properties allow you to set the affected attributes of the Material the de | **Affect Metal** | Enable the checkbox to make the decal use the metallic property of its **Mask Map**. Otherwise the decal has no metallic effect. Uses the red channel of the **Mask Map**.
This property only appears when you enable the **Metal and Ambient Occlusion properties** checkbox in your [HDRP Asset](HDRP-Asset.md#Decals). | | **Affect Ambient Occlusion** | Enable the checkbox to make the decal use the ambient occlusion property of its **Mask Map**. Otherwise the decal has no ambient occlusion effect. Uses the green channel of the **Mask Map**.
This property only appears when you enable the **Metal and Ambient Occlusion properties** checkbox in your [HDRP Asset](HDRP-Asset.md#Decals). | | **Affect Smoothness** | Enable the checkbox to make the decal use the smoothness property of its **Mask Map**. Otherwise the decal has no smoothness effect. Uses the alpha channel of the **Mask Map**.
| -| **Affect Emissive** | Enable the checkbox to make this decal emissive. When enabled, this Material appears self-illuminated and acts as a visible source of light. This property does not work with transparent receiving Materials. | +| **Affect Emissive** | Enable the checkbox to make this decal emissive. When enabled, this Material appears self-illuminated and acts as a visible source of light. This property does not work with transparent receiving Materials. Emissive decals always give an additive positive contribution. This property does not affect the existing emissive properties of the Materials assigned to a GameObject. | ### Surface Inputs diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/EmissionUIBlock.cs b/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/EmissionUIBlock.cs index 3e6a935a4c9..f86a2a474f3 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/EmissionUIBlock.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/EmissionUIBlock.cs @@ -11,6 +11,8 @@ namespace UnityEditor.Rendering.HighDefinition { class EmissionUIBlock : MaterialUIBlock { + static float s_MaxEvValue = Mathf.Floor(LightUtils.ConvertLuminanceToEv(float.MaxValue)); + [Flags] public enum Features { @@ -119,7 +121,7 @@ internal static void UpdateEmissiveColorFromIntensityAndEmissiveColorLDR(Materia internal static void UpdateEmissiveColorLDRFromIntensityAndEmissiveColor(MaterialProperty emissiveColorLDR, MaterialProperty emissiveIntensity, MaterialProperty emissiveColor) { - Color emissiveColorLDRLinear = emissiveColorLDR.colorValue / emissiveIntensity.floatValue; + Color emissiveColorLDRLinear = emissiveColor.colorValue / emissiveIntensity.floatValue; emissiveColorLDR.colorValue = emissiveColorLDRLinear.gamma; } @@ -183,7 +185,7 @@ void DrawEmissionGUI() { float evValue = LightUtils.ConvertLuminanceToEv(emissiveIntensity.floatValue); evValue = EditorGUILayout.FloatField(Styles.emissiveIntensityText, evValue); - newIntensity = Mathf.Clamp(evValue, 0, float.MaxValue); + newIntensity = Mathf.Clamp(evValue, 0, s_MaxEvValue); emissiveIntensity.floatValue = LightUtils.ConvertEvToLuminance(evValue); } else diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs index b226e4f04f0..44018389788 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs @@ -503,8 +503,8 @@ public void UpdateLayerSetup() SetupLayerPriorities(); } - // Update is called once per frame - void Update() + // LateUpdate is called once per frame + void LateUpdate() { // TODO: move all validation calls to onValidate. Before doing it, this needs some extra testing to ensure nothing breaks if (enableOutput == false || ValidatePipeline() == false || ValidateAndFixRuntime() == false || RuntimeCheck() == false) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl index b09d0182e06..97f3e51ff85 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.hlsl @@ -9,7 +9,8 @@ #ifndef SCALARIZE_LIGHT_LOOP // We perform scalarization only for forward rendering as for deferred loads will already be scalar since tiles will match waves and therefore all threads will read from the same tile. -// More info on scalarization: https://flashypixels.wordpress.com/2018/11/10/intro-to-gpu-scalarization-part-2-scalarize-all-the-lights/ +// More info on scalarization: https://flashypixels.wordpress.com/2018/11/10/intro-to-gpu-scalarization-part-2-scalarize-all-the-lights/ . +// Note that it is currently disabled on gamecore platforms for issues with wave intrinsics and the new compiler, it will be soon investigated, but we disable it in the meantime. #define SCALARIZE_LIGHT_LOOP (defined(PLATFORM_SUPPORTS_WAVE_INTRINSICS) && !defined(LIGHTLOOP_DISABLE_TILE_AND_CLUSTER) && !defined(SHADER_API_GAMECORE) && SHADERPASS == SHADERPASS_FORWARD) #endif diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightUtils.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightUtils.cs index 82c24fd71d7..ab61d69465c 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightUtils.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightUtils.cs @@ -8,6 +8,9 @@ namespace UnityEngine.Rendering.HighDefinition /// class LightUtils { + 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) // Punctual light (point, spot) are convert to candela (cd = lumens / steradian) @@ -163,8 +166,7 @@ public static float ConvertCandelaToLux(float candela, float distance) /// public static float ConvertEvToLuminance(float ev) { - float k = ColorUtils.s_LightMeterCalibrationConstant; - return (k / 100.0f) * Mathf.Pow(2, ev); + return Mathf.Pow(2, ev + s_EvToLuminanceFactor); } @@ -194,8 +196,7 @@ public static float ConvertEvToLux(float ev, float distance) /// public static float ConvertLuminanceToEv(float luminance) { - float k = ColorUtils.s_LightMeterCalibrationConstant; - return (float)Math.Log((luminance * 100f) / k, 2); + return Mathf.Log(luminance, 2) + s_LuminanceToEvFactor; } /// diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs index 78ad753392a..f596e72d4d8 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs @@ -481,8 +481,8 @@ static void GenerateMaxZ(in GenerateMaxZParameters parameters, RTHandle depthTex cmd.SetComputeVectorParam(cs, HDShaderIDs._SrcOffsetAndLimit, srcLimitAndDepthOffset); cmd.SetComputeFloatParam(cs, HDShaderIDs._DilationWidth, parameters.dilationWidth); - int finalMaskW = maskW / 2; - int finalMaskH = maskH / 2; + int finalMaskW = Mathf.CeilToInt(maskW / 2.0f); + int finalMaskH = Mathf.CeilToInt(maskH / 2.0f); dispatchX = HDUtils.DivRoundUp(finalMaskW, 8); dispatchY = HDUtils.DivRoundUp(finalMaskH, 8); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl index 4ef82d49d57..a3ccf316d41 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl @@ -88,10 +88,6 @@ TEXTURE2D_X(_ShadowMaskTexture); // Alias for shadow mask, so we don't need to k // If a user do a lighting architecture without material classification, this can be remove #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs.hlsl" -// Currently disable SSR until critical editor fix is available -#undef LIGHTFEATUREFLAGS_SSREFLECTION -#define LIGHTFEATUREFLAGS_SSREFLECTION 0 - // Combination need to be define in increasing "comlexity" order as define by FeatureFlagsToTileVariant static const uint kFeatureVariantFlags[NUM_FEATURE_VARIANTS] = { diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs index d1146419b96..e26fa9de1f2 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs @@ -385,6 +385,13 @@ TextureHandle RenderPathTracing(RenderGraph renderGraph, HDCamera hdCamera) // Refactor that when we formalize how to handle persistent textures better (with automatic lifetime and such). var radianceTexture = renderGraph.ImportTexture(m_RadianceTexture); + // Check if the camera has a valid history buffer and if not reset the accumulation. + // This can happen if a script disables and re-enables the camera (case 1337843). + if (!hdCamera.isPersistent && hdCamera.GetCurrentFrameRT((int)HDCameraFrameHistoryType.PathTracing) == null) + { + m_SubFrameManager.Reset(camID); + } + if (!m_SubFrameManager.isRecording) { // If we are recording, the max iteration is set/overridden by the subframe manager, otherwise we read it from the path tracing volume diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl index 8ce553b35c6..e84ca7b4d10 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl @@ -106,9 +106,15 @@ void FetchIntersectionVertex(uint vertexIndex, out IntersectionVertex outVertex) #ifdef ATTRIBUTES_NEED_COLOR outVertex.color = UnityRayTracingFetchVertexAttribute4(vertexIndex, kVertexAttributeColor); - #else - outVertex.color = 0.0; - #endif + + // We want to default to white in case there is no specified color, to match the raster behaviour + // FIXME: This could be addressed in UnityRayTracingFetchVertexAttribute4(), but until then we use this workaround + if (!any(outVertex.color)) + outVertex.color = 1.0; + + #else + outVertex.color = 0.0; + #endif } void GetCurrentIntersectionVertex(AttributeData attributeData, out IntersectionVertex outVertex) From d61f796291d9850e66c29303bde8de0cf93493e2 Mon Sep 17 00:00:00 2001 From: sebastienlagarde Date: Thu, 5 Aug 2021 17:46:28 +0200 Subject: [PATCH 2/6] Merge Hd/bugfix #5306 --- .../CHANGELOG.md | 5 ++++- .../Runtime/Lighting/LightLoop/LightLoop.cs | 3 +++ .../Runtime/Material/AxF/AxF.cs | 7 +++++++ .../Material/PreIntegratedFGD/PreIntegratedFGD.cs | 8 ++++++++ .../Runtime/RenderPipeline/Camera/HDCamera.cs | 2 +- .../ShaderPass/MotionVectorVertexShaderCommon.hlsl | 13 ++++++++++--- 6 files changed, 33 insertions(+), 5 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index d10872d5d82..a4c997c2ac3 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -29,7 +29,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed issue when switching between non-persistent cameras when path tarcing is enabled (case 1337843). - Fixed issue with the LayerMaskParameter class storing an erroneous mask value (case 1345515). - Fixed issue with vertex color defaulting to 0.0 when not defined, in ray/path tracing (case 1348821). -- Fix issue with a compute dispatch being with 0 threads on extremely small resolutions. +- Fixed issue with a compute dispatch being with 0 threads on extremely small resolutions. +- Fixed incorrect light list indexing when TAA is enabled (case 1352444). +- Fixed Additional Velocity for Alembic not taking correctly into account vertex animation +- Fixed wrong LUT initialization in Wireframe mode. ## [10.6.0] - 2021-04-29 diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs index 555fae64aa9..14a887886ae 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs @@ -3360,6 +3360,9 @@ unsafe BuildGPULightListParameters PrepareBuildGPULightListParameters( HDCamera for (int viewIndex = 0; viewIndex < hdCamera.viewCount; ++viewIndex) { var proj = hdCamera.xr.enabled ? hdCamera.xr.GetProjMatrix(viewIndex) : camera.projectionMatrix; + // Note: we need to take into account the TAA jitter when indexing the light list + proj = (hdCamera.antialiasing == AntialiasingMode.TemporalAntialiasing) ? hdCamera.GetJitteredProjectionMatrix(proj) : proj; + m_LightListProjMatrices[viewIndex] = proj * s_FlipMatrixLHSRHS; for (int i = 0; i < 16; ++i) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/AxF.cs b/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/AxF.cs index d21e756fa22..c59fb311aef 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/AxF.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/AxF.cs @@ -272,6 +272,13 @@ public override void RenderInit(CommandBuffer cmd) return; } + if (GL.wireframe) + { + m_preIntegratedFGD_Ward.Create(); + m_preIntegratedFGD_CookTorrance.Create(); + return; + } + using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.PreIntegradeWardCookTorrance))) { CoreUtils.DrawFullScreen(cmd, m_preIntegratedFGDMaterial_Ward, new RenderTargetIdentifier(m_preIntegratedFGD_Ward)); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/PreIntegratedFGD.cs b/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/PreIntegratedFGD.cs index dfec42b6308..4b8bd342fc3 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/PreIntegratedFGD.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/PreIntegratedFGD/PreIntegratedFGD.cs @@ -92,6 +92,14 @@ public void RenderInit(FGDIndex index, CommandBuffer cmd) if (m_isInit[(int)index] && m_PreIntegratedFGD[(int)index].IsCreated()) return; + // If we are in wireframe mode, the drawfullscreen will not work as expected, but we don't need the LUT anyway + // So create the texture to avoid errors, it will be initialized by the first render without wireframe + if (GL.wireframe) + { + m_PreIntegratedFGD[(int)index].Create(); + return; + } + CoreUtils.DrawFullScreen(cmd, m_PreIntegratedFGDMaterial[(int)index], new RenderTargetIdentifier(m_PreIntegratedFGD[(int)index])); m_isInit[(int)index] = true; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs index c9c7d22015b..ac169b3d400 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs @@ -1364,7 +1364,7 @@ void UpdateVolumeAndPhysicalParameters() } } - Matrix4x4 GetJitteredProjectionMatrix(Matrix4x4 origProj) + internal Matrix4x4 GetJitteredProjectionMatrix(Matrix4x4 origProj) { // Do not add extra jitter in VR unless requested (micro-variations from head tracking are usually enough) if (xr.enabled && !HDRenderPipeline.currentAsset.currentPlatformRenderPipelineSettings.xrSettings.cameraJitter) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/MotionVectorVertexShaderCommon.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/MotionVectorVertexShaderCommon.hlsl index 3fbb684ce00..55bbfbb123d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/MotionVectorVertexShaderCommon.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/MotionVectorVertexShaderCommon.hlsl @@ -108,9 +108,6 @@ PackedVaryingsType MotionVectorVS(inout VaryingsType varyingsType, AttributesMes bool hasDeformation = unity_MotionVectorsParams.x > 0.0; // Skin or morph target float3 effectivePositionOS = (hasDeformation ? inputPass.previousPositionOS : inputMesh.positionOS); -#if defined(_ADD_PRECOMPUTED_VELOCITY) - effectivePositionOS -= inputPass.precomputedVelocity; -#endif // Need to apply any vertex animation to the previous worldspace position, if we want it to show up in the motion vector buffer #if defined(HAVE_MESH_MODIFICATION) @@ -118,8 +115,18 @@ PackedVaryingsType MotionVectorVS(inout VaryingsType varyingsType, AttributesMes previousMesh.positionOS = effectivePositionOS ; previousMesh = ApplyMeshModification(previousMesh, _LastTimeParameters.xyz); + +#if defined(_ADD_PRECOMPUTED_VELOCITY) + previousMesh.positionOS -= inputPass.precomputedVelocity +#endif + float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.positionOS); #else + +#if defined(_ADD_PRECOMPUTED_VELOCITY) + effectivePositionOS -= inputPass.precomputedVelocity; +#endif + float3 previousPositionRWS = TransformPreviousObjectToWorld(effectivePositionOS); #endif From 76cc31f1a6427f4b18ea3f4949d955328345ecb0 Mon Sep 17 00:00:00 2001 From: bencloward <88061215+bencloward@users.noreply.github.com> Date: Tue, 17 Aug 2021 15:48:13 -0500 Subject: [PATCH 3/6] Fixed Bug That Prevented Sclera Iris Blend node from being added (#5375) The Sclera Iris Blend node had the same name as the Sclera Limbal Ring node, so when you selected the Sclera Iris Blend node from the Create Node menu, the Sclera Limbal Ring node was added instead. This made it impossible to add a Sclera Iris Blend node to the graph. --- .../Editor/Material/Eye/ShaderGraph/Node/ScleraIrisBlend.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/Node/ScleraIrisBlend.cs b/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/Node/ScleraIrisBlend.cs index e2b6b8420e8..55729df28a2 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/Node/ScleraIrisBlend.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/Eye/ShaderGraph/Node/ScleraIrisBlend.cs @@ -10,7 +10,7 @@ class ScleraIrisBlend : CodeFunctionNode { public ScleraIrisBlend() { - name = "Sclera Limbal Ring (Preview)"; + name = "Sclera Iris Blend (Preview)"; } public override bool hasPreview From de0edc14249b45119f729ce839a57189e6f5c897 Mon Sep 17 00:00:00 2001 From: Sebastien Lagarde Date: Fri, 27 Aug 2021 22:19:39 +0200 Subject: [PATCH 4/6] Merge Hd/bugfix #5427 --- .../CHANGELOG.md | 1 + .../Editor/AssetProcessors/MaterialPostProcessor.cs | 6 +++--- .../Editor/Lighting/HDLightExplorerExtension.cs | 12 ++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index a4c997c2ac3..75225f5b762 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed incorrect light list indexing when TAA is enabled (case 1352444). - Fixed Additional Velocity for Alembic not taking correctly into account vertex animation - Fixed wrong LUT initialization in Wireframe mode. +- Fixed case where the SceneView don't refresh when using LightExplorer with a running and Paused game (1354129) ## [10.6.0] - 2021-04-29 diff --git a/com.unity.render-pipelines.high-definition/Editor/AssetProcessors/MaterialPostProcessor.cs b/com.unity.render-pipelines.high-definition/Editor/AssetProcessors/MaterialPostProcessor.cs index 89e3c14497a..b345d67d6ff 100644 --- a/com.unity.render-pipelines.high-definition/Editor/AssetProcessors/MaterialPostProcessor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/AssetProcessors/MaterialPostProcessor.cs @@ -263,9 +263,6 @@ static void ZWriteForTransparent(Material material, HDShaderUtils.ShaderID id) #endregion static void RenderQueueUpgrade(Material material, HDShaderUtils.ShaderID id) { - // In order for the ray tracing keyword to be taken into account, we need to make it dirty so that the parameter is created first - HDShaderUtils.ResetMaterialKeywords(material); - // Replace previous ray tracing render queue for opaque to regular opaque with raytracing if (material.renderQueue == ((int)UnityEngine.Rendering.RenderQueue.GeometryLast + 20)) { @@ -279,6 +276,9 @@ static void RenderQueueUpgrade(Material material, HDShaderUtils.ShaderID id) material.SetFloat(kRayTracing, 1.0f); } + // In order for the ray tracing keyword to be taken into account, we need to make it dirty so that the parameter is created first + HDShaderUtils.ResetMaterialKeywords(material); + // For shader graphs, there is an additional pass we need to do if (material.HasProperty("_RenderQueueType")) { diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightExplorerExtension.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightExplorerExtension.cs index dbe1f3ae163..c25d073f9c7 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightExplorerExtension.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightExplorerExtension.cs @@ -528,6 +528,10 @@ protected virtual LightingExplorerTableColumn[] GetHDLightColumns() { Undo.RecordObject(tLightData, "Changed shadow resolution override"); tShadowResolution.@override = sShadowResolution.@override; + + //SceneView don't update when interacting with Light Explorer when playing and pausing (1354129) + if (EditorApplication.isPlaying && EditorApplication.isPaused) + SceneView.RepaintAll(); } }), new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, HDStyles.AffectDiffuse, "m_Intensity", 95, (r, prop, dep) => // 16: Affect Diffuse @@ -546,6 +550,10 @@ protected virtual LightingExplorerTableColumn[] GetHDLightColumns() { Undo.RecordObject(lightData, "Changed affects diffuse"); lightData.affectDiffuse = affectDiffuse; + + //SceneView don't update when interacting with Light Explorer when playing and pausing (1354129) + if (EditorApplication.isPlaying && EditorApplication.isPaused) + SceneView.RepaintAll(); } }, (lprop, rprop) => { @@ -580,6 +588,10 @@ protected virtual LightingExplorerTableColumn[] GetHDLightColumns() { Undo.RecordObject(lightData, "Changed affects specular"); lightData.affectSpecular = affectSpecular; + + //SceneView don't update when interacting with Light Explorer when playing and pausing (1354129) + if (EditorApplication.isPlaying && EditorApplication.isPaused) + SceneView.RepaintAll(); } }, (lprop, rprop) => { From 1a151323b9ac1bbb5496d8efc1e97021775d6677 Mon Sep 17 00:00:00 2001 From: Sebastien Lagarde Date: Sat, 28 Aug 2021 11:42:58 +0200 Subject: [PATCH 5/6] Fix compilation issue --- .../Runtime/Lighting/LightLoop/LightLoop.cs | 2 +- .../Runtime/RenderPipeline/PathTracing/PathTracing.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs index 14a887886ae..cf1d05c90cc 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs @@ -3361,7 +3361,7 @@ unsafe BuildGPULightListParameters PrepareBuildGPULightListParameters( HDCamera { var proj = hdCamera.xr.enabled ? hdCamera.xr.GetProjMatrix(viewIndex) : camera.projectionMatrix; // Note: we need to take into account the TAA jitter when indexing the light list - proj = (hdCamera.antialiasing == AntialiasingMode.TemporalAntialiasing) ? hdCamera.GetJitteredProjectionMatrix(proj) : proj; + proj = (hdCamera.antialiasing == HDAdditionalCameraData.AntialiasingMode.TemporalAntialiasing) ? hdCamera.GetJitteredProjectionMatrix(proj) : proj; m_LightListProjMatrices[viewIndex] = proj * s_FlipMatrixLHSRHS; diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs index e26fa9de1f2..0e904bd1021 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs @@ -389,7 +389,7 @@ TextureHandle RenderPathTracing(RenderGraph renderGraph, HDCamera hdCamera) // This can happen if a script disables and re-enables the camera (case 1337843). if (!hdCamera.isPersistent && hdCamera.GetCurrentFrameRT((int)HDCameraFrameHistoryType.PathTracing) == null) { - m_SubFrameManager.Reset(camID); + m_SubFrameManager.Reset(hdCamera.camera.GetInstanceID()); } if (!m_SubFrameManager.isRecording) From 65fc8f9f0df2fb43307370aec5dfde30ced9d458 Mon Sep 17 00:00:00 2001 From: Sebastien Lagarde Date: Sat, 28 Aug 2021 18:01:22 +0200 Subject: [PATCH 6/6] Update MotionVectorVertexShaderCommon.hlsl --- .../ShaderPass/MotionVectorVertexShaderCommon.hlsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/MotionVectorVertexShaderCommon.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/MotionVectorVertexShaderCommon.hlsl index 55bbfbb123d..7f98242c22f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/MotionVectorVertexShaderCommon.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/MotionVectorVertexShaderCommon.hlsl @@ -117,7 +117,7 @@ PackedVaryingsType MotionVectorVS(inout VaryingsType varyingsType, AttributesMes previousMesh = ApplyMeshModification(previousMesh, _LastTimeParameters.xyz); #if defined(_ADD_PRECOMPUTED_VELOCITY) - previousMesh.positionOS -= inputPass.precomputedVelocity + previousMesh.positionOS -= inputPass.precomputedVelocity; #endif float3 previousPositionRWS = TransformPreviousObjectToWorld(previousMesh.positionOS);