Skip to content

An agent skill for creating detailed, interactive isometric illustrations of real-world machines and complex systems. Generates polished SVGs with optional WebGL shaders and 3D effects.

fix(ripple-tank): read ink colour from the fixed per-theme uniform

Siddhardha Nandac339da4ae71f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8c9e657..47e55c4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,7 @@ All notable changes to Anatomy are recorded here. The format follows [Keep a Cha
- Await asynchronous `until` conditions without treating the promise itself as success, while enforcing the wait deadline.
- Capture measures the current figure before every screenshot, including moved, resized and timed zoom crops.
- `publish.mjs --submit` makes the fork again with gh 2.101 and later, which refuse `--remote` when a repository is named; gh never adds a remote in that case, so the flag is gone (#53).
+- Ripple Tank's water and paper shaders read their ink colour from the same fixed per-theme uniform as every other tuned constant in the figure, instead of carrying its own hardcoded `pale ? light : dark` pair inline in GLSL.
## [1.1.0] - 2026-10-12
diff --git a/examples/ripple-tank/live.js b/examples/ripple-tank/live.js
index 35ffeaf..fed67e7 100644
--- a/examples/ripple-tank/live.js
+++ b/examples/ripple-tank/live.js
@@ -26,7 +26,7 @@ const WAVE_GLSL = `
uniform vec2 uS1;uniform vec2 uS2;uniform float uPhase;uniform float uReach;
uniform sampler2D uHT;uniform vec4 uLo;uniform vec4 uSpan;uniform vec2 uHist;uniform float uIG;uniform float uKNow;uniform float uStep;
uniform float uSlope;uniform float uCaustic;uniform float uMag;
-uniform vec4 uIn;uniform float uBeach;uniform vec4 uZ;uniform float uLight;uniform float uPale;uniform float uBed;uniform vec3 uLamp;uniform float uSpread;
+uniform vec4 uIn;uniform float uBeach;uniform vec4 uZ;uniform float uLight;uniform float uPale;uniform float uBed;uniform vec3 uLamp;uniform float uSpread;uniform vec3 uInk;
const float HN=${HIST}.;
float gPx;vec2 gGrad;vec3 gHess;float gCurv;float gAmp;float gKA;float gMove;
float coneOf(vec3 p){float drop=uLamp.z-p.z;float spread=13.4+drop*uSpread;return 1.-smoothstep(spread*.72,spread,length(p.xy-uLamp.xy));}
@@ -175,7 +175,7 @@ void main(){
float lit=mix(1.-.05*exp(-e),1.-uExpo.x/(1.+pow(e/uExpo.y,uExpo.z)),paper);
float off=(1.-mix(.95,1.-uExpo.x,paper))/.89*base;
float ink=mix(off,(1.-lit)/.89*base,uLight);
- gl_FragColor=vec4(dither(vec3(.11,.11,.12)*ink),ink);
+ gl_FragColor=vec4(dither(uInk*ink),ink);
}else{
float glow=(1.-exp(-uExpo.x*e))*mix(.34,.92,paper)*base*uLight;
vec3 c=dither(vec3(glow));
@@ -259,7 +259,7 @@ void main(){
add=max(add,0.);tint=clamp(tint,0.,.9);
float a=add+tint;
float over=max(a,1.);
- vec3 ink=uPale>.5?vec3(.11,.11,.12):vec3(.02,.025,.03);
+ vec3 ink=uInk;
vec3 c=dither(vec3(add)+ink*tint)/over;
gl_FragColor=vec4(c,a/over)*uLight;
}`;
@@ -304,6 +304,7 @@ const FIXED = {
uTop: D.top,
uTint: pale ? 0.06 : 0.08,
uWall: pale ? [0, 0.2, 0, 0.45] : [0.05, 0.16, 0.5, 0],
+ uInk: pale ? [0.11, 0.11, 0.12] : [0.02, 0.025, 0.03],
};
const NAMES = ["uS1", "uS2", "uPhase", "uHist", "uIG", "uKNow", "uStep", "uLight"];
const paperLayer = glLayer({ canvas: paperCanvas, fragment: PAPER_GLSL, view: [D.W, D.H], camera: D.camera, uniforms: NAMES, fixed: FIXED, extensions: ["GL_OES_standard_derivatives"] });
diff --git a/examples/ripple-tank/ripple-tank-light.html b/examples/ripple-tank/ripple-tank-light.html
index 2a32645..dc7837a 100644
--- a/examples/ripple-tank/ripple-tank-light.html
+++ b/examples/ripple-tank/ripple-tank-light.html
@@ -1231,7 +1231,7 @@ const WAVE_GLSL = `
uniform vec2 uS1;uniform vec2 uS2;uniform float uPhase;uniform float uReach;
uniform sampler2D uHT;uniform vec4 uLo;uniform vec4 uSpan;uniform vec2 uHist;uniform float uIG;uniform float uKNow;uniform float uStep;
uniform float uSlope;uniform float uCaustic;uniform float uMag;
-uniform vec4 uIn;uniform float uBeach;uniform vec4 uZ;uniform float uLight;uniform float uPale;uniform float uBed;uniform vec3 uLamp;uniform float uSpread;
+uniform vec4 uIn;uniform float uBeach;uniform vec4 uZ;uniform float uLight;uniform float uPale;uniform float uBed;uniform vec3 uLamp;uniform float uSpread;uniform vec3 uInk;
const float HN=${HIST}.;
float gPx;vec2 gGrad;vec3 gHess;float gCurv;float gAmp;float gKA;float gMove;
float coneOf(vec3 p){float drop=uLamp.z-p.z;float spread=13.4+drop*uSpread;return 1.-smoothstep(spread*.72,spread,length(p.xy-uLamp.xy));}
@@ -1380,7 +1380,7 @@ void main(){
float lit=mix(1.-.05*exp(-e),1.-uExpo.x/(1.+pow(e/uExpo.y,uExpo.z)),paper);
float off=(1.-mix(.95,1.-uExpo.x,paper))/.89*base;
float ink=mix(off,(1.-lit)/.89*base,uLight);
- gl_FragColor=vec4(dither(vec3(.11,.11,.12)*ink),ink);
+ gl_FragColor=vec4(dither(uInk*ink),ink);
}else{
float glow=(1.-exp(-uExpo.x*e))*mix(.34,.92,paper)*base*uLight;
vec3 c=dither(vec3(glow));
@@ -1464,7 +1464,7 @@ void main(){
add=max(add,0.);tint=clamp(tint,0.,.9);
float a=add+tint;
float over=max(a,1.);
- vec3 ink=uPale>.5?vec3(.11,.11,.12):vec3(.02,.025,.03);
+ vec3 ink=uInk;
vec3 c=dither(vec3(add)+ink*tint)/over;
gl_FragColor=vec4(c,a/over)*uLight;
}`;
@@ -1509,6 +1509,7 @@ const FIXED = {
uTop: D.top,
uTint: pale ? 0.06 : 0.08,
uWall: pale ? [0, 0.2, 0, 0.45] : [0.05, 0.16, 0.5, 0],
+ uInk: pale ? [0.11, 0.11, 0.12] : [0.02, 0.025, 0.03],
};
const NAMES = ["uS1", "uS2", "uPhase", "uHist", "uIG", "uKNow", "uStep", "uLight"];
const paperLayer = glLayer({ canvas: paperCanvas, fragment: PAPER_GLSL, view: [D.W, D.H], camera: D.camera, uniforms: NAMES, fixed: FIXED, extensions: ["GL_OES_standard_derivatives"] });
diff --git a/examples/ripple-tank/ripple-tank.html b/examples/ripple-tank/ripple-tank.html
index 47b8898..6074fef 100644
--- a/examples/ripple-tank/ripple-tank.html
+++ b/examples/ripple-tank/ripple-tank.html
@@ -1231,7 +1231,7 @@ const WAVE_GLSL = `
uniform vec2 uS1;uniform vec2 uS2;uniform float uPhase;uniform float uReach;
uniform sampler2D uHT;uniform vec4 uLo;uniform vec4 uSpan;uniform vec2 uHist;uniform float uIG;uniform float uKNow;uniform float uStep;
uniform float uSlope;uniform float uCaustic;uniform float uMag;
-uniform vec4 uIn;uniform float uBeach;uniform vec4 uZ;uniform float uLight;uniform float uPale;uniform float uBed;uniform vec3 uLamp;uniform float uSpread;
+uniform vec4 uIn;uniform float uBeach;uniform vec4 uZ;uniform float uLight;uniform float uPale;uniform float uBed;uniform vec3 uLamp;uniform float uSpread;uniform vec3 uInk;
const float HN=${HIST}.;
float gPx;vec2 gGrad;vec3 gHess;float gCurv;float gAmp;float gKA;float gMove;
float coneOf(vec3 p){float drop=uLamp.z-p.z;float spread=13.4+drop*uSpread;return 1.-smoothstep(spread*.72,spread,length(p.xy-uLamp.xy));}
@@ -1380,7 +1380,7 @@ void main(){
float lit=mix(1.-.05*exp(-e),1.-uExpo.x/(1.+pow(e/uExpo.y,uExpo.z)),paper);
float off=(1.-mix(.95,1.-uExpo.x,paper))/.89*base;
float ink=mix(off,(1.-lit)/.89*base,uLight);
- gl_FragColor=vec4(dither(vec3(.11,.11,.12)*ink),ink);
+ gl_FragColor=vec4(dither(uInk*ink),ink);
}else{
float glow=(1.-exp(-uExpo.x*e))*mix(.34,.92,paper)*base*uLight;
vec3 c=dither(vec3(glow));
@@ -1464,7 +1464,7 @@ void main(){
add=max(add,0.);tint=clamp(tint,0.,.9);
float a=add+tint;
float over=max(a,1.);
- vec3 ink=uPale>.5?vec3(.11,.11,.12):vec3(.02,.025,.03);
+ vec3 ink=uInk;
vec3 c=dither(vec3(add)+ink*tint)/over;
gl_FragColor=vec4(c,a/over)*uLight;
}`;
@@ -1509,6 +1509,7 @@ const FIXED = {
uTop: D.top,
uTint: pale ? 0.06 : 0.08,
uWall: pale ? [0, 0.2, 0, 0.45] : [0.05, 0.16, 0.5, 0],
+ uInk: pale ? [0.11, 0.11, 0.12] : [0.02, 0.025, 0.03],
};
const NAMES = ["uS1", "uS2", "uPhase", "uHist", "uIG", "uKNow", "uStep", "uLight"];
const paperLayer = glLayer({ canvas: paperCanvas, fragment: PAPER_GLSL, view: [D.W, D.H], camera: D.camera, uniforms: NAMES, fixed: FIXED, extensions: ["GL_OES_standard_derivatives"] });