Skip to content

Fix blend modes and separate preserve specular #1848

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 22 commits into from

Conversation

eh-unity
Copy link
Contributor

@eh-unity eh-unity commented Sep 11, 2020

See: #5762

Checklist for PR maker

  • Have you added a backport label (if needed)? For example, the need-backport-* label. After you backport the PR, the label changes to backported-*.
  • Have you updated the changelog? Each package has a CHANGELOG.md file.
  • Have you updated or added the documentation for your PR? When you add a new feature, change a property name, or change the behavior of a feature, it's best practice to include related documentation changes in the same PR. If you do add documentation, make sure to add the relevant Graphics Docs team member as a reviewer of the PR. If you are not sure which person to add, see the Docs team contacts sheet.
  • Have you added a graphic test for your PR (if needed)? When you add a new feature, or discover a bug that tests don't cover, please add a graphic test.

Purpose of this PR

Fix bug case 1260085 (use straight premultiply blend mode)
Separate preserve specular feature from premultiplied blend. Preserve specular is default.
Define URP blends more explicitly (match HDRP) by setting alpha channel blend too and allow pure blend modes.
Added a blend test case.
Added alpha effect to multiply by lerping to white.
Refactored BakedLit and Unlit implementation shader into their own .hlsl files.
Moved universal shader graph template to universal side.


Testing status

Manual Tests: What did you do?

Automated Tests: What did you setup? (Add a screenshot or the reference image of the test please)

Yamato: (Select your branch):
https://yamato.prd.cds.internal.unity3d.com/jobs/902-Graphics

Any test projects to go with this to help reviewers?


Comments to reviewers

  • Did not account/fix blend modes in fog
  • Did not update particle or 2D shaders
  • Did not handle accumulate alpha (alpha channel blend with Src == Zero)
  • No tests for blend modes & transparencies in fog
  • No tests for blending modes with multiple overlapping transparent objects

@phi-lira
Copy link
Contributor

Assigning @ellioman instead of me as reviewer as I have too many PRs under review atm.

Copy link
Contributor

@Verasl Verasl left a comment

Choose a reason for hiding this comment

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

Seeing keyword changes but no material upgrader is worrying, a material upgrader will be nessesay here, to also add and set values for the new blend properties for alpha.

A material upgrader is a must.

@Verasl Verasl requested a review from a team October 5, 2020 09:32
@@ -145,6 +149,7 @@ public virtual void FindProperties(MaterialProperty[] properties)
{
surfaceTypeProp = FindProperty("_Surface", properties);
blendModeProp = FindProperty("_Blend", properties);
preserveSpecProp = FindProperty("_PreserveSpecular", properties, false); // TODO: should be mandatory?
Copy link
Contributor

Choose a reason for hiding this comment

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

Create a discussion about this so we're not leaving a TODO for something that can be decided before this PR lands. :)

@@ -151,7 +157,7 @@ Shader "Universal Render Pipeline/Baked Lit"
alpha = OutputAlpha(alpha, _Surface);

return half4(color, alpha);
}
}*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete.

@@ -393,7 +402,7 @@ Shader "Universal Render Pipeline/Baked Lit"
alpha = OutputAlpha(alpha, _Surface);

return half4(color, alpha);
}
}*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete

@fra-frassineti-unity fra-frassineti-unity requested review from fra-frassineti-unity and removed request for a team October 9, 2020 07:16
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.

NOT APPROVED:
"URP/Unlit" Shader does not compile on my machine after upgrading materials. For more info see the attached test doc

Version: 2021.1.0a1.495
Revision: trunk eff81b68729d
Built: Wed, 07 Oct 2020 11:32:35 GMT

Test Doc:
https://docs.google.com/document/d/1tBreRBnfM6R4cNIWqZS-ixZbO_u_FKHo29nFuNO-Dlw/edit?usp=sharing

@fra-frassineti-unity fra-frassineti-unity requested a review from a team October 29, 2020 12:45
@fra-frassineti-unity
Copy link
Contributor

Since tomorrow will be my last day at Unity, I re-added @Unity-Technologies/gfx-qa-foundation

# Conflicts:
#	com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs
#	com.unity.render-pipelines.universal/Shaders/BakedLit.shader
@cinight cinight removed the request for review from a team November 10, 2020 10:21
@cinight
Copy link
Contributor

cinight commented Nov 10, 2020

Talked to Erik. PR is not ready yet. Please add "gfx-qa-foundation" tag as reviewer again when this is ready for testing again.

# Conflicts:
#	com.unity.render-pipelines.universal/Editor/ShaderGUI/BaseShaderGUI.cs
#	com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs
#	com.unity.render-pipelines.universal/Editor/ShaderGraph/UniversalFields.cs
@eh-unity eh-unity mentioned this pull request Feb 4, 2021
10 tasks
eh-unity added 2 commits March 2, 2021 13:05
# Conflicts:
#	com.unity.render-pipelines.universal/Editor/ShaderGUI/BaseShaderGUI.cs
#	com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalLitSubTarget.cs
#	com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs
#	com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalUnlitSubTarget.cs
#	com.unity.render-pipelines.universal/Editor/ShaderGraph/Templates.meta
@eh-unity
Copy link
Contributor Author

Stale. Ended up redoing the change. Link to PR in desc. Closing.

@eh-unity eh-unity closed this Sep 22, 2021
@eh-unity eh-unity deleted the universal/fix-premultiplied-alpha branch November 17, 2021 13:14
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.

7 participants