-
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
[2021.2][URP][ShaderGraph] Enable automatic render queue control on SG-based material inspector #4610
Conversation
I'm not marking the upgrade testing as complete yet, so this should not get merged until I update further. Basically, I have local changes that I've confirmed let the upgrade work correctly (so technically I have done the upgrade testing), but the upgraded material property values are getting stomped on by the target/shaderGUI later on, and I need to unravel that before committing an update. |
- Two modes are "Auto" (0) and "UserOverride" (1) - Auto is by default, and behaves like hand-written shader based materials (switches based on SurfaceType for material override, otherwise based on what the shader defines). - UserOverride allows for a render queue selection independent of what the SurfaceType would select. - When encountering an older material, we initialize according to the actual serialized render queue property in the material (-1 or "FromShader" sets up queue control of "Auto", an expliict render queue sets up queue control of "UserOverride" and preserves the user's render queue choice.
d6f566e
to
981bac0
Compare
I've resolved this issue, but the code is a bit different (same logic, but not handled as part of the material upgrade path), so once the Yamato runs finish, we can call this done. |
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.
Mostly good, but it would be nice if a lot of the int literals could be turned into constants.
com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalUnlitSubTarget.cs
Show resolved
Hide resolved
com.unity.render-pipelines.universal/Editor/ShaderGUI/BaseShaderGUI.cs
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.universal/Editor/ShaderGUI/BaseShaderGUI.cs
Outdated
Show resolved
Hide resolved
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
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.
I have some small UX/UI requests but these can be tweaked later:
- the Render Queue /Sorting Priority should be indented I think since it is a setting directly affected by the above enum
- Sorting priority should be moved up one to sit under Queue Control
If these are simple changes would be great to get them in, just to give it that polished feel but no need for holding up the PR if not.
com.unity.render-pipelines.universal/Editor/ShaderGUI/ShaderGraphLitGUI.cs
Show resolved
Hide resolved
* Apply render queue control to BuiltIn Target and shader GUI to match URP - See #4610 and #4920 that address fogbugz 1335795 for details - This makes the shader GUI for built-in behave as URP does for better user experience * Update changelog to reflect the render queue control changes for the BuiltIn target
* Apply render queue control to BuiltIn Target and shader GUI to match URP - See #4610 and #4920 that address fogbugz 1335795 for details - This makes the shader GUI for built-in behave as URP does for better user experience * Update changelog to reflect the render queue control changes for the BuiltIn target
Checklist for PR maker
CHANGELOG.md
file.Purpose of this PR
This PR fixes https://fogbugz.unity3d.com/f/cases/1335795/
The material inspector behaves differently for handwritten shader-based materials than it does for ShaderGraph based materials. The handwritten shaders automatically force the setting of the render queue based on the surface type property, whereas the ShaderGraph materials allow for independent control of the render queue. This PR adds a new "Queue Control" on the material inspector with "Auto" and "UserOverride" options. The "Auto" option is selected by default and behaves the same way as a material created from the handwritten URP shaders (Lit.shader, Unlit.shader). The "UserOverride" option allows the current behavior of independent control over surface type and render queue. When "Auto" is selected, there is no Render Queue field (as with handwritten shaders).
The UI had a bit of a review after the original screen shot below in the testing status section. Currently, a "Queue Control" of "UserOverride" enables the "Render Queue" field, whereas "Auto" does not. "Sorting Priority" is always present as it is relevant regardless of where the render queue setting comes from. See these material inspector shots for detail:
It is perhaps worth mentioning that those two materials and shadergraphs were created with 2021.1 and dropped into a project that is using this branch (so they've been upgraded and not just created by these changes).
Testing status
Created a scene with 3 objects:
See this image:
Observed the following behaviors/test cases:
Upgrade testing:
Created Shader Graphs and corresponding materials in Unity 2021.1, loaded them in the 2021.2 build from this PR, and observed the following:
Yamato details below
(N.b., the following yamato jobs failed on master at the point of branch-off for this PR)
Test minimum editor version - Win
Test minimum editor version - OSX
Test all packages - OSX
Test all packages - Win
Universal_Hybrid - OSX Metal
Universal_Hybrid - Win DX11
The remaining "failures" are the result of those 4 dependencies failing, so this PR is as green as master at the point of branch-off.
Comments to reviewers
Notes for the reviewers you have assigned.