I’d like to revive this discussion, since I’ve made some significant progress with 3D membranes. I devised two different algorithms for them and made proof-of-concept realizations of them, to decide what would be better for Thrive.
Without further ado,
Prism-based membranes
This algorithm is best if we want to preserve the current style, while also getting all benefits of 3D. I’ve made a scheme on how it works:
In fact, this algorithm was discussed back in 2015, when the current membranes were made in the first place, but it seemingly never made it into the game.
Anyway, this is how the resulting meshes look:
I want to stress that those meshes are pretty much what we have in the game now, just extended into 3rd dimension. No other changes.
Pros of this algorithm:
- Performance (at least compared to algorithms based on 3D grids, like convolution surfaces or metaballs)
- Very simple UV mapping
- Preservation of the current memrane visuals (though it is subjective whether this is a pro).
Cons:
- Player still has no control over membrane shape.
Meatball-based membranes
This algorithm is based on Dual Contouring mesh-generation, with the defining mathematical function being a modified version of metaballs.
But before I detail this algorithm, I would like to explain the reason for not using Convolution surfaces, which was already proposed in this thread.
That reason is performance. Even if we swap SCALIS for a basic convolution formula (which are way more performant), calculating each bone would still be more resource-intensive than calculating each metaball, just because of how the corresponding formulas work. Moreso, with our hex-based microbes, there would be more bones (aka adjacencies between hexes) than metaballs (aka hexes themselves). Thus, convolution surfaces would be significantly worse for performance.
So, back to meatballs. One important thing to consider is that in our hex-based editor, there is always the exact same distance between adjacent hexes. In other words, the same exact distance between each pair of metaballs that needs to be connected. This gives us the possibility to make some changes to the formula to counteract metaballs’ flaws.
And in our case, their biggest flaw is infinite range at which each metaball can influence mesh shape. Simply put, it makes shapes with a big amount of meatballs fuse into one big blob. I fixed it by adding a distance cap, after which metaball doesn’t have any kind of influence. I also added some other function modifications for shape fine-tuning, but I think that they aren’t as important in our context.
Anyway, here is what I got (after some struggle with UVs):
(Those white dots are metaballs’ centers)
And here are some other meshes that I generated:
Feel free to ask for more mesh pictures.
Pros:
- Player actually has control over membrane shape
- Membranes are just less boring than the convex shapes we have now
Cons:
- Performance. Even though the meshes above took a little under 0.1 s each to generate, I imagine performance will be significantly worse for big microbes. I see some possible optimisations, though.
- Harder UV mapping. If you look closely at the images above, textures on membranes’ tops are weirdly arranged, which is the direct result of that. Maybe it would be possible to solve this by projecting a second texture from the top, however.
- Unrealism? I’m not sure about that, but it seems to me that shapes that are possible to make with meatballs wouldn’t always resemble real microbes. But I’m not a biologist.
Well, that’s about it. I would like to ask what everyone else thinks about this, and which of those algorithms would be better to implement into the game.