Question regarding performance and texturing of generated hex-field-terrain
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
asked Nov 11 '14 at 01:34 PM in Rendering
Hey Brainshack -
Without knowing the exact look you are going for there are some generic suggestions I can give you. The Engine renders items in batches based on shared shaders (materials). So you would definitely want to make use of a Master Material setup with Instances of the Material used for variation. Also keep in mind you will want to setup a LOD (Level of Detail) system which is probably the one performance boosting mechanism that many people do not do. This will mean looking at reducing vertex counts in the distance but also looking at ways to remove unnecessary detail from materials at a distance. We have many materials in Starter Content with this Camera Distance LOD setup in place.
Ultimately I think it be beneficial to give yourself a series of hex units already completely textures which are also tileable with each other and have your hex grid calculations pull instances of those units and apply them to your world. Assuming that you are using instances and a master material setup you should get reasonable performance.
Hopefully this gives you a start -
answered Nov 26 '14 at 05:13 PM
Lovecraft_K ♦♦ STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here