Inspiration

I am having fun seeing different things I can do with Codex like apps, games, tool, ect. The other day I wondered, could it make a VR simulation. So I thought, i work in drinking water treatment, and jar testing is one of the clearest ways to show how coagulation works. You add different doses, mix the water, watch floc form, and compare which jar clears best. I thought it would be a nice start to try the idea out. For VR the problem is that a literal row of six jars is recognizable, but not especially exciting. I wanted to keep that familiar setup while making the process easier to see. Sunol FlowLab VR uses a classic jar-test bench as the control and comparison area, with a larger observation tank that shows floc formation, settling, and the clearing front in more detail.

What it does

The viewer is in a simulated water quality lab at a water treatment plant. You can set the coagulant dose, observe the result and record the data. Also you can read up on the process in the lab's refrence library.

How I built it

The project is a browser-based WebXR experience built with React, TypeScript, Three.js, React Three Fiber, and Vite.

The simulation is kept separate from the renderer and XR controls. It uses a fixed timestep, seeded randomness, typed arrays, and instanced rendering so the same trial can be repeated consistently without creating large numbers of objects every frame.

The user selects a relative dose from 0 through 10. That dose changes the chance that particles will combine into larger floc. Larger floc settles faster, leaving less suspended material in the upper part of the tank.

The same simulation output drives the water appearance, measurement, plot, and saved result. This was important because I did not want the visuals showing a “good” result that the underlying model did not actually produce.

I used OpenAI Codex to help review the repository, plan the work in batches, catch architecture problems, and build tests around each step.

Challenges we ran into

The hardest part has been balancing realism, clarity, and performance.

Real coagulation is complicated, but adding more chemistry does not automatically make the lesson better. I had to keep the model simple enough to understand while still showing a believable difference between underdose, a near-optimum dose, and overdose.

Performance is another challenge. Hundreds of particles are manageable, but transparent water, glass, haze, and lighting effects can become expensive in a headset. The project uses one instanced particle mesh, restrained transparency, and a single turbidity display layer instead of stacking many effects.

Accomplishments that we're proud of

We built a working WebXR foundation that runs in the browser and supports both desktop and VR use.

The simulation is deterministic, uses seeded randomness, and keeps process state separate from rendering and controls. That makes it easier to test, repeat trials, and add new treatment behavior without rebuilding the whole project.

We are also proud of the visual direction. Instead of making a literal six-jar simulator, we designed a hybrid setup with a recognizable jar-test bench and a larger observation tank that makes floc formation and settling easier to see.

Another major accomplishment was keeping the project focused. We avoided turning it into a full plant simulator or a general-purpose engine before proving the core idea.

What we learned

The biggest lesson was that limiting scope can improve the final experience.

Instead of building a full treatment plant, six simultaneous simulations, or a general-purpose engine, I focused on one process and one clear idea More chemical does not always mean better treatment. That gave me room to spend more time on the parts people will actually notice, such as floc growth, settling, physical controls, and comparing results.

What's next for Sunol Flowlab VR

The next step is to finish the coagulation experience, test it with users, and improve it based on what they understand, notice, and enjoy. User feedback will help shape the controls, pacing, readability, and how clearly the project explains the treatment process. After that, the goal is to expand Sunol FlowLab VR into a collection of water-treatment simulations. Future modules could explore filtration, sedimentation, disinfection, chemical feed, and other operator-focused scenarios while keeping the same hands-on and visual approach.

Built With

Share this project:

Updates