Search Issue Tracker
Fixed
Fixed in 2022.2.17f1, 2023.1.0b13, 2023.2.0a3
Votes
0
Found in
2022.2.0f1
2023.1.0b3
Issue ID
UUM-21628
Regression
No
[HDRP] Buffers sampling in shadergraph is broken when using low resultion pass
Steps to reproduce:
* Open "Scenes/SampleScene" in the attached project
* Look at the game view rendering
Result:
!image-2022-12-16-14-24-48-979.png!
Expected:
Quad objects on the right (Low Resolution) should look similar to the ones on the left (Default).
Notes:
Issue reported by a user on the forum here : [https://forum.unity.com/threads/low-resolution-rendering-pass-with-scene-depth-are-broken.1374471/] A work around has been provided, but a fix in the source code would be better.
The issue seems to be cause by the _ScreenSize value not beeing updated in the shaders constant buffer when rendering the low resolution transparents pass.
I was able to fix the issue by updating it in HDRenderPipeline.RenderGraph.cs (L1189) with the following code change, but it is probably not a clean fix:
{code:java}
TextureHandle RenderLowResTransparent(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle downsampledDepth, CullingResults cullingResults, RendererListHandle rendererList)
{
using (var builder = renderGraph.AddRenderPass<RenderLowResTransparentPassData>("Low Res Transparent", out var passData, ProfilingSampler.Get(HDProfileId.LowResTransparent)))
{
passData.globalCB = m_ShaderVariablesGlobalCB;
passData.lowResScale = hdCamera.lowResScale;
passData.frameSettings = hdCamera.frameSettings;
passData.rendererList = builder.UseRendererList(rendererList);
builder.UseDepthBuffer(downsampledDepth, DepthAccess.ReadWrite);
// We need R16G16B16A16_SFloat as we need a proper alpha channel for compositing.
var output = builder.UseColorBuffer(renderGraph.CreateTexture(new TextureDesc(Vector2.one * hdCamera.lowResScale, true, true)
{ colorFormat = GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite = true, clearBuffer = true, clearColor = Color.black, name = "Low res transparent" }), 0); builder.SetRenderFunc(
(RenderLowResTransparentPassData data, RenderGraphContext context) =>
{
UpdateOffscreenRenderingConstants(ref data.globalCB, true, 1.0f / data.lowResScale);
var origSize = data.globalCB._ScreenSize; // FIX
data.globalCB._ScreenSize = Vector4.Scale(data.globalCB._ScreenSize, new Vector4(2f, 2f, 0.5f, 0.5f)); // FIX
ConstantBuffer.PushGlobal(context.cmd, data.globalCB, HDShaderIDs._ShaderVariablesGlobal);
DrawTransparentRendererList(context.renderContext, context.cmd, data.frameSettings, data.rendererList);
UpdateOffscreenRenderingConstants(ref data.globalCB, false, 1.0f);
data.globalCB._ScreenSize = origSize; // FIX
ConstantBuffer.PushGlobal(context.cmd, data.globalCB, HDShaderIDs._ShaderVariablesGlobal);
}); return output;
}
} {code}
A test scene was added here : https://github.cds.internal.unity3d.com/unity/unity/pull/21223
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [Editor] Profiler (Standalone Process) "Live" button is greyed out by default
- UIToolkit bindings on RadioButtonGroup is not displaying the selected radio button when the choice list is bound
- Sprite shadows are not rendered when the light source is placed near the sprite
- Multiple Video Players are not playing simultaneously when played in WebGL
- "Rename Prefab File?" window does not pop up when renaming Prefab in the Project window
Resolution Note (fix version 2023.2.0a3):
This is now fixed and verified. Will be backported to 2023.1