>>2228 Episode 2
I just don't get it. My next experiment is to make world chunks with cached tile sprites, and I can't do it. Why have I never heard of anyone struggling so much even though this seems like an impenetrable wall to me? The problem is once again sorting the sprites.
Take for instance Starbound: metal is always on top of leaves, which are always on top of crystals, which are always on top of dirt. Each of these overflows their own tile boundary and go on top of the adjacent tiles, from all sides. This means that they NEED some kind of layering mechanism, and you can't localize it per-chunk, it has to work across all tiles on all visible chunks which also means it has to be re-done when new chunks load and old ones unload.
How do you build the buffers to draw this? There can be something like 20k tiles on the visible chunks, not counting the background layer. You can't sort and re-build that kind of sprite instance buffer in real-time, which means you also can't walk around the world without frame drops, nor modify a lot of blocks rapidly, nor move the camera between 2 locations instantly.
In this case you could just abuse the depth buffer, but Starbound has entire biomes filled with semi-transparent tiles, you can't layer those through the depth buffer. I also want the ability to use different shaders for tiles, similar to how you can use "negative paint" in Terraria.
Maybe you can pre-gro