mirror of
https://github.com/ilyakooo0/metal-metaballs.git
synced 2024-09-11 10:35:56 +03:00
A bit more progress in antialiasing.
This commit is contained in:
parent
9184f0ff69
commit
120a2c4797
@ -71,11 +71,6 @@ kernel void
|
||||
|
||||
float result = weightedValue + weightedLink;
|
||||
|
||||
if (result > 0.4 && result < 0.6) {
|
||||
bendClose += result;
|
||||
bendCloseCount += 1.0;
|
||||
}
|
||||
|
||||
ball += step(0.4, weightedValue);
|
||||
|
||||
float metaballValue = step(0.5, weightedValue + weightedLink);
|
||||
@ -87,11 +82,16 @@ kernel void
|
||||
colorSumLink /= (1 / distance1) + (1 / distance2);
|
||||
}
|
||||
|
||||
if (result > 0.4) {
|
||||
bendClose += result;
|
||||
bendCloseCount += 1.0;
|
||||
}
|
||||
|
||||
sum += metaballValue;
|
||||
}
|
||||
}
|
||||
|
||||
bendClose = bendClose / bendCloseCount;
|
||||
// bendClose = bendClose / bendCloseCount;
|
||||
|
||||
if (bendClose != 0.0) {
|
||||
bendClose = (bendClose - 0.4) * (1 / (0.6 - 0.4));
|
||||
@ -99,8 +99,8 @@ kernel void
|
||||
bendClose = 0.0;
|
||||
}
|
||||
|
||||
|
||||
float result = step(0.4, sum);
|
||||
result += bendClose * 10;
|
||||
result = clamp(result, 0.0, 1.0);
|
||||
|
||||
colorSum = colorSum / colorAccumulation;
|
||||
@ -109,6 +109,7 @@ kernel void
|
||||
colorSum = colorSumLink;
|
||||
}
|
||||
|
||||
|
||||
colorSum *= result;
|
||||
|
||||
outTexture.write(float4(colorSum.bgr, 1), gid);
|
||||
|
Loading…
Reference in New Issue
Block a user