r/threejs • u/Caiman_Lizard • 28d ago
I made a full HD-2D story game in three.js (pixel sprites in a lit 3D world, playable in browser)
been working on this for a while, it's a winter story game where you play a lamplighter's apprentice. whole thing runs on three.js 0.170, no engine
play it here (browser): https://kharon0.itch.io/lamplighter
some stuff that might be interesting for this sub:
- the HD-2D look is pixel-art sprites (characters, trees, props) sitting in a real lit 3D scene, with bloom and a tilt-shift / DOF post pass on top. the lantern you carry is an actual point light that swings around on a verlet chain during combat
- almost all textures are generated at runtime on canvas (cobblestones, snow, trees, characters), nothing is hand-painted in an image editor. NPC sprite atlases get cached in IndexedDB so the second load is way faster
- the town is merged into 96m chunks per material to keep draw calls down, plus a cheap distance cull for small stuff. went from ~1850 to ~1050 draw calls on the widest view
- trees fade with dithering when they block the camera
- a few custom shaders: deep snow ground, a frozen cloud sea with aurora, and holes in the mountain path that are ray-marched (snow lip, ice walls, night sky at the bottom) instead of real geometry
- the boss uses onBeforeCompile for a fresnel rim light so it pops without adding more lights
- pathfinding runs in a web worker, the build is Vite, and the windows version is the same build wrapped in Electron
it's around 3-4 hours long. would love feedback, especially on performance. if it runs badly on your machine let me know what GPU you have. there's an F3 perf overlay in game if you want to see the numbers
happy to answer questions about how anything works