We are Open 
EcoPico HexSphere 163k Tiles
Unity DOTS procedurally generate hex planet, for my EcoPico project, using ECS, burst, jobs and URP, with Graphics.DrawMeshInstanced

In my previous stress test 161 batches of 1024 tiles each, is used for filtering and culling of planet sections. That brought roughly 2x improvement, from first test. But still gave 15-20ms CPU cost and rather large GPU strain, due to heavy use of URP shaders. Shaders were responsible, for vertices alignment, of each tile. When planet were edited, FPS were dropping nearly to 10 fps.

Mind this I run this on 5-6 years old mid range PC, with i7, 8 cores CPU.


It this stress test, I reduce runtime CPU cost to nearly 2-3ms (400 fps).

I rewrote algorithm and changed approach what and how is rendered.

So instead of having every single tile rendered, I combined them into large meshes. Now, thing is I haven't changed default setting for meshes, that mean, only 65k vertices per mesh are allowed. As the result, I generate multiple meshes for large tiles count.

Later in vid, I show smaller planet, with meshes on Game Objects.

In case of 163k tiles planet, that is 77 combined meshes. As in other tests, I use Graphics.DrawMeshInstanced. And indeed having 77 unique batches. But this time, each batch has only 1 mesh, of combined tiles.

However, with such changes, there is massive cost.

That is generation time. In previous test, generating such large planet took only 4 sec. While now is 10 more, 40-50s. 

Editing planet cost now around 200ms vs 50ms.

I know I got some area to improve, but haven't investigated details much.

Now few things are different as well.

Changing sunlight angle, is much friendly for GPU and cheap now.

Each tile color, is controlled by vertex color. 

I use also vertex color alpha, to control each of faction colors, based on color gradient. But I loos ability, to control individual faction intensity with this approach. I may change it at some point, how it works. Briefly discussed in comments of older video.

Using Unity 2020, for my EcoPico project.

Using DOTS Jobs, to generate tiles and process all calculations.

Each tile is represented by DOTS entity. Feature not fully complete yet.

Rendering is accomplished with Graphics.DrawMeshInstanced.

At initialization are generated 2 meshes, 3D pentagon and hexagon, with extruded top faces.

Duplicating meshes data (verts, vertex colors, normals) to construct planet, and combined meshes as required.

Using Perlin noise, to generate terrain variation.

Able to dynamically change height and colors of tiles, as per video.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top