3 ms·
I've dabbled in trying to do procedural generation in the past (in particular to make good looking trees), and I feel like the missing component (to me) was eas
by foota 2y ago
I've dabbled in trying to do procedural generation in the past (in particular to make good looking trees), and I feel like the missing component (to me) was easy ways to connect geometry. It's easy to make two cylinders, but then trying to join them together is very hard.
In theory CSG can fill this niche, but it can be a bit difficult to think about the problem in that way (for me, at least) since you can no longer view it as just for looping to add vertices, but you instead need to model everything as a 3d shape.
I tried building some routines to take two loops of vertices and connect them through heuristics by adding faces, but I had a hard time getting it to work well (choosing which vertices should connect was much harder than I expected, it was easy to get really bad looking connections).
What I really want to do someday is make a game where there is a system for different modular procedural generation systems to work together in a way that allows for spontaneity. So e.g., systems could "claim" slices of the world, delegate parts of it to other systems (e.g., put some plant here) and connect with other adjacent things.
- abetusk 2y agoI would advise to keep at it and not overcomplicate things. There was a recent video on creating generative trees [0] and the hack was to just let the cylinders intersect, so even hacky tricks can work and produce good results. As you say, CSG can work but might be overly complicated. Another trick is to create a tree skeleton and then do lofting, maybe even combined with CSG, to create the trunk and bark. For me, a good library is enabling and finding a good 3d geometry library, maybe to do boolean operations, like joining cylinders or subtracting geometry out, helps enable a lot of new ideas. I've played with a few geometry libraries and the only one I even vaguely like is JSCAD [1]. [0] https://youtu.be/8zMbJmuwEUc?si=KQclrVPeSrIRmsbA https://youtu.be/8zMbJmuwEUc?si=KQclrVPeSrIRmsbA [1] https://github.com/jscad/OpenJSCAD.org https://github.com/jscad/OpenJSCAD.org
- snek_case 2y agoLook up signed distance fields. They are the most elegant CSG solution by far for procedural geometry. It's kind of like a functional way to describe and morph 3D shapes. Highly recommend searching for Mercury Delight on YouTube for an idea of what people have done in the demoscene with it. Also lots of examples on shadertoy. It's amazing stuff.
- maxbond 2y ago> ...you can no longer view it as just for looping to add vertices.... You can if the loop can be unrolled. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Conditional_and_Iterator_Functions#For_loop https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Condition... See below for example. https://github.com/MaxBondABE/batteries/blob/master/src/geometry/solid.scad https://github.com/MaxBondABE/batteries/blob/master/src/geom...
- maxbond 2y agoUpon further reflection, what's really happening in that example is that I'm using non-CSG primitives provided by OpenSCAD, so I retract my comment (at least partially).