Skip to content

Fix alpha output by forward opaque materials #2081

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

Closed
wants to merge 2 commits into from

Conversation

FrancescoC-unity
Copy link
Contributor

@FrancescoC-unity FrancescoC-unity commented Oct 2, 2020

Forward materials output the alpha sampled from the alpha channel of the base color texture even if opaque. This lead to errors depending on the import settings of the texture.

We instead hard code a fully opaque output when opaque.

Note: the issue with motion blur reported on the forum I can't repro, which makes me think was fixed in later packages.
Also, fog still outputs what looks like a color in the alpha channel and this is expected at the moment, it will need bigger changes to restore the alpha.

@github-actions
Copy link

github-actions bot commented Oct 2, 2020

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

@pmavridis pmavridis left a comment

Choose a reason for hiding this comment

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

Indeed, motion blur + alpha was fixed a few months ago by me.

I'm a bit afraid that this PR might break a project that was forward-only and (for example) was using a texture with alpha on a quad + some blending (to create something like a custom decal). But I don't have a better suggestion.

@FrancescoC-unity
Copy link
Contributor Author

FrancescoC-unity commented Oct 2, 2020

Indeed, motion blur + alpha was fixed a few months ago by me.

I'm a bit afraid that this PR might break a project that was forward-only and (for example) was using a texture with alpha on a quad + some blending (to create something like a custom decal). But I don't have a better suggestion.

That would still work, this replace happens just before output not during the shader processing. Throughout the shader the alpha from the texture is still valid.

If they need to output alpha, then they shouldn't use opaque anyway.

@sebastienlagarde
Copy link
Contributor

closing, integrated into this PR: #2083

@sebastienlagarde sebastienlagarde deleted the HDRP/fix-alpha-in-forward branch September 1, 2021 10:21
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.

3 participants