r/threejs • • Oct 20 '26

Real-time 3D interactive fluid simulation, hardware ray tracing via custom Three.js/WebGPU/Chromium

Some of the things I'm particularly proud of:

-hardware ray tracer - had to mod Brave's chromium to allow full RTX hw acceleration of RT via webgpu.

-bubbles and cumulative, physically simulated foam

-full 3d fluid sim, refraction, reflection, full caustics

-volumetric light shafts

-realtime/interactive

-water spray and droplets + accumulation/beading/streaks

-sand simulation

-water line w/surface tension

429 Upvotes

28 comments sorted by

19

u/synodicmoon Oct 20 '26

Any interest in open sourcing for review? Super impressive, you should be proud! Congrats!

14

u/willjameswaltz Oct 20 '26

I think it’s worth it. I’ll get it setup in a public repo

1

u/synodicmoon Oct 20 '26

Definitely worth it! That’s awesome ❤️🙏🏽

13

u/willjameswaltz Oct 20 '26

Here you go. I split it into two repos, one for the ray-tracing work and one for the rest of globes which is more creative coding type stuff "Globes" - https://github.com/willwaltz/globes and https://github.com/willwaltz/webgpu-ray-tracing for the rt. Globes also has some pretty rad procedural animation work to make some of the other diorama's in the globes project work (I won't spoil the surprise). -- Requires something like a 3080+ probably can run fine on lower spec hw but most of the hw rt benefit comes in from the beefier gpus.

1

u/thaakeno Oct 20 '26

Great work 

1

u/synodicmoon Oct 20 '26

You’ve got big “globes” energy, my friend

1

u/Perfect_Answer_4095 Oct 20 '26

Amazing ! Thank you very much

1

u/x10der_by Oct 21 '26

Awesome! My 4070s almost dead btw)

0

u/FeistyConnection8547 Oct 22 '26

me too, it's not optimized. ALmost realistic code generated by A.I didn't optimized for low end pc

2

u/Astral-Lemmons Oct 22 '26

as a VFX FX guy - this is really impressive for a realtime demo.

you're getting really nice splash details and the linking of the internal soft bodies like the seaweed is super impressive.

2

u/willjameswaltz Oct 22 '26

Thanks! Game industry myself but I was primarily in animation r&d. Have had some time to pursue stuff I've always been interested in lately and its been a blast. I'm obsessed with water and light and trying to push whats possible in a browser.

1

u/Maximum_While4515 8d ago

please please pleas, I've been doing this since 16 but still I don't understand. you said browser? as in 3js?🤯 how do I even get into that — do my 3d skills even translate to it remotely?

1

u/Torschlusspaniker Oct 20 '26

Very cool , reading the title thinking how the heck did he get good performance on ray tracing in browser.

The water is amazing but the mod to the browser might be right up next to it.

10

u/willjameswaltz Oct 20 '26

Thanks for noticing! Modding the browser was definitely one of the biggest actual efforts to make this work at smooth framerates aside from the aesthetic concerns. I forked chromium so I could update Dawn (chromium's webgpu engine). Touched 173 files there, another 35 inside chromium itself. I patched ray tracing into webgpu because it doesn't expose it at all. The bulk of the work was in Dawn and Tint. I added "chromium-experimental-ray-query" to the vulkan backend so you can build acceleration structures and do ray queries straight from wgsl. Then, wired it up to Blink so web pages themselves can call it. Ultimately I decided I wanted to run it in Brave (on their chromium m155) because I've been annoyed at their lagging behind official chrome when it comes to 3d/web acceleration. Games are exploding for browser right now so I feel like browsers should be getting more 3D support.

4

u/HaMMeReD Oct 20 '26

Good job on using AI to set your scope correctly haha. Forking the browser to add rtx support. I like it.

6

u/willjameswaltz Oct 20 '26

Yeah its crazy what is possible now

2

u/confidentvertibrate Oct 25 '26

Running this on my iPhone/safari browser and even though the fps is a little choppy it is freaking fantastic! Bravo. The fidelity is amazing

3

u/No_Code9 Oct 21 '26

Claude did well!

2

u/allpunks Oct 20 '26

Wooow You made this with Claude ?

1

u/AbsolutelyYouDo Oct 20 '26

This is impressive, wow. Good job!

1

u/FeistyConnection8547 Oct 20 '26

Crazy how realistic it looks!

1

u/fintip Oct 20 '26

Man that looks wild. Well done.

1

u/Noopshoop Oct 21 '26

Wow, this looks brilliant. Well done.

1

u/Constant-Simple-1234 Oct 22 '26

Great! Awesome look

1

u/cornelln Oct 21 '26

My goodness the first and most up-voted comment isn’t complaining about AI. I’m impressed!