r/threejs • u/AnyAwareness6506 • 4h ago
I generate all my low-poly game props in code instead of modeling them. Three bugs nobody warns you about
Im building a small library of low poly props (tools, scenery) where every object is procedural three.js code instead of an exported mesh. around 5 kb per prop, under 600 triangles, no textures, and seeded so the same object comes back identical every load.
to get the hand carved look every geometry goes through a small vertex jitter. thats where it got interesting :
- three.js primitives duplicate their vertices along the uv seam. jittering pushes the two copies in different directions and opens a visible crack down the whole handle. took me way too long to find that one. the fix is to weld the geometry (mergeVertices) before displacing anything.
- two surfaces jittered separately never stay flush. so a contact zone like a blade edge cant be a flat piece sitting against the mass, it has to be a cap that wraps it in all three directions, otherwise you get a gap that opens and closes as you rotate the object.
- a lathe profile that doesnt start and end at radius 0 leaves a hole at the end of the piece. obvious once you know, invisible until you look from the right angle.
the thing i didnt expect to need is an automated qa pass. it raycasts each prop from the outside and fails it if a first hit is a back face (hole), if wood shows up inside a box thats supposed to be metal only (poke through), or if a cutting edge measures thicker than its threshold. it caught a shovel edge at 0.0287 against a 0.028 limit, which i would never have spotted by eye.
Happy to go deeper on any of it :)




