Skip to content
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

[HDRP] Fullscreen subtarget feature #6141

Closed
wants to merge 114 commits into from

Conversation

alelievr
Copy link
Member

@alelievr alelievr commented Oct 26, 2021

Purpose of this PR

⚠️ This PR depends on #6110 (so it needs to be merged after)

Included in this PR:

  • Fullscreen sub-target for HDRP

image

  • HD Scene depth node to sample the depth with mips
    HDSceneDepth

  • HD Sample Buffers node, allows to access normal, roughness, motion vectors, and post-process input in ShaderGraph.
    image

  • Full support of stencil in custom passes (in DrawRenderers and Fullscreen custom passes)

image
image

If you have any questions regarding this feature, you can ask in #devs-fullscreen-master-node.


Testing status

Fullscreen target test doc: https://confluence.unity3d.com/display/HDRP/Fullscreen+Target

Automated tests have also been added for basic features of the fullscreen SG with custom post-process and custom passes (tests cover alpha blending, stencil, and fullscreen UVs).

Note for QA:

This work is split into 3 PRs for ease of reviewing. If you want to test everything (URP, HDRP, and builtin implementation) I'd recommend to use the sg/fullscreen-target branch

// For now we fake the GI sampling in fullscreen.
float3 SampleBakedGI(float3 positionRWS, float3 normalWS, float2 uvStaticLightmap, float2 uvDynamicLightmap)
{
return 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure to understand why we need a new file just for this? why is it here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to avoid including all the lighting includes for the fullscreen shder.

# Conflicts:
#	TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset
…ementation

# Conflicts:
#	TestProjects/BuiltInGraphicsTest_Foundation/Assets/Scenes/070_FullscreenEffects.meta
#	TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset
#	com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/FullScreenCustomPassDrawer.cs
#	com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs
#	com.unity.render-pipelines.universal/Editor/ShaderGraph/Nodes/UniversalSampleBufferNode.cs
#	com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/Editor/ShaderGraph/Targets/BuiltInTarget.cs
#	com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomRenderTextureTarget.cs
#	com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomTexture.hlsl
#	com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomTextureGraph.hlsl
#	com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomTextureNodes.cs
#	com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomTextureSubShader.template
#	com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CustomTextureSubTarget.cs
#	com.unity.shadergraph/Editor/Generation/Targets/Fullscreen/FullscreenData.cs
#	com.unity.shadergraph/Editor/Generation/Targets/Fullscreen/FullscreenShaderGUI.cs
#	com.unity.shadergraph/Editor/Generation/Targets/Fullscreen/FullscreenSubTarget.cs
#	com.unity.shadergraph/Editor/Generation/Targets/Fullscreen/Includes/FullscreenCommon.hlsl
#	com.unity.shadergraph/Editor/Generation/Targets/Fullscreen/Includes/FullscreenDrawProcedural.hlsl
#	com.unity.shadergraph/Editor/Generation/Targets/Fullscreen/Templates/SharedCode.template.hlsl
Copy link
Contributor

@remi-chapelain remi-chapelain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took over for while @TomasKiniulis was OoO.

Here's what I've tested:

  • Created a brand new custom post process (simple thing that distorts UV when sampling PP inputs) with full screen shader master node to made sure I understood the feature.
  • Did not managed to repro the issue mentionned earlier with DX12 (has been fixed) ✔️
  • Metal issue is supposed to be fixed but can't verify (no hardware but trusting antoine on this) ✔️
  • Tested all DRS algorithms in software / hardware (dx12) ⚠️ (some issues)
  • Pair-tested in Built-in with @alelievr using two different methods. Working as expected ✔️
  • --- First one is by using post process package in built in and feeding it a material made with shader graph full screen master node. ✔️
  • --- Second one is by overriding the render of the camera using the "OnRenderImage()" function by blit-ing the source texture into the destination using a temporary buffer in between to avoid read/write issues. ✔️

For the details about issues for DRS, what I've found is depending on what is sampled in the HDSampleBuffer node, FSR gives slightly darker results but ONLY when roughness or WSnormals are sampled.
Does NOT seem to repro when using IsSky, PostProcess or MotionVectors for some reasons.
https://user-images.githubusercontent.com/57442369/140384575-182694b6-44c8-4076-9b1e-9d11ff9677b1.mp4

@alelievr
Copy link
Member Author

alelievr commented Feb 1, 2022

Replaced by #6943

@alelievr alelievr closed this Feb 1, 2022
@alelievr alelievr deleted the hd/fullscreen-subtarget-implementation branch February 25, 2022 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants