Skip to content

[2022.1][URP] Decal fixes #6239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 50 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
a2e4eb6
switching _CameraDepthTexture to R32Float and accommodating some stuf…
jonuuukas Jul 29, 2021
80af9be
some changes to the Foundation Project for Repro project (to be rever…
jonuuukas Jul 29, 2021
d1cef12
Revert "some changes to the Foundation Project for Repro project (to …
jonuuukas Jul 29, 2021
d39e96d
disable fbfetch on DbufferDeferred decals
jonuuukas Aug 3, 2021
c149ec9
adding IsTransientAttachment to ScriptableRenderPass/NativeRenderPass…
jonuuukas Aug 5, 2021
8ce5f7c
Fixed decals to work with native render pass [case 1353141]
lukaschod Aug 11, 2021
cdcc881
Adding changelog entry
lukaschod Aug 11, 2021
14ec8d2
Leftover
lukaschod Aug 12, 2021
933f089
making depthOnly pass compatible to render color texture and changing…
jonuuukas Aug 12, 2021
624f0a1
Merge branch 'master' into universal/depth-copy-as-color
jonuuukas Aug 12, 2021
377d987
Fixing decal+native renderpass+decal+deferred scenario
lukaschod Aug 13, 2021
d887392
fix after updating trunk
jonuuukas Aug 13, 2021
6accb1c
merge fix - change descriptor for DepthOnly configureTarget to the co…
jonuuukas Aug 13, 2021
ee6e7d4
enabling depthbuffer for depth copy and adding additional override fo…
jonuuukas Aug 16, 2021
399ee75
formatting fixes
jonuuukas Aug 16, 2021
68d3938
terrain shader passes depthonly pass fix to output clippos
jonuuukas Aug 17, 2021
4f9cbd7
adding depth copy for renderpass as well and changing how fake depth …
jonuuukas Aug 17, 2021
165f4d5
some cleanup and refactoring and enabling Renderpass for SS forward d…
jonuuukas Aug 17, 2021
4dead85
Merge branch 'universal/depth-copy-as-color' of github.com:Unity-Tech…
lukaschod Aug 18, 2021
4635bfb
Fixing decals rendering to be correct with render scale. [1353885]
lukaschod Aug 18, 2021
b1ec31e
Cleanup
lukaschod Aug 18, 2021
e8b738d
Cleanup
lukaschod Aug 19, 2021
cc903b2
Cleanup
lukaschod Aug 19, 2021
fd4df44
adding _OUTPUT_DEPTH keyword to CopyDepthPass to select correct outpu…
jonuuukas Aug 19, 2021
2510a18
Merge branch 'master' into universal/depth-copy-as-color
jonuuukas Aug 23, 2021
5dec840
adding depth output for VFXGraph depth only passes
jonuuukas Aug 24, 2021
c4ddd12
changing the semantic for outDepthColor in VFXPasses.template
jonuuukas Aug 25, 2021
18e804f
Changing to correct normal sampling for decal shadergraph
lukaschod Sep 6, 2021
4deded8
Merge branch 'master' into universal/depth-copy-as-color
jonuuukas Oct 6, 2021
9319551
Merge branch 'universal/staging' of github.com:Unity-Technologies/Gra…
lukaschod Oct 7, 2021
1af0f36
Merge branch 'universal/staging' into universal/decal-fixes
phi-lira Oct 7, 2021
d8b8989
Changing image to correct texture type
lukaschod Oct 8, 2021
4ec742f
Merge branch 'universal/decal-fixes' of github.com:Unity-Technologies…
lukaschod Oct 8, 2021
f95fafb
Merge branch 'master' into universal/depth-copy-as-color
jonuuukas Oct 11, 2021
159580e
fixing DBuffer Decals CopyDepth pass not copying the depth and failin…
jonuuukas Oct 11, 2021
f9152cf
adding fb fetch to Gbuffer decals and some other depth related fixes …
jonuuukas Oct 12, 2021
b5a042f
Merge branch 'universal/depth-copy-as-color' of ssh://github.com/Unit…
jonuuukas Oct 12, 2021
62ca66d
fixing shader compilation error and renaming define for fb fetch idx
jonuuukas Oct 12, 2021
8315f67
Merge branch 'universal/depth-copy-as-color' of github.com:Unity-Tech…
lukaschod Oct 12, 2021
a65c6c9
Adding normal alpha multiplication with albedo alpha multiplication
lukaschod Oct 12, 2021
fcb7d7f
fix for RTIs non render pass platforms
jonuuukas Oct 12, 2021
427e0cb
another DeferredLights null check
jonuuukas Oct 13, 2021
850428a
null exception fix
jonuuukas Oct 13, 2021
70ad6ee
adding some editor-specific code to avoid a bug with editor setting i…
jonuuukas Oct 14, 2021
092200d
Merge branch 'universal/depth-copy-as-color' of github.com:Unity-Tech…
lukaschod Oct 25, 2021
ce29a98
Merge branch 'universal/staging' of github.com:Unity-Technologies/Gra…
lukaschod Oct 25, 2021
d85820d
Updating terrain 230 test templates from extra
lukaschod Nov 3, 2021
aa33c68
Updating test 230 images
lukaschod Nov 8, 2021
a2c5f12
Updating 230 vulkan images
lukaschod Nov 8, 2021
5c2aaa7
Merge branch 'universal/staging' into universal/decal-fixes
phi-lira Nov 10, 2021
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions com.unity.render-pipelines.universal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fix for rendering thumbnails. [case 1348209](https://issuetracker.unity3d.com/issues/preview-of-assets-do-not-show-in-the-project-window)
- Fixed a regression bug where XR camera postion can not be modified in beginCameraRendering [case 1365000]
- Fixed an issue in where installing the Adaptive Performance package caused errors to the inspector UI [1368161](https://issuetracker.unity3d.com/issues/urp-package-throws-compilation-error-cs1525-when-imported-together-with-adaptive-performance-package)
- Fixed decals to work with native render pass [case 1353141](https://issuetracker.unity3d.com/issues/urp-decals-are-not-visible-in-game-view-after-modifying-urp-asset-properties)
- Fixed decals to work with render scale [1353885](https://issuetracker.unity3d.com/issues/urp-builtin-to-urp-render-pipeline-converter-freezes-the-editor-when-converting-rendering-settings)
- Fixed a regression where filtering the scene view yielded incorrect visual results [1360233](https://issuetracker.unity3d.com/product/unity/issues/guid/1360233)
- Fixed disabled debug lighting modes on Vulkan and OpenGL following a shader compiler fix. [case 1334240]
- Fixed an issue in where the Convert Renderering Settings would cause a freeze. [case 1353885](https://issuetracker.unity3d.com/issues/urp-builtin-to-urp-render-pipeline-converter-freezes-the-editor-when-converting-rendering-settings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@ internal class DBufferRenderPass : ScriptableRenderPass
private int m_DBufferCount;
private ProfilingSampler m_ProfilingSampler;

private RenderTargetHandle m_DBufferDepth;
private RenderTargetHandle m_CameraDepthTexture;
private RenderTargetHandle m_CameraDepthAttachment;

internal DeferredLights deferredLights { get; set; }
private bool isDeferred => deferredLights != null;
internal RenderTargetIdentifier[] dBufferColorIndentifiers { get; private set; }
internal RenderTargetIdentifier dBufferDepthIndentifier { get; private set; }
internal RenderTargetIdentifier cameraDepthTextureIndentifier { get; private set; }
internal RenderTargetIdentifier cameraDepthAttachmentIndentifier { get; private set; }

internal RenderTargetHandle dBufferDepth => m_DBufferDepth;
internal RenderTargetHandle cameraDepthTexture => m_CameraDepthTexture;
internal RenderTargetHandle cameraDepthAttachment => m_CameraDepthAttachment;

public DBufferRenderPass(Material dBufferClear, DBufferSettings settings, DecalDrawDBufferSystem drawSystem)
{
Expand All @@ -51,9 +56,9 @@ public DBufferRenderPass(Material dBufferClear, DBufferSettings settings, DecalD
dBufferColorIndentifiers[dbufferIndex] = new RenderTargetIdentifier(s_DBufferNames[dbufferIndex]);
m_DBufferCount = dBufferCount;

dBufferDepthIndentifier = new RenderTargetIdentifier(s_DBufferDepthName);
cameraDepthTextureIndentifier = new RenderTargetIdentifier("_CameraDepthTexture");
cameraDepthAttachmentIndentifier = new RenderTargetIdentifier("_CameraDepthAttachment");
m_DBufferDepth.Init(s_DBufferDepthName);
m_CameraDepthTexture.Init("_CameraDepthTexture");
m_CameraDepthAttachment.Init("_CameraDepthAttachment");
}

public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
Expand Down Expand Up @@ -97,12 +102,12 @@ public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderin
depthDesc.depthStencilFormat = renderingData.cameraData.cameraTargetDescriptor.depthStencilFormat;
depthDesc.msaaSamples = 1;

cmd.GetTemporaryRT(Shader.PropertyToID(s_DBufferDepthName), depthDesc);
depthIdentifier = dBufferDepthIndentifier;
cmd.GetTemporaryRT(m_DBufferDepth.id, depthDesc);
depthIdentifier = m_DBufferDepth.Identifier();
}
else
{
depthIdentifier = deferredLights.DepthAttachmentIdentifier;
depthIdentifier = m_CameraDepthAttachment.Identifier();
}

ConfigureTarget(dBufferColorIndentifiers, depthIdentifier);
Expand Down Expand Up @@ -184,7 +189,7 @@ public override void OnCameraCleanup(CommandBuffer cmd)
}

if (!isDeferred)
cmd.ReleaseTemporaryRT(Shader.PropertyToID(s_DBufferDepthName));
cmd.ReleaseTemporaryRT(m_DBufferDepth.id);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ private void RecreateSystemsIfNeeded(ScriptableRenderer renderer, in CameraData
m_ScreenSpaceSettings = GetScreenSpaceSettings();

m_CopyDepthMaterial = CoreUtils.CreateEngineMaterial(m_CopyDepthPS);
m_CopyDepthPass = new CopyDepthPass(RenderPassEvent.AfterRenderingPrePasses, m_CopyDepthMaterial);

m_DBufferClearMaterial = CoreUtils.CreateEngineMaterial(m_DBufferClear);

Expand Down Expand Up @@ -371,7 +370,6 @@ private void RecreateSystemsIfNeeded(ScriptableRenderer renderer, in CameraData
switch (m_Technique)
{
case DecalTechnique.ScreenSpace:
m_CopyDepthPass = new CopyDepthPass(RenderPassEvent.AfterRenderingOpaques, m_DBufferClearMaterial);
m_DecalDrawScreenSpaceSystem = new DecalDrawScreenSpaceSystem(m_DecalEntityManager);
m_ScreenSpaceDecalRenderPass = new DecalScreenSpaceRenderPass(m_ScreenSpaceSettings, intermediateRendering ? m_DecalDrawScreenSpaceSystem : null);
break;
Expand All @@ -380,12 +378,12 @@ private void RecreateSystemsIfNeeded(ScriptableRenderer renderer, in CameraData

m_DeferredLights = universalRenderer.deferredLights;

m_CopyDepthPass = new CopyDepthPass(RenderPassEvent.AfterRenderingOpaques, m_DBufferClearMaterial);
m_DrawGBufferSystem = new DecalDrawGBufferSystem(m_DecalEntityManager);
m_GBufferRenderPass = new DecalGBufferRenderPass(m_ScreenSpaceSettings, intermediateRendering ? m_DrawGBufferSystem : null);
break;

case DecalTechnique.DBuffer:
m_CopyDepthPass = new CopyDepthPass(RenderPassEvent.AfterRenderingPrePasses, m_CopyDepthMaterial);
m_DecalDrawDBufferSystem = new DecalDrawDBufferSystem(m_DecalEntityManager);
m_DBufferRenderPass = new DBufferRenderPass(m_DBufferClearMaterial, m_DBufferSettings, m_DecalDrawDBufferSystem);

Expand Down Expand Up @@ -471,15 +469,17 @@ public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingD
if (universalRenderer.actualRenderingMode == RenderingMode.Deferred)
{
m_CopyDepthPass.Setup(
new RenderTargetHandle(m_DBufferRenderPass.cameraDepthAttachmentIndentifier),
new RenderTargetHandle(m_DBufferRenderPass.cameraDepthTextureIndentifier)
m_DBufferRenderPass.cameraDepthAttachment,
m_DBufferRenderPass.cameraDepthTexture
);

m_CopyDepthPass.AllocateRT = false;
}
else
{
m_CopyDepthPass.Setup(
new RenderTargetHandle(m_DBufferRenderPass.cameraDepthTextureIndentifier),
new RenderTargetHandle(m_DBufferRenderPass.dBufferDepthIndentifier)
m_DBufferRenderPass.cameraDepthTexture,
m_DBufferRenderPass.dBufferDepth
);

m_CopyDepthPass.CopyToDepth = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void SetPerCameraShaderVariables(CommandBuffer cmd, ref CameraData cameraData)
cmd.SetGlobalVector(ShaderPropertyId.zBufferParams, zBufferParams);
cmd.SetGlobalVector(ShaderPropertyId.orthoParams, orthoParams);

cmd.SetGlobalVector(ShaderPropertyId.screenSize, new Vector4(cameraWidth, cameraHeight, 1.0f / cameraWidth, 1.0f / cameraHeight));
cmd.SetGlobalVector(ShaderPropertyId.screenSize, new Vector4(scaledCameraWidth, scaledCameraHeight, 1.0f / scaledCameraWidth, 1.0f / scaledCameraHeight));
}

/// <summary>
Expand Down
Loading