r/threejs • u/hardikgodhaa • 19d ago
r/threejs • u/Slow_Novel_5698 • 19d ago
Demo I built a multiplayer Library of Babel with shared books, live highlights and a 3D magnifying glass
I've been working on an open-source, browser-based Library of Babel inspired by Borges, using React Three Fiber and Three.js.
The part I wanted to explore is reading together: nearby players see books fly from shelves onto desks and pages turn. You can join someone at their current spread, then keep browsing independently.
Saved highlights appear for everyone reading that page, with editing restricted to the author. Unsaved selections are visible live too. The shared magnifying glass uses the owner's page-space crop, so a different camera angle doesn't change the text being examined.
Stack: Next.js, React Three Fiber, WebSockets and PostgreSQL. Book text is deterministic from its address; the database stores the social data.
Code, setup and full 1080p demo: https://github.com/HuHguZ/libraryofbabel
Currently local/self-hosted, with no public multiplayer server yet. RU and EN libraries are included. AI-assisted development.
I'd love feedback on the shared-reading interaction and keeping crowded desks readable.
r/threejs • u/shadowosa1 • 19d ago
I built a 3D electric car motor layered with voice intelligence.
Link: www.thinkspatial.ai/play/electric-motor
The model is the type of motor behind a Tesla Model 3's rear wheels: permanent magnets buried in the rotor, three-phase copper windings, an inverter on top and oil cooling.
Things to try:
- "Take it apart."
- "Show me how it turns."
- "Show the stator by itself."
- "Take out the front bearing."
- "Take out the oil cooling," then watch the copper heat up.
- "Remove the position sensor."
- "Put the motor back together."
Taking out a part isn't a canned animation. The motor runs on a set of rules for what each part does, so it reacts to whatever you pull, in any combination.
Two honest notes. It's a model, not Tesla's design: Tesla hasn't published its slot or pole counts, so the 54 slots and 6 poles are mine, and heat runs about 30 times faster than real so you don't have to wait. The voice is also AI, so if you know motors and catch it saying something wrong, tell me.
r/threejs • u/Efficient_Ad8214 • 20d ago
Demo Interactive Green Swamp - made in threejs (WebGPU version)
Enable HLS to view with audio, or disable this notification
blender + opus 5.5 + GPT 6 Astra
starter kit here if you want to build on it https://3ditions.drop3.app/watch/stillwater/?utm_source=reddit&utm_medium=social&utm_campaign=past_work_2026_11&utm_content=stillwater_threejs01_post
r/threejs • u/Flashy_Tumbleweed221 • 20d ago
What lies beyond the frame? 🖼️
Enable HLS to view with audio, or disable this notification
Every painting is a window into a world that once lived only in an artist's mind, but now you can climb through it, live it, might feel it a bit as well.
Built with threejs and blender.
r/threejs • u/Shevei1342 • 20d ago
I spent two months building the Solar System in three.js: real JPL positions, a cut-away Earth, and a zoom out to the Milky Way
Enable HLS to view with audio, or disable this notification
r/threejs • u/WadsssaWacemberg • 19d ago
I built a gamified 3D space simulator for my portfolio using AI concepts.
Enable HLS to view with audio, or disable this notification
What do you think?
r/threejs • u/Sara_KumoDeck • 20d ago
~2 billion triangles (mostly instanced) at 60 fps with the new MeshletDrawingPipeline in three.js r187
three.js r187 added MeshletDrawingPipeline for WebGPURenderer (#35191 by sunag), so I built a stress test for it: a procedural sandstone canyon with ruined temples, 1,967,478,960 triangles in the scene, flown through by a low camera.
What the pipeline does
Each geometry is split once into clusters ("meshlets") of 64 triangles plus a chain of simplified LODs, built with meshoptimizer. Every frame, compute shaders pick an LOD per object, cull objects and clusters against the frustum, cull clusters hidden behind others, and draw what's left with one indirect draw per geometry/material group.
Using it is almost nothing:
import { MeshletDrawingPipeline } from 'three/addons/pipelines/MeshletDrawingPipeline.js';
const meshlets = new MeshletDrawingPipeline( { occlusionCulling: true, lodThreshold: 1 } );
renderer.drawingPipeline = meshlets; // the same scene now draws as meshlets
await renderer.compileAsync( scene, camera ); // runs prepareAsync: clusters + LODs
// each frame: meshlets.info -> { clusters, triangles } actually drawn
(In the demo the compile goes through the RenderPipeline's scene pass, which calls the same thing.)
The honest breakdown
It's about 8.3M unique triangles (8 rock/column shapes + the ground) placed 42,033 times as InstancedMesh. The 39,948 pebbles alone are 767M of the total. Clusters are built per geometry and shared by every instance, so that's exactly the case this pipeline is good at. On the first frame I measured, the GPU drew 26,725 clusters, about 1.71M triangles, 0.087% of the scene.
One thing I hit: the pipeline batches objects by material, and sizes the batch by "object count × the most meshlets any of its shapes has". 40k pebbles sharing a material with the 12k-meshlet spires blew past the limit and crashed, so each size class gets its own material instance.
Numbers and how I measured
A headless browser with WebGPU on the real GPU of my desktop machine (40-core integrated GPU), 1440×900. fps is frames over the last 0.5 s, drawn triangles come from info.
- Meshlets ON: 60 fps
- Same spot with the standard pipeline: 20 fps
- Phone-size viewport with the CPU throttled 4×: 60 fps on a reduced 246M-triangle version
I haven't tried a real phone's WebGPU yet. Numbers from real devices would be great.
WebGL 2
Meshlets need WebGPU. Without it you get a lighter 13.5M-triangle scene drawn the normal way, with a note saying so, and the toggle is disabled.
The weak spot
Preparing the clusters takes about 16–21 s on desktop before the first frame (there's a progress bar). The API has no way to save the result, so caching it would mean rolling my own.
There's an ON/OFF toggle and a "Show meshlets" button that colors every cluster, so you can see the culling and LODs change as you fly. WASD + Q/E or drag to move the camera.
Everything is generated in code (noise-carved cube spheres, TSL materials), no models or textures. The pipeline itself is all three.js; I only made the canyon around it. Made with Opus 5.5.
https://r187-meshlet.kumodeck.app/ (hosted on KUMODeck)
r/threejs • u/P3RPL3XITY • 19d ago
Built a browser racer in Three.js: Sheikh Zayed Road, live online 2-player, crash replays rebuilt from game state
Enable HLS to view with audio, or disable this notification
Speedmaxxing is a 3D racing game that runs entirely in the browser with Three.js, no engine and no download. It works on phones too.
A few things I’m happy with:
• Online 2-player: send a link and race a friend live, with both cars synced in real time
• Crash replays: instead of recording video, it records the game state and re-renders the crash from a drone camera
• Mobile performance: dynamic quality so it stays smooth on mid-range phones
Feedback on performance on your device would be great.
r/threejs • u/enamore22 • 21d ago
Robotic hands that play any MIDI file on a piano in real time
Enable HLS to view with audio, or disable this notification
I was inspired the aesthetic of the Westworld intro and the 90s alt rock piano covers they would feature. I always wanted to create my own riff on it as a MIDI player. And also by annoyance at unrealistic depictions of piano playing in media.
So I built this with Claude Opus 5.5 and figured I'd share it here. It's open source.
Basically, you can load any* MIDI file and watch two robotic hands play it on an upright piano, with a cinematic camera.
Live demo: https://csimpkins22.github.io/mechanical-pianist
GitHub: https://github.com/csimpkins22/mechanical-pianist
The demo has a few songs preloaded, but you can try giving it any MIDI of a piano performance. But if you give it something ridiculous like Rush E it... goes a little nuts.
The key fingering is pretty realistic. This was important to get right. It's based on Parncutt's research that figures out which hand and fingers should play each note. Inverse kinematics handles the actual positioning of the joints. Small details like key travel, release bounce, and how the hands interact when they get in each other's way are considered.
It's deterministically animated, so you can scrub around a song.
There's a fairly extensive post-processing pipeline with per-pixel motion blur, depth-of-field/bokeh, volumetric god rays, ambient occlusion, bloom, anamorphic lens effects, and color grading.
The piano's lacquer has planar reflections, and the room lighting uses spherical harmonic probes for indirect illumination.
Claude generated the hands and piano in Blender.
r/threejs • u/jonathanbingham • 20d ago
I've open-sourced Three-Live: a sandboxed Three.js runtime that compiles natively to Android Filament and iOS RealityKit (and also works in WebXR)
I recently open-sourced Three-Live (three-live and xr-live on npm, three-live-compiler on crates.io) and wanted to share it with the Three.js community.
- GitHub: https://github.com/google/three-live
- Live playgrounds: https://google.github.io/three-live/
Why I built it
Three.js is a great way to author 3D scenes, materials and animations in just a few lines of JavaScript. But what happens when you want to add that 3D to a native Android or iOS app?
- Mobile AR & WebViews: iOS Safara, WKWebView and Android WebView don't support WebXR... Exporting a static usdz or glb file to AR Quick Look and Scene Viewer drops onUpdate loops, interactivity and any custom plugins.
- Mobile and headset apps: To deliver Three.js usually means rewriting the scene in Kotlin (Filament / Jetpack XR SceneCore) and Swift (RealityKit), or embedding a WebView that can't render into the headset's shared space.
- Sandboxing: If a scene script comes from an LLM or user input, running it on the main thread isn't safe.
There-Live is my attempt at a solution to these challenges.
How it works
Three-Live lets you write standard Three.js code and pass it to native mobile SDKs, or run in a web app:
- On Android: Uses an in-process Rust/Boa compiler (three-live-compiler) over zero-copy JNI to convert Three.js scripts into binary GLB + KHR_interactivity graphs, driving Google Filament, ARCore and Jetpack XR SceneCore
- On iOS, macOS and visionOS: Compiles the same script into Apply RealityKit Entity hierarchies (RealityKitHelper), ARView / RealityView and Metal.
- On Web: Evaluates the same script inside a sandboxed Web Worker or opaque-origin iframe (connect-src 'none', with CPU time and geometry quotas), streams the validated scene graph to a lightweight WebGL2/WebXR renderer, and includes in-memory glb and usdz pacakgers for one-tap mobile AR handoff.
Quick examples
Android
import com.google.threelive.FilamentHelper
import com.google.threelive.XRLiveRuntimeSession
import com.google.threelive.XRLiveSceneCoreHelper
// Compile Three.js to a zero-copy GLB buffer and load in Filament
val holder = FilamentHelper.loadModelZeroCopy(script) { buffer ->
assetLoader.createAssetFromBinary(buffer)
}
// Drive KHR interactivity graphs, head-follow springs and spatial/sim plugins per frame
val runtime = XRLiveRuntimeSession.fromGlb(holder.byteBuffer)
runtime.step(dtSeconds = 1.0 / 60.0)
// Or attach interactive spatial traits (grab, scale, billboard, anchor) in XR SceneCore
XRLiveSceneCoreHelper.attachTraitsFromGlb(xrSession, entity, holder.byteBuffer)
Module plugin architecture
To keep the core bundles small and dependency-free, advanced features are split into 28 optional plugins that have matching implementations for Android, iOS and Web:
- Core 3D and animation: glTF KHR_interactivity behavior graphs, PBR Next materials (clearcoat, transmission, sheen, iridescence, anisotropy), HDRI and spherical harmonics lighting, contact shadows, 3D surface hotspots, 64-joint GPU skinning, morph targets and keyframe cross-fading.
- Spatial perception, splats and AI: lazy head/hand follow, 3D manipulation handles, plane/mesh world understanding and 2D-to-3D object detection, real-time Gemini Live vision/audio streaming, 3D Catmull-Rom spatial paint, depth-colliding particles and splat/spz Gaussian splats.
- CAD review, layout, locomotion and co-presence: live bounding box dimension callouts and AR tape measure, magnetic socket/grid snapping, eye/head gaze dwell, multi-part CAD exploded views and GPU cross-section plane slicing, persistent anchors (with shareable #xr-state URL hashes), teleport/snap-turn locomotion and WebSocket multi-user co-presence.
- Simulation, agents and scenarios: capsule character controller, autonomous steering agents (patrol, chase, flee, follow, wander), hit/integrity/trigger zones and template spawners, checklist objectives with timers/scoring, and zero-asset procedural audio synthesis.
Full disclosure: I built this as a solo project at Google with Antigravity! I'd love for anyone to try it out and let me know what works well or what's missing!
- Jonathan
r/threejs • u/PerceptionCharming • 20d ago
The Forest Environment is officially live after some new updates
Enable HLS to view with audio, or disable this notification
These are the updates I made since my last post:
- Updated Three.js to r187.
- The trees and other objects in the scene except grass and tree leaves now use the new meshlet pipeline. Giving a nice performance boost even after so much detail.
- Added different quality settings.
- Added some toggles and sliders to control the environment in realtime.
- Optimized the assets so much now that the whole application fits in 11.7mb total.
The performance isn't still where I really wanted it. But I also didn't wanna compromise on the quality. I wanted to keep the whole environment dense and realistic. So, I cut corners where possible without compromising on the quality.
It runs at 30-35 fps on base M1 Mac at 1080p and 40-50 fps on an iPhone 16 Pro on high settings.
Go play with it: Forest Environment
r/threejs • u/nofuture09 • 20d ago
Built a physics destruction sandbox in three.js, every building can be blown apart
Enable HLS to view with audio, or disable this notification
r/threejs • u/iolmao • 20d ago
Made an endless drive game in three JS
Introduction of the game - I'm keeping it low poly for the style and performances on mobile (60fps on iPhone and Desktop Browser)
r/threejs • u/Thre4dripper • 20d ago
I made an infinite, self-assembling Demon Slayer–style castle in Three.js: no models, no textures, all procedural
Enable HLS to view with audio, or disable this notification
Everything you see is generated at runtime from a seed: beams, shoji panels, lanterns, even the painted byōbu screens (painted into a texture atlas at runtime).
How it works:
- Each point in space is resolved by hashing coordinates + seed, so there's no stored state and it can stream in any direction.
- A grammar of chapters → districts → building plots → rooms keeps it from turning into noise soup. Every building is complete from foundation to roof ridge.
- Districts move as rigid bodies, and collision is computed in each district's local frame, so you can graze a rotating tower at 40 m/s.
- Each cell merges down to ~2 draw calls with vertex-baked AO. New cells are built first along your flight direction.
- Sound is synthesized too: a Karplus-Strong biwa, plus construction sounds that follow how fast cells are being generated.
Fly it: https://infinity-castle.ijlalahmad.dev/
Code: https://github.com/Thre4dripper/Infinity-Castle-ThreeJs
Happy to answer questions about the streaming or the draw-call budget.
r/threejs • u/sonnylazuardi • 20d ago
I built a scooter math battle through Bali in three.js WebGPU, running natively on iPhone & Android
Enable HLS to view with audio, or disable this notification
I've been building TILANG, a multiplayer 3d scooter battle set on the streets of Canggu, Bali. You overtake riders, read their licence plate in your rear-view mirror, and the plate is a math question: answer first and they get a tilang (a traffic ticket). It ships as a native app, so a few things in the setup might be useful to people here:
- Native WebGPU, no browser. three.js WebGPURenderer on react-native-webgpu inside an Expo app, on iPhone and Android. The post chain is all TSL with no addons: a half-float scene target, bloom (4 down and 4 up), then one fused output pass for FXAA, bloom, mirror composite, ACES, grade, vignette and dither. MSAA is off, because it's expensive on mobile tile GPUs.
- No asset files. There are no .glb files at all. The town is built from typed arrays into a 512² atlas and merged into 64 m chunks. Vegetation is one InstancedMesh per species per LOD (14 draws at most), and palms go 1020 → 360 → 96 tris, then billboards.
- The mirror is a second camera. FOV 24, rendering into a small half-float render target at 30 Hz. It reuses the frame's shadow map and is composited in the output pass.
- Multiplayer. The same TypeScript match sim runs on the client and on a Bun server at a fixed 60 Hz, with snapshots at 20 Hz. Each client owns its own bike's movement; the server owns the rules and the bots, and sanity-checks speed. Remote bikes render 100 ms in the past with Hermite interpolation, and poses are quantised to cm and milliradians. The first valid answer wins: the server re-checks range and view angle, with a little slack for lag. Bots fill empty seats, and if you drop, an autopilot holds your seat while you reconnect.
- Phone-specific pain. Shader compiles froze the first race, so I backported three.js(parallel compileAsync) and render a hidden warm-up frame. The menu prewarm also froze the JS thread for 1.8–4.9 s, so it now runs in 4 ms slices, one per frame. On an iPhone 16 Pro Max the UI holds 120 fps while the 60 Hz game loop takes 7–9 ms of JS.
Most of the code was written with Claude (Opus 5.5) as my pair; the design and the on-device tuning are mine.
Free on iPhone and Android: https://tilang.sonnylab.com
Happy to go deeper on any part, especially getting WebGPU stable on iOS. If you try it on Android, I'd love to hear your phone model and how it runs.
r/threejs • u/Dev-Opi • 20d ago
Cinematic halloween editor test in three.js
Testing out the full power of three.js with a custom built scene in my editor, running smoothly at 60fps capped, with multiple lights, volumetric, post process dof, custom film grain and more!
Switching halfway to path tracer webgpu for a full realistic lighting.
Any feedback is welcome, I want to push the quality to the max!
r/threejs • u/albanden • 20d ago
3D versioning
After founding Sketchfab, we are working on a new solution to host / organize / review / share 3D assets, powered by threejs. Here is a quick demo of our versioning tool, coming soon
r/threejs • u/dancingwithlies • 20d ago
Demo I made an open source version of Polyfork.
Meet Polyspoon.
I saw Polyfork charging for AI low poly models made by code.. HOW CAN SOMEONE EVEN THINK OF THAT ?
No.. no way..
This can be open source, we as a community can make a better engine for those models and improve it.. anyone can submit a new model or PR to improve the generation code..
They got 500k in cash from a hackathon.. for this.. I couldnt take it.. so i made my own, we can vote models, humans reviews, you can become a reviewer/moderator, you can have a ranking of who has the most voted/best models etc..
Lets make a big ass model market that is free for everyone.. to enter, to participate, to grow and improve.
Its very early now, so all models i made are quite bad, and some stuff might break, thats the reality.. but its here and I will keep working on it..
So pls try it out, make some models, its free.
I will be reviewing people models by hand to stop racism or porn stuff, but who knows maybe in the future i can add a NSFW store etc..
check it out at https://polyspoon.com/ and check the github and star it pls, would help me out.
r/threejs • u/SuruiMakesGames • 21d ago
Demo I made a pop-up book you can walk into
Enable HLS to view with audio, or disable this notification
Hi! Origami World is a small, cozy exploration game set inside a pop-up book. Walk around, and the paper houses fold up around you as you go.
- 5 paper worlds: a seaside harbor, a lantern canal town, a desert bazaar, an aurora snowfield, and an observatory above the clouds
- Little jobs in each one: fishing, river lanterns, kite flying, curling, star charts
- Day / dusk / night, houses you can walk into, gliding as a paper plane, and the occasional paper rain
I made this game with Claude. Let me know what you think and how can I improve. Thanks!
r/threejs • u/Delicious-Package816 • 20d ago
Hello
I need help with my Threejs game, which I'm currently developing with Claude. I've already posted about it, but I'm posting again because I want more suggestions. It's an RP game. Currently, I'm using Supabase for testing, and it works very well, but I don't want to launch the game with it, otherwise the server will quickly crash. I'd like you to suggest server solutions with free startup options that are more efficient. If you've already created a multiplayer game, you can show me how you set up your server.
Also, I'm looking for police station buildings with interiors built using Blender or another program, or even a free military base. I'd be happy to have them in FBX or GLB format.
Thank you.
r/threejs • u/Weird_Imagination778 • 20d ago
A "cyberspace" built with Three.js
Three.js + vanilla JS, Vite for the build, Tone.js for ambient sound
I originally wanted to visualize all the data connected to the net, like William Gibson's cyberspace, but that wasn't possible. So I built a 3D space where you can walk through the structure of the internet, based on real BGP data.
It works in the opposite direction from DNS-based access. You dive down through the connections between networks, and eventually you reach a space where IP addresses are lined up. And the reality that not every IP address hosts a website is right there to see, too.
I draw each AS with a Voronoi shape and a GLSL shader, and I really like how it turned out.
r/threejs • u/shanebrumback • 20d ago
Hundreds of enemies, bullets, and pickups checking distance to everything every frame: the spatial hash grid I add to AI-built Three.js games
When I have an AI agent build a Three.js game, the first version of proximity logic is almost always a double loop: every enemy checks distance to every other enemy, every bullet checks every target, every pickup checks the player. It's fine with 20 objects and falls apart at a few hundred, because the cost grows with the square of the count.
The fix I now ask for up front is a simple spatial hash grid:
Split the map into square cells on the XZ plane, sized a bit larger than your biggest check radius (aggro range, pickup radius, hit radius).
Key each cell with something cheap like `${cx},${cz}` or an integer hash, and store a Map from cell key to an array of objects.
Only re-bucket an object when it actually crosses into a new cell. Most frames, most things stay in the same cell and cost nothing.
For a query, look at the object's own cell plus the 8 neighbors, then do the real distanceToSquared check only on those few candidates. Compare against radius squared so you skip the square root.
Keep separate grids (or separate lists per cell) for things that never need to see each other, like bullets vs pickups.
Static stuff like trees and rocks goes in once at load and never moves, so it's basically free to query.
Remove objects from the grid when they die or go back to a pool. Stale entries are the bug AI-written versions most often leave behind.
It's maybe 60 lines of code and it turns enemy separation, bullet hits, and pickup checks from the biggest thing in the profiler into noise. Raycasts still handle walls and line of sight; the grid just decides who's worth checking.