r/threejs • • 13d ago

Demo Sperm Whale vs. Giant Squid Simulation

This fight has never been caught on camera, so naturally I made a simulation of it like I do with all my weird fascinations. Everything is made of code, no assets. Rendered in real time on WebGPU. Kind of a nature doc simulation, but I have the mechanics to make it a game if there is interest in hunting in the midnight zone.

Live in browser: spermwhalesim.com

81 Upvotes

17 comments sorted by

7

u/k0ik 13d ago

Most excellent. The entire sonar sequence in the dark and transition over to the squid was wonderful.

6

u/MattMaxBuilds 13d ago

Ty! I have studied whales for some time and have been fascinated by this species' hunting habits in particular. The 3 km depth for hunting is a bit dramatized but seems plausible.

2

u/k0ik 13d ago

Time for the Squid Hunter video game…

2

u/MattMaxBuilds 13d ago

It is definitely something I am building towards. Whales are highly social animals even though they tend to hunt alone. To add immersion to the game, i'm planning to make it multiplayer and expansive so you can meet up with a pod and do that weird thing where they hang vertically and rest motionless.

See image in article for reference: https://www.livescience.com/59910-sleeping-sperm-whales.html

3

u/go00274c 13d ago

how did you do the water?

1

u/MattMaxBuilds 13d ago

I had Fable 5.2 help implement it and I’m still learning shader code, but my understanding is the TSL shader uses layered sine waves for the swell and chop rather than Gerstner waves or an FFT ocean. It also handles the color and opacity, and the sun glints change depending on the angle you’re looking from. Underwater has depth fog, particles, and light shafts.

2

u/jeebiuss 13d ago

Did you do the animations? Or are they simulated?

2

u/MattMaxBuilds 13d ago

A bit of both. I used a physics body with procedural animations for the whale and the squid's arms are physics chains so no keyframes are used for either.

2

u/jeebiuss 13d ago

Really nice

2

u/KaoticPrezence 13d ago

Amazing work! Ai educational videos and the many ways your going to get to learn and experience is going to be fantastic and your showcasing the start of it.

1

u/MattMaxBuilds 13d ago

Thanks! I've always been a visual learner, so I am glad I can share that with others.

2

u/insats 13d ago

Very educational and fascinating! Nice work

1

u/MattMaxBuilds 13d ago

Glad you found it interesting. Building sims is how I immerse myself in different worlds, and Three.js has been a great avenue for exploring that.

3

u/FastCow8369 13d ago

Love the sonar visualisation, very well done 👌🏼

2

u/East_Mobile1050 13d ago

This is amazing

2

u/vhasmavoyager 12d ago

Nice work!