I am currently working on a HexGrid based Terrain system, for a civlization type game. Instead of using a separate mesh for each hex, I tried to precdurally generate each hex separatly and combine it into one single mesh, using my own Component in C++. For starters, I have generated a simple square grid, where each square is extruded separatly, to sort of simulate what happens when I generate the terrain for my game. I am currently testing stuff with a 512x512 grid, and even though it takes a few seconds to intially build the mesh, it runs sort of smooth. However, I allready am getting some performance concerns and wonder what I could do to improve performance.
I thought about splitting the mesh up into separate smaller meshes, which each reside in their own component. I wonder if this will improve performance, when only a small porting of the overall grid is displayed. I am very new to this topic, so any tip regarding perfomance optimization of any sort would be highly appreciated.
Also I wonder how I would approach texturing the grid. Currently I am using a plain white Material, however, for my game I need to texture each hex individually. I thought that layered materials might be the way to go, but for this i sort of need to generate a map, that tells my material which texture to put where on the mesh. How can I generate such a texture map out of my existing grid data, so I can use it to feed a texture parameter on a metrial instance to texture my mesh?
Any hints would be highly appreciated.
Thank you very much