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

[Fogbugz 1352407] Fixing TAAU and DLSS resolutions on custom post process #5329

Merged
merged 2 commits into from Sep 3, 2021

Conversation

kecho
Copy link
Contributor

@kecho kecho commented Aug 10, 2021

Purpose of this PR

Fixing TAAU and DLSS resolution by passing a custom resolution to custom post processes.
The problem is that RTHandle system has a monolithic rtHandleProperties. Thus, we cant just give a texture its specific resoltuion. For this to work with the blitter and the ecosystem, I am introducing a small API that allows to have a custom handle properties into the desired target.

Fogbugz: https://fogbugz.unity3d.com/f/cases/1352407/

Testing status

Tested with custom post process from example dx11, also hardware DRS on dx12.


Comments to reviewers

I tried many ways of fixing it, all of them incurring into heavy complexity on HDRP. The real solution should be implementing proper support of multi resolutions in RTHandle.

@github-actions
Copy link

Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed.
Link to Yamato: https://yamato.cds.internal.unity3d.com/jobs/902-Graphics
Search for your PR branch using the sidebar on the left, then add the following segment(s) to the end of the URL (you may need multiple tabs depending on how many packages you change)

HDRP
/.yamato%252Fall-hdrp.yml%2523PR_HDRP_2021.2

SRP Core
You could run ABV on your branch before merging your PR, but it will start A LOT of jobs. Please be responsible about it and run it only when you feel the PR is ready:
/.yamato%252F_abv.yml%2523all_project_ci_2021.2
Be aware that any modifications to the Core package impacts everyone in the Graphics repo so please discuss the PR with your lead.

Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure.

newProps.rtHandleScale = passData.postProcessScales;
newProps.currentRenderTargetSize = passData.postProcessViewportSize;
newProps.previousRenderTargetSize = passData.postProcessViewportSize;
newProps.currentViewportSize = passData.postProcessViewportSize;
Copy link
Contributor

Choose a reason for hiding this comment

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

Uhm waiting for @alelievr as I don't know, but can custom PP have source that is not full size? If so, will override src RTHandle stuff create problems?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also can user use anything but the HD Blit that creates problems? (Not that I have a solution, but worth knowing a bit more the problem space)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. The documentation we explain that the color must use m_PostProcessSize. Apart from that, the user could just use the rtHandleProperties now blindly and anything would work.

Copy link
Member

Choose a reason for hiding this comment

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

@FrancescoC-unity Custom post-processing in shaders can sample the normal or depth buffer which is not full size (but it's not possible to access these buffers in C#).

Also, with the latest changes, custom post-processes are now using cmd.Blit() instead of HDUtils.DrawFullscreen which has different behavior.

Copy link
Collaborator

@JulienIgnace-Unity JulienIgnace-Unity left a comment

Choose a reason for hiding this comment

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

As discussed previously, this is a fine stop gap solution until we can do something better.
I think it's worth waiting for Antoine's answer to Francesco's comment though.

@kecho kecho force-pushed the HDRP/CustomPostProcessFixWithDLSSAndTAAU branch from 38c8956 to f38a966 Compare August 25, 2021 20:37
@FrancescoC-unity
Copy link
Contributor

Uhm @alelievr if cmd.Blit() is used, won't this change do virtually nothing?

@sebastienlagarde sebastienlagarde marked this pull request as ready for review August 26, 2021 08:56
@alelievr
Copy link
Member

@FrancescoC-unity technically yes

…stom state

* Adding missing flag for dynamic res target

* Formatting

* Documentation

* More docs

* changelog

* Formatting
@kecho kecho force-pushed the HDRP/CustomPostProcessFixWithDLSSAndTAAU branch from 1f8c1ab to 6f2a21f Compare September 1, 2021 20:32
@sebastienlagarde sebastienlagarde merged commit 296ff24 into master Sep 3, 2021
@sebastienlagarde sebastienlagarde deleted the HDRP/CustomPostProcessFixWithDLSSAndTAAU branch September 3, 2021 10:38
@jimmikaelkael
Copy link

@kecho I'm not sure why but this PR doesn't fix a custom PP using HDUtils.DrawFullScreen at AfterOpaqueAndSky injection point, in that specific case source.rtHandleProperties.rtHandleScale seems to be wrong. Other injection points are fine and I made sure to call ClampAndScaleUVForBilinearPostProcessTexture for correct UVs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants