feat: draw all raster particle states
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled

This commit is contained in:
OpenAI Codex
2026-09-03 15:04:05 +08:00
parent c0d1ad43c4
commit a0aae48ec8
7 changed files with 277 additions and 8 deletions

View File

@@ -40,8 +40,15 @@ void main() {
if (any(isnan(velocity))) position = v_uv;
fragColor = vec4(position, fract(previous.b + 0.03125 * u_pass.y), 1.0);
} else if (mode < 1.5) {
// The trail consumes State B/A written by the real field-sampling pass.
// Four deterministic texels are enough for the Stage A visual proof.
// Formal Trail first fades the previous target. Its full-particle point
// draw follows in the same target and consumes every State texel.
if (u_mask.z > 0.5) {
fragColor = vec4(previous.rgb * u_marker.w, 1.0);
return;
}
// LEGACY VALIDATION DISPLAY: retain the original four deterministic
// samples for the historical ParticleValidationLayer only.
float marker = 0.0;
marker = max(marker, 1.0 - smoothstep(0.0, u_marker.z, distance(v_uv, texture(u_state_texture, vec2(0.125, 0.125)).rg)));
marker = max(marker, 1.0 - smoothstep(0.0, u_marker.z, distance(v_uv, texture(u_state_texture, vec2(0.375, 0.375)).rg)));
@@ -49,6 +56,11 @@ void main() {
marker = max(marker, 1.0 - smoothstep(0.0, u_marker.z, distance(v_uv, texture(u_state_texture, vec2(0.875, 0.875)).rg)));
vec3 color = previous.rgb * u_marker.w + marker * vec3(0.08, 0.55, 1.0);
fragColor = vec4(min(color, vec3(1.0)), 1.0);
} else if (mode > 3.5) {
// The vertex shader fetched this particle's State texel directly from
// the current State write texture. Every point contributes one formal
// particle draw; no CPU position data is involved per frame.
fragColor = vec4(0.08, 0.55, 1.0, 1.0);
} else {
// The formal RasterParticle layer displays the Trail texture written by
// the current State -> Trail pass. Legacy ParticleValidation keeps its