Skip to content

Fix for volumetric clouds performing Read and Write on same texture [Unsupported on some platforms] #4356

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 5 commits into from
Apr 29, 2021

Conversation

FrancescoC-unity
Copy link
Contributor

@FrancescoC-unity FrancescoC-unity commented Apr 28, 2021

Fix for https://fogbugz.unity3d.com/f/cases/1316069/

As the title mentioned, clouds where not supported on some platforms (Metal and I assume Intel GPUs) as they were performing Read/Write on the same resource which format is 11-11-10.

This change will perform an extra copy of the color buffer to use in those cases and sample that instead.

I did try the following alternatives:

  • Write full res clouds in the upsample without combining and then blending separately. [Slower]
  • Try to rewrite the shader from compute to pixel [Stop soon enough given that there are a lot of samples so, LDS will be a big benefit]

This option turned out to be the cheapest. It adds on PS4-base [where it won't run anyway, just used to profile] around 0.15ms of cost.

What did I test forced the option on and off on both PC (NVIDIA card) and PS4 and check that same result is there.

NOTE FOR QA: I don't have a dev-ready Metal machine to test, so we need to test on metal.

@github-actions
Copy link

It appears that you made a non-draft PR!
Please convert your PR to draft (button on the right side of the page)
and cancel any jobs that started on Yamato.
See the PR template for more information.
Thank you!

Copy link
Contributor

@iM0ve iM0ve left a comment

Choose a reason for hiding this comment

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

TL:DR
Its now working but there are still some issues. Not sure if I should approve and we address them later or we want to fix them within this PR

Whats tested:

  • Checked that every Volumetric Clouds parameter works on Windows
  • Checked that every Volumetric Clouds parameter works on Mac
  • Built player on mac to see that the clouds are present

Concerns:

Editor

Screen.Recording.2021-04-28.at.17.08.53.mov

@FrancescoC-unity
Copy link
Contributor Author

TL:DR
Its now working but there are still some issues. Not sure if I should approve and we address them later or we want to fix them within this PR

Whats tested:

  • Checked that every Volumetric Clouds parameter works on Windows
  • Checked that every Volumetric Clouds parameter works on Mac
  • Built player on mac to see that the clouds are present

Concerns:

Editor

Screen.Recording.2021-04-28.at.17.08.53.mov

I'd say those are likely different issues I'd open new tickets for those.

@johnpars
Copy link
Contributor

johnpars commented Apr 28, 2021

Hi! I just realized that this PR potentially fixes the same issue as this one: #4345 (however with the focus on MSAA).
The solution in this PR is better (I perform hardware blending from an intermediate target into the MSAA target rather than a copy), and maybe we can expand it to handle the MSAA case and I can close the other one?

(SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11 ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12 ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.Metal ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.Vulkan));
Copy link
Contributor

Choose a reason for hiding this comment

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

If we can add one more check here for MSAA, I think we can close #4345

Copy link
Contributor

Choose a reason for hiding this comment

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

yes good point, MSAA fix should be integrate in this PR

@sebastienlagarde sebastienlagarde changed the base branch from hd/bugfix to master April 28, 2021 18:13
@sebastienlagarde sebastienlagarde changed the base branch from master to hd/bugfix April 28, 2021 18:13
@sebastienlagarde
Copy link
Contributor

Note to self: redirect the PR to master once hd/bugfix is merge

@FrancescoC-unity
Copy link
Contributor Author

FrancescoC-unity commented Apr 29, 2021

Actually @johnpars the problem is slightly different here as blending in place still is happening. I just avoid the Read+Write from same texture, but here the issue is still that with MSAA we'd need to change the UAV declaration to be multi-sampled and do per-sample blending.

I think for MSAA your solution is probably still more efficient, but let's have a chat when you are online

Copy link
Contributor

@iM0ve iM0ve left a comment

Choose a reason for hiding this comment

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

Today I opened my project again to file the fogbugz for concerns. The artefact is just gone and the framerate stabilized after I waited for ~20 seconds. So no more outstanding issues from my part. All looks good

@sebastienlagarde
Copy link
Contributor

will wait for discussion with John

@sebastienlagarde sebastienlagarde merged commit 81eacb2 into hd/bugfix Apr 29, 2021
@sebastienlagarde sebastienlagarde deleted the HDRP/fix-clouds-color-rw branch April 29, 2021 14:52
sebastienlagarde added a commit that referenced this pull request Apr 30, 2021
* Fix null exception on Raytracing SSS volume component (#4322)

* Add null check

* changelog

* Fix issue with Eye shader and area light (#4310)

* Fix Ray Tracing Light Cluster debug mode (#4327)

* Remove unneeded position from input layout of light cluster

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Skip adding the LOD's renderer to the checked renderer if it's null (#4313)

* Skip adding the LOD's renderer to the checked renderer if it's null

* changelog

* Add LODgroup missing renderer to "check scene content for ray tracing"

* formatting test

* formatting

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Update doc of transparent motion vectors to specify TAA of object behind will be impacted (#4325)

* Update doc

* Fix doc

* Fixed Look Dev breaking when docked and rendered at zero size. (#4331)

* Fixed an issue where sometime a docked lookdev could be rendered at zero size and break.

* Update changelog

# Conflicts:
#	com.unity.render-pipelines.high-definition/CHANGELOG.md

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Added a bit about scaling issues when dealing with history buffers (#4333)

* Updated troubleshooting custom pass doc

* Update Custom-Pass-Troubleshooting.md

* Fixed an issue where runtime debug window UI would leak game objects. (#4337)

* Fixed an issue where runtime debug window UI would leak game objects.

* Update changelog

* Updated documentation to support #4313 (#4336)

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Fixed NaNs when denoising pixels where the dot product between normal and view direction is near zero (#4342)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* updated tooltip (#4334)

* Doc for custom matrix for fog (#4352)

* [Fogbugz 1324000] Fixing unlit emissive reflections (#4340)

* Fix ray tracing unlit emissive exposure.

Changelog

* Automated tests coverage

* update scenes

Co-authored-by: Remi Chapelain <remi.chapelain@unity3d.com>
Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [Fogbugz 1329173] Fixing wrong pyramid color dimensions when hardware DRS is on. (#4346)

* Fixing bad pyramid color source texture size. DRS hanlder must be queried since the mip levels depend on the source hardware resolution

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix RTHandle scale bias [1329977] (#4320)

* Fix RTHandle scale bias

* Add changelog

* Fix history sacle

* Fix

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed emission material properties not being animable (#4366)

* Fixed emission material properties not being animable

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix fog precision (#4364)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix erroneous tile coordinate calculations in contact shadows (#4335)

* Fix wrong tile coord calculations

* Changelog

* Update test scene for contact shadow to cover data

* update references screenshots

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* [HDRP]Fix history buffer allocation for AOVs when the request does not come in first frame (#4361)

* Fix  history buffer allocation for AOVs when the request does not come in first frame

* Add a break in the for loop

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix for volumetric clouds performing Read and Write on same texture [Unsupported on some platforms] (#4356)

* Fix for usage of camera color RW when not supported.

* Re-enable on metal

* changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Update TestCaseFilters.asset

* update metal screenshots

* missing meta

* [Fogbugz 1330769] Fixing bloom bicubic filtering for DRS (#4370)

* Fixing bloom bicubic filtering for DRS, bicubic was using the wrong dimensions / texel sizes

* Adding better comment to explain offseting of bicubic texture offset fix

* update reference screenshots

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Rémi Chapelain <57442369+remi-chapelain@users.noreply.github.com>
Co-authored-by: JulienIgnace-Unity <julien@unity3d.com>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>
Co-authored-by: Lewis Jordan <lewis.jordan@hotmail.co.uk>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
Co-authored-by: Adrien de Tocqueville <adrien.tocqueville@unity3d.com>
Co-authored-by: Kleber Garcia <kleber.garcia@unity3d.com>
Co-authored-by: Remi Chapelain <remi.chapelain@unity3d.com>
Co-authored-by: skhiat <55133890+skhiat@users.noreply.github.com>
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.

4 participants