Just finished this 3D dual grid texturing system. It kicked my ass, but I'm so glad it's working!
I'd like to do a bigger writeup on my Patreon soon, but If you're curious about how it works:
The terrain is generated with tiles that are a dual-grid. That is, each Graphical Tile defines the corners of 8 adjacent Logic/Terrain Tiles.
This drastically reduces the number of tile shapes I need; terrain just uses 14 shapes, instead of hundreds!
But it also means each tile can have up to 8 different textures matching each of its neighbors. Which is tricky to do on the GPU instead of the CPU!
Rather than redoing the tiles, I created a system that paints tiles with Vertex Colors, which show what areas are part of what corners. I also pass each tile mesh a set of 8 texture IDs for which texture each corner will need.
This means all terrain in the world uses a single material and texture atlas, which can look up the right textures on the GPU, draw borders with its neighbors, etc. I'm very happy!
#Godot #GameDev