You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[URP] Fix Accidental Alpha Overwrite in non-A2C Cases
This change fixes a case where some alpha-to-coverage specific logic was overwriting the alpha value used by transparent surfaces that were also using alpha-clipping. The solution for this problem is to inline the alpha overwrite logic into the alpha-to-coverage specific calculations.
// When AlphaToMask is not available: Terminates the current invocation if the alpha value is below the cutoff and returns the input alpha value otherwise
185
185
halfAlphaClip(half alpha, half cutoff)
186
186
{
187
-
// If the user has specified zero as the cutoff threshold, the expectation is that the shader will function as if alpha-clipping was disabled.
188
-
// Ideally, the user should just turn off the alpha-clipping feature in this case, but in order to make this case work as expected, we force alpha
189
-
// to 1.0 here to ensure that alpha-to-coverage never throws away samples when its active. (This would cause opaque objects to appear transparent)
190
-
alpha = (cutoff <= 0.0) ? 1.0 : alpha;
191
-
192
187
// Produce 0.0 if the input value would be clipped by traditional alpha clipping and produce the original input value otherwise.
193
188
// WORKAROUND: The alpha parameter in this ternary expression MUST be converted to a float in order to work around a known HLSL compiler bug.
// When alpha-to-coverage is available: Use the specialized value which will be exported from the shader and combined with the MSAA coverage mask.
201
200
// When alpha-to-coverage is not available: Use the "clipped" value. A clipped value will always result in thread termination via the clip() logic below.
0 commit comments