Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts toon shader fragment output alpha handling so transparency/clipping alpha is clamped (saturate) even when running in FP/HDR paths where SATURATE_IF_SDR is effectively a no-op.
Changes:
- URP: Clamp trans-clipping / clipping-transmode alpha with
saturate(_Inverse_Clipping_var + _Tweak_transparency). - HDRP: Clamp trans-clipping / clipping-transmode alpha using
saturate(...)in the forward pass.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBodyShadingGradeMap.hlsl | Uses saturate(...) for trans-clipping alpha so opacity is clamped regardless of FP/HDR behavior. |
| com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBodyDoubleShadeWithFeather.hlsl | Uses saturate(...) for clipping transmode alpha so opacity is clamped regardless of FP/HDR behavior. |
| com.unity.toonshader/Runtime/Shaders/HDRP/ShaderPassForwardUTS.hlsl | Updates trans-clipping and clipping-transmode alpha clamping logic in HDRP forward pass. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
510
to
+514
|
|
||
| outColor = float4(finalColor, 1 * ApplyChannelAlpha(channelAlpha)); | ||
|
|
||
| #elif _IS_TRANSCLIPPING_ON | ||
| float Set_Opacity = SATURATE_IF_SDR((inverseClipping + _Tweak_transparency)); | ||
|
|
||
| outColor = float4(finalColor, Set_Opacity * ApplyChannelAlpha(channelAlpha)); | ||
| outColor = float4(finalColor, saturate((inverseClipping + _Tweak_transparency) * ApplyChannelAlpha(channelAlpha))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.