Sloped belts and filters drawn as one belt turned to 45° (t40)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -50,9 +50,8 @@ float beltSD(vec2 lb, bool endL, bool endR) {
|
||||
// The outline of the belt or filter in cell c. Belts and filters side by side are one belt, so
|
||||
// the line only rounds off where the whole run ends.
|
||||
float beltLineSD(ivec2 c, vec2 lb) {
|
||||
int nr = cls(cellAt(tCol, c + ivec2(4, 0))), nl = cls(cellAt(tCol, c - ivec2(4, 0)));
|
||||
return beltSD(lb, isBelt(nl) + isF(nl) < 0.5 && !(nl >= 19 && nl <= 30) && cls(cellAt(tCol, c + ivec2(-4, -4))) < 23,
|
||||
isBelt(nr) + isF(nr) < 0.5 && !(nr >= 19 && nr <= 30) && cls(cellAt(tCol, c + ivec2(4, -4))) < 23);
|
||||
int caps = int(cellAt(tTree, c).a * 255.0 + 0.5);
|
||||
return beltSD(lb, (caps & 1) != 0, (caps & 2) != 0);
|
||||
}
|
||||
// The rubber band of a belt or filter: 1 on a ridge. Ridges travel along the top run one way and
|
||||
// back along the bottom.
|
||||
@@ -62,6 +61,8 @@ float bandRidge(vec2 w, vec2 lb, float dir) {
|
||||
}
|
||||
vec3 bandColor(vec2 lb, float rg) { return mix(vec3(0.2, 0.21, 0.24), vec3(0.34, 0.35, 0.39), rg) * (lb.y < 2.0 ? 1.0 : 0.72); }
|
||||
|
||||
${SM_SLOPE_HELPERS}
|
||||
|
||||
void main() {
|
||||
float zp = uView.z, px = 1.0 / zp;
|
||||
vec2 sp = vec2(gl_FragCoord.x, uView.w - gl_FragCoord.y);
|
||||
@@ -185,6 +186,8 @@ void main() {
|
||||
C = mix(C, tc, smoothstep(-0.6, 0.6, (F.r - 0.5) / fwT));
|
||||
}
|
||||
|
||||
${SM_SLOPE_DRAW}
|
||||
|
||||
// ---- loose grains: little round pebbles; a pocket closed in by four grains is filled
|
||||
int np = int(isN(n0, 2) + isN(n1, 2) + isN(n2, 2) + isN(n3, 2));
|
||||
bool closed = isM(n0) + isM(n1) + isM(n2) + isM(n3) > 3.5;
|
||||
@@ -352,33 +355,6 @@ void main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Sloped belts and filters: a continuous running band over a triangular frame.
|
||||
if (nc >= 23 && nc <= 30) {
|
||||
int shape = (nc - 23) / 2;
|
||||
bool mesh = shape >= 2;
|
||||
float grade = (shape == 0 || shape == 2) ? -1.0 : 1.0;
|
||||
float dir = ((nc - 23) % 2) == 1 ? 1.0 : -1.0;
|
||||
vec4 tag = cellAt(tTree, c);
|
||||
vec2 lb = mod(w, 4.0);
|
||||
if (tag.a > 0.4) lb.y += 4.0;
|
||||
float face = grade < 0.0 ? 4.0 - lb.x : lb.x;
|
||||
float depth = (lb.y - face) * 0.70710678;
|
||||
float inside = smoothstep(-px, px, depth);
|
||||
float axis = (w.x + grade * w.y) * 0.5;
|
||||
float rg = step(0.72, fract((axis - dir * uTime * 30.0) * 0.5));
|
||||
vec3 band = bandColor(vec2(axis, 0.5), rg);
|
||||
vec3 frame = vec3(0.18, 0.19, 0.21);
|
||||
float roller = 1.0 - smoothstep(0.32, 0.5, length(vec2(mod(axis, 2.0) - 1.0, depth - 0.95)));
|
||||
frame = mix(frame, vec3(0.50, 0.40, 0.31), roller);
|
||||
if (mesh) {
|
||||
float hole = step(0.48, fract(axis)) * step(0.35, fract(depth * 1.8));
|
||||
band = mix(band, dot(tag.rgb, vec3(1)) > 0.01 ? tag.rgb * 0.7 : vec3(0.28, 0.32, 0.33), hole);
|
||||
frame = mix(C, vec3(0.25, 0.27, 0.30), roller * 0.7);
|
||||
}
|
||||
vec3 belt = mix(band, frame, smoothstep(0.55, 0.75, depth));
|
||||
C = mix(C, belt, inside);
|
||||
}
|
||||
|
||||
// ---- light, then the glow of hot things on top
|
||||
if (uLightMap.w > 0.5) C *= textureLod(tLight, (q - uLightMap.xy) / uLightMap.z / uLightSize, 0.0).rgb;
|
||||
if (uGlowK > 0.0) {
|
||||
|
||||
Reference in New Issue
Block a user