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

[10.x.x] Bugfix 1262887 - Transparent meshes are rendered as opaques when using Custom Render Pass #1613

Merged

Conversation

ellioman
Copy link
Contributor

@ellioman ellioman commented Aug 14, 2020

Purpose of this PR

Fixes bug 1262887.

In January I originally made a PR to fix bug 1168283.

The new bug shows that my previous solution didn't work in all cases. An example is if the renderer renders opaque objects with DrawObjectsPass and then transparent objects with a custom renderer feature, the transparent objects would be rendered as opaque as well.

This PR fixes the issue by:

  • deprecating _DrawObjectPassData in our shaders
  • adding _Surface to our CBuffers, which is either 0 (Opaque) or 1 (Transparent)
  • update the OutputAlpha() shader function to take surfaceType as input and use that to output the correct Alpha value
  • Update our shaders to send the surfaceTypes to the OutputAlpha() function

Automated Tests

Added a new test scene 110_URPShadersAlphaOutputCustomFeature, which is almost exactly the test scene I added when fixing the previous bug except it now uses a custom pass to render the transparent objects.

Results before this PR:
image

Results with this PR:
image

Yamato**

https://yamato.prd.cds.internal.unity3d.com/jobs/902-Graphics/tree/universal%252Fbugfix%252F1262887-transparents-renderered-opaque

@ellioman ellioman requested a review from a team August 21, 2020 11:30
…erered-opaque

# Conflicts:
#	com.unity.render-pipelines.universal/Shaders/LitInput.hlsl
@ellioman ellioman marked this pull request as ready for review August 21, 2020 11:43
@ellioman ellioman requested a review from a team as a code owner August 21, 2020 11:43
…erered-opaque

# Conflicts:
#	com.unity.render-pipelines.universal/Shaders/LitInput.hlsl
#	com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLitInput.hlsl
@erikabar erikabar requested review from erikabar and fra-frassineti-unity and removed request for a team and erikabar August 27, 2020 08:51
Copy link
Contributor

@fra-frassineti-unity fra-frassineti-unity left a comment

Choose a reason for hiding this comment

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

Version: 2020.2.0b1.2959
Revision: trunk 4ae7c5e87f33
Built: Tue, 25 Aug 2020 03:44:09 GMT

Test Doc: https://docs.google.com/document/d/14NkqK0MymB0gfKdafHcTIedQoDFFfDK3gLGUK22sIEs/edit?usp=sharing

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.

3 participants