Skip to content

fix: saturate alpha regardless of HDR - #869

Open
sindharta wants to merge 3 commits into
masterfrom
fix-864
Open

fix: saturate alpha regardless of HDR#869
sindharta wants to merge 3 commits into
masterfrom
fix-864

Conversation

@sindharta

Copy link
Copy Markdown
Collaborator

No description provided.

@sindharta sindharta changed the title Fix 864 fix: saturate alpha regardless of HDR Aug 24, 2026
@sindharta-tanuwijaya
sindharta-tanuwijaya requested a lite review from Copilot August 24, 2026 07:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants