This post is less about some specific information and more about something I've been cooking up over at winter.dev/prims.
When working in 3D everything is made out of meshes. In their simplest form these are big lists of positions that get fed into the GPU for rendering. These lists can be generated or loaded from disk. Most games save a large amount of data in models that make up generic objects like rocks and trees. These typically are generated but then get baked into a game's download and can never change.
Instead, imagine if in an engine you only had to define the bounds of objects and their types, then the engine generated them when needed. I think this would make rouge likes and single player games look more interesting many playthroughs in because the repeating rooms could use differently generated base assets.
That is an end goal for what it's worth...
Right now, to start with something I've compiled an incomplete list of the generation algorithms that I've needed. This only consists of primitive shapes for now, but I think it will still prove useful because every time I need another shape I spend a long time searching on forms but only end up with bits and pieces. To try and help alleviate the pain of making these in the future, I've cleaned up some popular algorithms and added comments that clear up the oddities within them.
Let me know if you have any suggestions, there are more shapes that I want to add but I also want to open it up for people to add their own algorithms. Then expand into more complex meshes, like a rock generator or foliage generation.
There is a small inconsistency in the quantity of vertices of the icosphere. If I’m not mistaken, the resolution 2 icosphere should have 322 vertices, not 332.
Oh thanks for catching that! I must have mistyped 🙂 It seems like there are a few mistakes, in a few weeks/months I am going to come back to this to fix it up / expand it.
Thank you so much!! it’s a bless that you are here, I was really struggling with procedural mesh generation especially rounded one’s like capsule’s, I was wondering if you’ll do things like rounded boxes or rounded polygons?
Thanks! Sorry to take so long to reply, I’ve been bogged with the beginning of the semester. I’ve been meaning to loop back to this, but I’ve been sidetracked by this sand engine stuff and it doesn’t require any mesh work. When I get back to the next 3D project, I am going to use this to hopefully generate more complex procedural assets like foliage. I do want to expand the website!