Skip to content

Commit d7552fc

Browse files
pjbunityEvergreen
authored andcommitted
[HDRP] Fix build issues on ternary operator
Fixing build issues caused by ternary operator use in shaders.
1 parent ea4f4f5 commit d7552fc

File tree

1 file changed

+4
-1
lines changed
  • Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit

1 file changed

+4
-1
lines changed

Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitData.hlsl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,10 @@ float3 ComputeMainBaseColorInfluence(float influenceMask, float3 baseColor0, flo
681681
// (baseColor - meanColor) + lerp(meanColor, baseColor0, inheritBaseColor) simplify to
682682
// saturate(influenceFactor * (baseColor0 - meanColor) + baseColor);
683683
// There is a special case when baseColor < meanColor to avoid getting negative values.
684-
float3 factor = baseColor > meanColor ? (baseColor0 - meanColor) : (baseColor0 * baseColor / max(meanColor, 0.001) - baseColor); // max(to avoid divide by 0)
684+
float3 factor = (baseColor0 - meanColor);
685+
factor.x = baseColor.x > meanColor.x ? factor.x : (baseColor0.x * baseColor.x / max(meanColor.x, 0.001) - baseColor.x); // max(to avoid divide by 0)
686+
factor.y = baseColor.y > meanColor.y ? factor.y : (baseColor0.y * baseColor.y / max(meanColor.y, 0.001) - baseColor.y);
687+
factor.z = baseColor.z > meanColor.z ? factor.z : (baseColor0.z * baseColor.z / max(meanColor.z, 0.001) - baseColor.z);
685688
return influenceFactor * factor + baseColor;
686689
}
687690
#ifndef SHADER_STAGE_RAY_TRACING

0 commit comments

Comments
 (0)