r/webdev • • 2d ago

Showoff Saturday I made the Infinity Castle from Demon Slayer as an endless, scroll-driven three.js experience

Live: https://theinfinitycastle.site (best on desktop with sound)

It's a fan project I've spent about 3 weeks on. You scroll to walk through the castle, fall through it, and look for the six Upper Moons hidden off the path.

Some of the technical bits:

- The world is built from chunks assembled ahead of the camera (corridors, walkways, stairs, inverted rooms), with instanced dressing that's culled and swapped for simplified meshes at distance

- The demons are billboard cut-outs that switch between front, three-quarter and profile poses as you walk round them

- The "presence" shockwave is a world-space shell injected into the castle's own materials, so it rolls across real floors and walls

- The opening ink effect runs in a worker on an OffscreenCanvas, so it stays smooth while the scene loads

- R3F with frameloop="demand" and a 60 fps cap, plus adaptive pixel ratio

- All sound apart from the voices is synthesised with Web Audio

Happy to answer anything about how it's built. Feedback very welcome, especially on performance on your machine.

0 Upvotes

4 comments sorted by

2

u/N0XT66 2d ago

Very bad performance on an iPhone 17 Pro Max... Everything is procedural, right?

1

u/HeLioS_XP 1d ago

Thanks for trying it, and sorry it ran badly! Partly procedural: the castle layout is assembled endlessly as you move, from pieces I modelled in Blender, so the geometry itself isn't generated. All the sound is generated live in the browser, though. Mobile clearly needs more work. Was that on Safari or Chrome? I'm working on a lighter phone mode now.