Skip to content

Commit 0826fb9

Browse files
authored
Merge pull request #87 from prime-optimal/fix/metal-scalar-distance
Fix shaders failing to compile with Metal renderer
2 parents 244fdae + 6e4ccbb commit 0826fb9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

data/gradient.effect

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ float4 PSSolid(VertInOut vert_in) : TARGET
6565

6666
float4 PSGradient(VertGrad vert_in) : TARGET
6767
{
68-
float lerp_t = saturate((distance(vert_in.tex.y, grad_center) - grad_offset) / grad_height);
68+
float lerp_t = saturate((abs(vert_in.tex.y - grad_center) - grad_offset) / grad_height);
6969
return lerp(color_base, color_crest, lerp_t);
7070
}
7171

7272
float4 PSRange(VertGrad vert_in) : TARGET
7373
{
74-
float ratio = 1.0 - saturate((distance(vert_in.tex.y, grad_center) - grad_offset) / grad_height);
74+
float ratio = 1.0 - saturate((abs(vert_in.tex.y - grad_center) - grad_offset) / grad_height);
7575
if (ratio > range_middle)
7676
return color_base; // Green
7777
else if (ratio < range_crest)

0 commit comments

Comments
 (0)