Skip to content

Conversation

ellioman
Copy link
Contributor

@ellioman ellioman commented Jan 15, 2021

Purpose of this PR

Particles currently do not contribute to Depth or DepthNormal textures. This causes an issue with SSAO when the After Opaque option is enabled as it makes them look transparent.

This PR adds Depth and DepthNormals passes to particle shaders. I had to add a #define _BumpScale 1.0 to the input hlsl files for simplelit and unlit in order to be able to call SampleNormalTS(...) using the same fragment shader for all particles.

A test scene will be added to the URP Graphics Test project in a followup PR.

QA

What has been tested

  • Tested in Editor (OS X 10.14.6) with a custom test scene to be added in a followup PR in URP's Graphics Test Project
  • Ran the Test Runner and made sure all tests were a success

What needs testing

  • Make sure particles render to depth and/or normals texture on all our supported platforms and API's
  • Make sure this change hasn't regressed particle rendering

Yamato

https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/universal%252Ffeature%252Fparticles-depth-and-normals

@ellioman ellioman requested a review from a user January 15, 2021 22:05
@ellioman ellioman requested a review from a team as a code owner January 15, 2021 22:05
@ellioman ellioman changed the title [2021.2] Adding Depth & Depth Normals to Particle Shaders [2021.2] Particle Shaders: Adding Depth & Depth Normals passes Jan 15, 2021
@Unity-Technologies Unity-Technologies deleted a comment from github-actions bot Jan 15, 2021
@ellioman ellioman requested a review from a team January 18, 2021 09:38
Copy link

@ghost ghost 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! Suggested a couple of optimizations to remove some ALU+interpolators in some cases. Plus i suspect _BumpScale could be added properly in a future PR.

@simon-engelbrecht-soerensen simon-engelbrecht-soerensen requested review from a team and simon-engelbrecht-soerensen and removed request for a team and simon-engelbrecht-soerensen January 18, 2021 10:23
@erikabar erikabar requested review from erikabar and removed request for a team January 18, 2021 11:07
@ellioman
Copy link
Contributor Author

@richardkettlewell Good points! I've added those checks to avoid unnecessary interpolators.

@ghost
Copy link

ghost commented Jan 18, 2021

@richardkettlewell Good points! I've added those checks to avoid unnecessary interpolators.

Nice, looks good!

# Conflicts:
#	com.unity.render-pipelines.universal/CHANGELOG.md
Copy link
Contributor

@erikabar erikabar left a comment

Choose a reason for hiding this comment

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

Tested Particle rendering into Depth texture and Depth Normals; tested on OSX, iOS and Android - no issues found.

# Conflicts:
#	com.unity.render-pipelines.universal/CHANGELOG.md
@phi-lira phi-lira merged commit 9c2ed2e into master Feb 24, 2021
@phi-lira phi-lira deleted the universal/feature/particles-depth-and-normals branch February 24, 2021 10:22
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.

4 participants