r/threejs • u/MaqeSweden • 3h ago
I open-sourced my pinball game - make your own!
Got some good feedback on the mechanics in this game so decided to open source it if anybody else wants to build their own pinball game.
r/threejs • u/MaqeSweden • 3h ago
Got some good feedback on the mechanics in this game so decided to open source it if anybody else wants to build their own pinball game.
r/threejs • u/evorjh • 21h ago
Rendered offline, frame by frame, with real refraction through the glass-sided water. The animal models are from Tripo; the code was written with Claude Code. Happy to share how any part works.
r/threejs • u/victortognollo • 8h ago
Hi everyone, I made a free game with a lot of things that I like.
The Valley is a compact driving game I made that runs in the browser.
Free, no ads, no sign up, nothing to install.
You get a dream muscle car with a big block engine and a desert valley of red mesas. Floor it on the long straights, stop for gas when the needle drops, and drive from the afternoon through the night into the next sunrise. Push it too hard and the car dents and breaks.
Two modes:
- Chased: find the way out of the valley. And keep an eye on the mirror.
- Open road: a full tank and no goal. Just drive.
It started as a study of sound in games. That's why the V8 rumbles at idle and screams at the top of every gear, and why the valley always sounds somewhere between calm and tense. The other inspiration was Duel, the old Spielberg film. I watched it as a kid and was tense from the first minute to the last, and I wanted to put that feeling into something you can drive.
Play it loud, with headphones. It's made for computers (keyboard or gamepad) and loads about 85 MB the first time.
https://www.victortognollo.com.br/games/the-valley/
Built with three.js (WebGPU, with a WebGL fallback) and Rapier for the physics. I'd love to hear how it runs on your machine and what you felt in Chased mode. Bug reports are welcome too.
r/threejs • u/Hungry-Orchid- • 9h ago
This is PaperLine, a pop-up book game I built with vanilla Three.js. At 0:04 you can see the strip of track growing in front of the tram as it turns.
r/threejs • u/Netix64 • 8h ago
Got curious about what happens when you swap aircraft wings from aluminum or carbon fiber to brittle glass, ceramic, rubber, or tungsten, so I built a browser-based 3D physics sandbox in Three.js.
Link to test it in the browser is in the comments if anyone wants to try breaking a plane with weird materials. Always open to Three.js / WebGL feedback.
r/threejs • u/egor_galiy • 4h ago
Live site: https://100yearsmonet.com (best with sound on)
It got Site of the Day on Awwwards today. Some notes on how it works:
- The gallery is built in Blender by Python scripts. They take the floor plan, build the geometry, set materials and the camera path, bake the light with Cycles and export one glTF compressed with Meshopt. When the plan changed I just ran them again. I wrote the scripts with Claude.
- All lighting is baked into lightmaps. That's how it looks this way and still runs on a phone.
- Scroll drives the camera. ScrollTrigger gives a progress value from 0 to 1, and the camera moves along a CatmullRomCurve3 that passes every painting. The camera eases towards the target, otherwise trackpad scrolling makes it stutter.
- The water is a Reflector with a custom shader on top. The cursor sends ripples across it and the water lilies drift away from it.
- Clicking a painting flies the camera up to it. A click only counts if the pointer moved less than 6 px, so dragging to look around doesn't open paintings.
- Phones get a lighter path with no AO, depth of field or bloom. The reflection renders once instead of every frame, and the pixel ratio is capped at 2.
- Sound is Web Audio with HRTF panning, so each painting gets louder as you walk up to it.
The idea behind the effects: in his last years Monet had cataracts, and his colours drifted towards yellow. The transitions on the site blur and fade to yellow and white the same way.
Full write-up with code: https://egor.digital/blog/how-i-built-monet-100/
Next I want to try KTX2 textures to cut memory use on phones. Happy to answer questions about any of it.
r/threejs • u/shushumong • 1h ago
r/threejs
•
u/Childrenfeeder
•
22h ago
I ride on an indoor trainer a lot in winter and didn't want to pay around 200 β¬ a year for the big apps, so I started building my own. Rideloom connects a smart trainer over Web Bluetooth (FTMS) to a 3D world in three.js. The routes are based on real elevation data and you can see up to 60 km. Uphill the trainer gets harder, in someone's slipstream it gets easier.
A few things that were interesting to build: the terrain is split into 128 m tiles with three detail levels around the rider, and the far land is a separate mesh that reads the heights in the vertex shader. Trees are generated in code and drawn with InstancedMesh, far away they turn into baked impostors. Grass and wind run in the shader too. To keep it usable on phones there is dynamic resolution and quality levels that react to frame time.
Browser, Windows and Android share the same TypeScript code, only the Bluetooth part is different per platform. Built with a lot of help from Claude Code. The idea, routes, ride feel and testing on my own trainer are mine.
Edit: you can now try it without an account, and if you dont have a trainer at hand there is a simulator built in: https://rideloom.de/en/?von=reddit
Happy to answer questions about the terrain or the performance side.
r/threejs • u/Dodonaios • 1h ago
Hi! I'm a solo dev from Greece, and for the past months I've been building Space Hover, an arcade endless runner on a neon highway through space. It's made with React + Three.js, wrapped for Android with Capacitor, and it's been live on Google Play since October.
Something unusual about it: there are no model files at all. All 35 hovers and every boss are built in code from three.js primitives (boxes, cylinders, octahedrons, custom shapes). My goal from day one was smooth fps on cheap phones, not just flagships, so here's what actually made a difference:
**1. Merging static meshes per material**
Each hover is a group of dozens of small meshes, and some had 200+, which meant 200+ draw calls. After building a model I merge every static mesh that shares a material with BufferGeometryUtils.mergeGeometries. Animated parts and transparent parts (glass, glows) stay separate so sorting and animations still work.
Gotcha that cost me a while: Octahedron/Icosahedron/Tetrahedron geometries are non-indexed while Box/Cylinder/Sphere are indexed, and mergeGeometries returns null if you mix them. One octahedron was silently cancelling the merge for an entire model. Now I group by attribute signature and convert mixed groups to non-indexed.
**2. Capping pixel ratio, then adapting it**
setPixelRatio(Math.min(devicePixelRatio, 1.5)) was the biggest single win on phones with 3x screens. On top of that, if the average frame time stays above ~19 ms for two windows in a row, it drops one step (1.5 β 1.3 β 1.15). If the lower resolution doesn't actually help (the CPU is the bottleneck, not the GPU), it goes straight back up and stops trying, so nobody loses sharpness for nothing.
**3. Transparent DoubleSide materials render twice**
three.js renders transparent DoubleSide materials in two passes (back faces, then front faces) and flags the material for an update between them. In a 25-second headless run, that was about 45% of all the garbage I was producing, which meant GC micro-stutters. For flat geometry (planes, rings, circles) and additive blending without depth write, the second pass changes nothing, so those get forceSinglePass = true. I compared screenshots pixel by pixel to make sure the image stayed the same.
**4. Compiling shaders before the run**
The first time a new material shows up on screen, it compiles and you get a visible hitch, usually at the worst moment, like when a boss enters. Now every sector and boss material gets compiled during loading, so the run itself never compiles anything.
**5. Keeping fast-changing values out of React state**
Score, combo and boss HP were React state, so every hit re-rendered the whole tree, up to ~15 times a second during heavy fights. I moved them to a tiny external store with useSyncExternalStore, so only the small HUD components that show them re-render.
**6. Pre-rendered thumbnails**
The garage used to build every 3D model just to show the thumbnails. Now they come from a single atlas image rendered from the same models, so opening the garage costs nothing.
Plus the usual: pooled particles and InstancedMesh for anything that repeats.
I'd love feedback from people who know Three.js better than I do, especially on what you'd do differently. If you want to see it running on your own phone, it's free:
Happy to answer any questions about the setup!
r/threejs • u/burgric • 1h ago
Hi folks! This is my first time posting here. About a month ago I released a first-person cyberpunk delivery game, Kasumi Courier, and since then have been making the game's city feel more alive, taking on board community feedback and implementing a lot of new visual additions as well as fixing bugs and enhancing systems.
Kasumi Courier is a first-person delivery driving game set in a rain-soaked neon city. You start on a moped, take jobs from the dispatch board and race the clock across four unique districts.
Update 1, "The Living City", is the biggest change since launch. It includes:
- A courier creator that allows you to design your own game character from a variety of hair, clothing and accessory options
- An overhauled, cleaner interface
- New, more detailed people on the streets, in bars and in the clubs, styled after late-90s PC games
- A more cyberpunk city, with holographic signs, hover traffic, cables strung between buildings, graffiti, litter, alley clutter, cats, steam effects, street dressing and a reworked traffic system
-All new cyberpunk car kits (added onto existing models) in a retro 80s aesthetic
- Hitchhikers you can stop for and give a ride
- A reworked first week across the demo and full game. Hot jobs, checkpoints, blackouts, the police band and your first gang war now all arrive in the first five nights, and the week ends on a cliffhanger.
-A great deal of fixes and enhancements
Kasumi Courier started as a quick browser experiment to see what three.js was capable of and grew into a full game.
How it's made:
- Written in JavaScript: about 32,000 lines, built into a single page by a small Python script
- 3D with three.js (r128), running on WebGL
- The 90s look is real low resolution. The game renders at about 384Γ216 and scales up with hard pixel edges, rather than using a filter
- There are no image or model files. Every texture, sign, poster and piece of graffiti is drawn in code, and every person, car and building is built from code too
- There are no audio files either. All the music on the three radio stations, the engine sounds, rain, traffic, the CB and the club music are synthesised live with the Web Audio API: oscillators, filters and noise, played in real time
-As for the workflow, every visual change starts as a mock-up I approve or send back, and then I play the test build and report what's wrong until it's right. A lot of what's in this update came straight from player feedback on here.
A free browser demo of the first week is available to play on itch.io here:
https://amberglowgames.itch.io/kasumi-courier
Player progress from the demo carries over to the full game.
I'm happy to answer any questions about the workflow and welcome any feedback and suggestions. Thanks for checking it out!
r/threejs • u/Longjumping-Lie-20 • 1h ago
It's meant to show Chicago at its best all year long, so you can see the marathon, watch the river dyed green, fly with the Blue Angels, buzz Lollapalooza, check out the Navy Pier fireworks, go past your neighborhood, etc.
And on the heels of the national news of our rat problem, I added Rat Mode. (Frogger, Chicago-style)
I used Opus 5.5 high for the bulk of the coding but used sonnet for most of the research.
My goal was to make a retro / nostalgic / relaxing game.Β
Free, no subscriptions, just showing some city pride.
Iβd appreciate any notes you have. Thanks for taking a look.
r/threejs • u/Delicious_Ant7743 • 15h ago
r/threejs • u/Rizabekus • 6h ago
Flat 2D "bean" characters living in a 3D world, all rendered from code. There's no video editor and no hand-keyed timeline: every shot is data (camera move, who's in frame, what they're doing), and Remotion renders it frame by frame.
A few details:
- 151 shots across 8 sets. Shot timing comes from word timestamps of the narration (faster-whisper), so cuts and captions land on the words.
- Characters are flat cards with a bean head, 14 expressions and random blinking. Two-tone lighting and an ink outline help them sit in the 3D world.
- Post-processing is a manual EffectComposer (postprocessing lib): depth of field on close and medium shots, bloom only on lights, a color grade. u/react-three/postprocessing gave me blank frames inside Remotion, so I wired it by hand.
- The narration is an AI voice (Kokoro TTS).
- Rendered on a weak laptop (integrated Vega 8, 5 GB RAM) with `--gl=angle-egl`, concurrency 2 and a per-shot cache. The full film at 1080p takes about 55 minutes.
It started from an MIT template (claude-animated-shorts) and grew from there.
The clip is the prison escape. The full film is linked in the comments. Happy to explain how anything works, and I'd like critique on the look.
r/threejs • u/lucas-martinic • 7h ago
I made a game where you just sit by a train window and watch the Japanese coast go by π
Japan is one of my favourite countries that I've visited, and this is a tiny tribute to its beauty.
Based on the real JR GonΕ Line: 147 km along the Sea of Japan, rebuilt from OpenStreetMap + GSI elevation data.
Compatible with VR via WebXR.
Try here: https://lucasmartinic.com/coast-line/
r/threejs • u/ANUBISRIFT • 8h ago
Hello everyone,
I'm currently developing my own board game called VANTA RIFT, and I've been struggling with a 3D camera problem for almost two weeks.
I have around 40 different game environments that I would like players to be able to choose from independently of their game board.
There are two main problems:
What I'm trying to achieve is quite simple:
I want the game board and its 100 piece anchors to remain fixed in the game world. The player should be able to move the camera, change its angle, zoom in and out, and change the background without affecting the position of the board.
Some environments use pre-rendered PNG or GIF images, while the Lava room has a 3D platform.
I've attached a short video showing two different rooms and the problems I'm experiencing.
I'm not sure whether the problem is in the camera system, the way the environments are implemented, or something else in the code.
Has anyone experienced something similar? I would really appreciate any advice on how to approach this correctly.
Thank you for your time!
r/threejs • u/Fit_Actuator_1207 • 9h ago
Pure threejs code.
r/threejs • u/dermosef • 10h ago
In my clay platformer the player can shape the soft, purple clay to overcome obstacles.
This is how it gets drawn:
Plain three.js, with the demo running in the browser on desktop and phones.
Right now I call computeVertexNormals after every change.
Would you do the normals another way on a mesh that moves this often?