Skip to content

[HDRP] Add custom pass buffer scaling functions #5809

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 11 commits into from
Oct 18, 2021

Conversation

alelievr
Copy link
Member

@alelievr alelievr commented Sep 27, 2021

Purpose of this PR

Added 2 new functions to sample the custom buffer in custom passes (CustomPassSampleCustomColor and CustomPassLoadCustomColor), they avoid having to handle the RTHandleScale manually.


Testing status

Manually tested that both functions handle correctly scaling in all injection points (with multiple cameras at different resolutions)

Test doc: https://docs.google.com/spreadsheets/d/15hgpyHVXLxckGdQRGziqAe-tV3p_cqAlQJYZGimqXxs/edit#gid=0

Before:

CPBefore

After:

Fluid3

https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/hd%252Ffix%252Fcustom-pass-buffer-scaling-functions/.yamato%252Fall-hdrp.yml%2523PR_HDRP_trunk/9007202/job

@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_trunk
With changes to HDRP packages, you should also run
/.yamato%252Fall-lightmapper.yml%2523PR_LightMapper_trunk

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.

@github-actions github-actions bot added the HDRP label Sep 27, 2021
@alelievr alelievr requested a review from a team September 27, 2021 13:52
@alelievr alelievr marked this pull request as ready for review September 27, 2021 13:52
Copy link
Contributor

@Vic-Cooper Vic-Cooper left a comment

Choose a reason for hiding this comment

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

Left a suggestion and a question.

@@ -463,6 +463,11 @@ You can also load custom buffers using the following functions:
- `LoadCustomColor(uint2 pixelCoords)`
- `LoadCustomDepth(uint2 pixelCoords)`

Note that depending on the injection point used for the Fullscreen custom pass, sampling the custom buffer can result in incorrect scaling. Thus it's recommended to use these functions instead:
Copy link
Contributor

Choose a reason for hiding this comment

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

Which injection points cause incorrect scaling? I think it would be helpful to the user to be specific 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.

These injection points were causing scaling issues:

  • BeforePreRefraction
  • BeforePostProcess
  • AfterPostProcess

Copy link
Contributor

@TomasKiniulis TomasKiniulis left a comment

Choose a reason for hiding this comment

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

Checked with Antoine there seems to be another scaling issue when Custom Pass is in After Post Process when CustomPassSampleCustomColor is used.

2021-10-14.17-18-30.mp4

Copy link
Contributor

@TomasKiniulis TomasKiniulis left a comment

Choose a reason for hiding this comment

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

Looks good! No more scaling issues occur.


## [13.1.0] - 2021-09-24

### Added
- Added a SG node to get the main directional light direction.
- Added new functions that sample the custom buffer in custom passes (CustomPassSampleCustomColor and CustomPassLoadCustomColor) to handle the RTHandleScale automatically.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add it to what's new

@sebastienlagarde sebastienlagarde merged commit 9ae6727 into master Oct 18, 2021
@sebastienlagarde sebastienlagarde deleted the hd/fix/custom-pass-buffer-scaling-functions branch October 18, 2021 15:54
odbb added a commit that referenced this pull request Oct 18, 2021
* master: (148 commits)
  [HDRP] Add custom pass buffer scaling functions (#5809)
  Fix HDRP template input not working when using the new Input System and no Keyboard/Mouse (#6045)
  [SRP] Bump package version to 13.2.0 (#6049)
  ** Improving FTPL perf on ps4 by .3 ms on average ** (#5866)
  Remove min version from package.json (#6044)
  Fix subdiv view (#6033)
  Small qol (#6036)
  APV: update some tooltips and add a clamp on dilation validity threshold (#6005)
  SRP bump to 13.1.1 (#6041)
  (SRP] Bump min version to a12 to fix Yamato
  Vfx/fix/1289612 filter texture by dimension (#5715)
  [HDRP] Fix 9601/9602 reference screenshots after cache server weirdness
  [CI] [trunk] Updated editor to 5a5aca0fb632e01b9b362f6deb73bcf599d612ca
  [CI] [trunk] Updated editor to 7b5b9bb6eed88e40de00efa2a629dd8f0b2bfee2
  [CI] [trunk] Updated editor to a397ac6302d3ce68bd3eeea7721610a649addfa3
  [CI] [trunk] Updated editor to dd9d77b7ded66b5edad4dacf123ffbb6c8d8c4bf
  [CI] [trunk] Updated editor to 6c7822fe613adfea64bb232c817a2fdee34fc273
  [CI] [trunk] Updated editor to aae7fd02ff5afebc831948d25c52dcf704a8a3f3
  [CI] [trunk] Updated editor to 9c278756e419ae931cabac6c5dd60f24e05c6de3
  [CI] [trunk] Updated editor to d3dc7fc8d330da1155ec00683876a559b2a63281
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants