You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 19, 2021. It is now read-only.
Doing a draw call for every hex-pillar-section is very inefficient. The goal is to manage only one big vertex (+ index) buffer for each chunk. Then we just have to do one draw call per chunk, which results in less then 100 draw calls for the whole world. With that, the draw call amount is not the bottleneck anymore.
Only having one big buffer also allows us to simplify the mesh and remove redundant points and empty faces. Furthermore we can introduces terrain smoothing if we want to.
Some quick calculation for the worst case (no two adjacent hex pillars have the same height) with only one section per pillar:
We have CHUNK_SIZE² pillars per chunk (currently 16² = 256). We have 2 * 6 points for each pillar, but need to triple those in order to have correct normals (see #60) => 36 vertices per pillar = 9216 vertices per chunk. This could be decreased a lot by terrain smoothing.
All top faces are drawn with 4 triangles (with terrain smoothing it would be 6), double that to get the bottom faces, too.
Each pillar has 6 side faces which are drawn with 2 triangles each. But luckily every side face is shared by two pillars, so we can remove roughly half of those faces. This results in 256*6/2 = 768 side faces = 1536 triangles for the sides.
In sum: 1024 + 1536 = 2560 triangles and 9216 vertices per chunk.
These numbers seems OK to me... It's of course also worth considering not generating vertices and faces at height 0, because the player will never see them anyway.
The text was updated successfully, but these errors were encountered:
Doing a draw call for every hex-pillar-section is very inefficient. The goal is to manage only one big vertex (+ index) buffer for each chunk. Then we just have to do one draw call per chunk, which results in less then 100 draw calls for the whole world. With that, the draw call amount is not the bottleneck anymore.
Only having one big buffer also allows us to simplify the mesh and remove redundant points and empty faces. Furthermore we can introduces terrain smoothing if we want to.
Some quick calculation for the worst case (no two adjacent hex pillars have the same height) with only one section per pillar:
These numbers seems OK to me... It's of course also worth considering not generating vertices and faces at height 0, because the player will never see them anyway.
The text was updated successfully, but these errors were encountered: