-
Notifications
You must be signed in to change notification settings - Fork 792
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
Adding "Allow Material Override" option to BuiltIn Targets #4637
Conversation
… target's properties dynamically when constructing the pass
…arency Override. Also fixed the additive mode for material override being slightly wrong.
… that it'd catch the incorrect additive blend states that were fixed
…s bug caused materials to occasionally not get updated properly due to metadata not being saved.
… override, the surface type was opaque, and the blend mode was pre-multiply. The code just needed to use the local variable for alpha.
…ader. Fixed up the relevant property drawers to correclty handle the missing gap in the enum as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -179,7 +181,7 @@ public static void SetupSurface(Material material) | |||
else if (blendMode == BlendMode.Premultiply) | |||
SetBlendMode(material, UnityEngine.Rendering.BlendMode.One, UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha); | |||
else if (blendMode == BlendMode.Additive) | |||
SetBlendMode(material, UnityEngine.Rendering.BlendMode.One, UnityEngine.Rendering.BlendMode.One); | |||
SetBlendMode(material, UnityEngine.Rendering.BlendMode.SrcAlpha, UnityEngine.Rendering.BlendMode.One); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this found to be incorrect before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was previously using SrcAlpha here:
https://github.com/Unity-Technologies/Graphics/pull/4146/files#diff-367c30015afe895e9632641c20999255654e8fd31366a60bd2ab17e195c38f77L478
When doing the material override stuff before I incorrectly changed this but the tests weren't sensitive enough to catch the error. I've upped the sensitivity so they would fail now on this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work on testing, finding bugs, and following them up with fixes.
Please read the Contributing guide before making a PR.
Checklist for PR maker
CHANGELOG.md
file.Purpose of this PR
The BuiltIn target was implemented with material override, but this was always true and couldn't be controlled via the shader graph. This PR is making the built-in target match URP by adding an option to shader graph to specify if the surface options should be controlled by the material or by the target on the shader graph.
Testing status
Additional tests for extra bugs found:
Comments to reviewers
In the added test project, a duplicate shader graph has to be added due to an existing bug not related to the built-in target: https://fogbugz.unity3d.com/f/cases/1328077/
A few addition bugs found: