Skip to content

Commit ade2bd5

Browse files
committed
Brighten organism visuals
1 parent cfd2fce commit ade2bd5

2 files changed

Lines changed: 19 additions & 15 deletions

File tree

src/post.wgsl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
// All passes draw a single fullscreen triangle. The scene is rendered to an HDR
33
// (rgba16float) target; bloom is computed at reduced resolution and added back.
44

5-
const THRESHOLD: f32 = 0.78; // brightness above which a pixel blooms
6-
const BLOOM_STRENGTH: f32 = 0.34;
7-
const EXPOSURE: f32 = 0.92;
5+
const THRESHOLD: f32 = 0.56; // brightness above which a pixel blooms
6+
const BLOOM_STRENGTH: f32 = 0.48;
7+
const EXPOSURE: f32 = 1.08;
88

99
// Motion-trail feedback: each frame the HDR scene is multiplied by this factor
1010
// before new particles are drawn on top (see `fade` below + postprocess.rs).
1111
// Higher = longer-lived comet tails. Tuned against the particle/bloom gains so
1212
// overlapping trails glow without blowing out to solid white.
13-
const TRAIL_PERSISTENCE: f32 = 0.86;
13+
const TRAIL_PERSISTENCE: f32 = 0.89;
1414

1515
// Ambient background depth. Instead of fading to flat #000, the composite adds a
1616
// faint deep-blue/violet radial glow so the void reads as atmospheric. Kept
1717
// subtle so it never washes out the creatures or competes with the bloom; the
1818
// glow is brightest at the centre and falls to a near-black vignette at the
1919
// corners. These are pre-tonemap HDR intensities.
2020
const AMBIENT_COLOR: vec3<f32> = vec3<f32>(0.20, 0.11, 0.45); // deep blue-violet
21-
const AMBIENT_CENTER: f32 = 0.10; // glow intensity at screen centre
22-
const AMBIENT_EDGE: f32 = 0.015; // residual glow at the corners (vignette floor)
21+
const AMBIENT_CENTER: f32 = 0.12; // glow intensity at screen centre
22+
const AMBIENT_EDGE: f32 = 0.018; // residual glow at the corners (vignette floor)
2323

2424
struct VsOut {
2525
@builtin(position) pos: vec4<f32>,

src/shader.wgsl

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,24 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
107107
sin(angle * 5.0 - seed * 9.1) * 0.045;
108108
let dist = length(shaped_uv) / max(0.76, 1.0 + wobble);
109109

110-
let body = smoothstep(1.02, 0.62, dist);
110+
let body = smoothstep(1.04, 0.62, dist);
111111
let soft_edge = smoothstep(1.08, 0.86, dist);
112112
let inner = smoothstep(0.76, 0.16, dist);
113-
let halo = pow(max(0.0, 1.0 - dist), 2.4);
113+
let halo = pow(max(0.0, 1.0 - dist), 2.0);
114114

115115
let nucleus_offset = vec2<f32>(cos(seed * 6.28318), sin(seed * 6.28318)) * 0.18;
116116
let nucleus = smoothstep(0.26, 0.0, length(shaped_uv - nucleus_offset));
117+
let highlight_offset = vec2<f32>(-0.22, -0.28) + nucleus_offset * 0.28;
118+
let highlight = smoothstep(0.32, 0.0, length(shaped_uv - highlight_offset));
117119

118-
let cytoplasm = in.color * (body * 0.34 + inner * 0.18 + halo * 0.14);
119-
let membrane = mix(in.color, vec3<f32>(0.82, 0.92, 1.0), 0.32) * soft_edge * 0.12;
120-
let nucleus_rgb = mix(in.color, vec3<f32>(0.18, 0.22, 0.28), 0.45) * nucleus * 0.16;
121-
let rgb = cytoplasm + membrane + nucleus_rgb;
120+
let vivid = pow(max(in.color, vec3<f32>(0.001)), vec3<f32>(0.82));
121+
let cytoplasm = vivid * (body * 0.62 + inner * 0.32 + halo * 0.24);
122+
let membrane = mix(vivid, vec3<f32>(0.88, 0.96, 1.0), 0.38) * soft_edge * 0.28;
123+
let nucleus_rgb = mix(vivid, vec3<f32>(0.12, 0.16, 0.22), 0.38) * nucleus * 0.24;
124+
let highlight_rgb = vec3<f32>(1.0, 0.96, 0.84) * highlight * 0.18;
125+
let rgb = cytoplasm + membrane + nucleus_rgb + highlight_rgb;
122126

123-
return vec4<f32>(rgb, body * 0.72);
127+
return vec4<f32>(rgb, body * 0.82);
124128
}
125129

126130
// ---------------------------------------------------------------------------
@@ -178,8 +182,8 @@ fn food_fs(in: FoodVertexOutput) -> @location(0) vec4<f32> {
178182
// Calm teal/green nourishment colour, kept dim so it reads as ambient food
179183
// and never competes with the creatures or the bloom. Scaled by the patch's
180184
// current intensity so a depleted patch visibly fades.
181-
let teal = vec3<f32>(0.06, 0.32, 0.26);
182-
let brightness = 0.5;
185+
let teal = vec3<f32>(0.07, 0.38, 0.30);
186+
let brightness = 0.58;
183187
let rgb = teal * soft * brightness * in.intensity;
184188

185189
return vec4<f32>(rgb, soft);

0 commit comments

Comments
 (0)