All MicroEvals
HTML/WebGL2 - Max
Create MicroEval

HTML/WebGL2 - Max

Prompt

Write a completely standalone, production-ready, single-file HTML/WebGL2 application that implements a real-time 2D Eulerian Fluid Dynamics solver rendered with 3D refractive surface optics. STRICT TECHNICAL CONSTRAINTS: 1. Zero External Dependencies: No Three.js, no Pixi, no dat.GUI, no CDN scripts. Raw WebGL2 API only. 2. Architecture & Pipeline: - Implement the full Stable Fluids pipeline using ping-pong Framebuffer Objects (FBOs) with floating-point textures (handle OES_texture_float / EXT_color_buffer_float fallback gracefully): a. Velocity & Dye Advection (semi-Lagrangian with bilinear interpolation). b. External Force splatting (mouse drag adds directional impulse and dye color with configurable radius and falloff). c. Vorticity confinement to preserve small-scale turbulent eddies. d. Divergence computation. e. Pressure Poisson equation solved via at least 20 Jacobi iterations. f. Pressure gradient subtraction to enforce mass conservation (divergence-free velocity field). 3. Visual & Optical Rendering: - Do not merely display a flat 2D color density map. - Render the fluid surface as an optical medium over a procedurally generated high-frequency underwater checkerboard/tile floor. - In the final composite pass, calculate surface normals dynamically from the dye density/pressure gradient. - Compute Snell's law refraction with chromatic dispersion (separate ray deflections for R, G, and B channels) when sampling the floor. - Approximate directional caustic highlights based on the divergence/curvature of the refracted ray vectors. - Add a subtle Fresnel reflection term and specular highlight (Blinn-Phong) from an off-axis directional light source. 4. User Interaction & UI: - Fullscreen responsive canvas resizing without stretching texture aspect ratios. - Minimalist, semi-transparent HUD showing live FPS and interactive toggle buttons for: Velocity Vectors, Pressure Field, and Optical Render mode. - Smooth mouse/touch drag interaction. The output must be 100% complete, fully working executable code inside a single ```html block with zero placeholder comments, omitted loops, or truncated sections.

A system prompt was added to support web rendering

Drag to resize

Response not available

Drag to resize
Drag to resize
Drag to resize
Drag to resize