Inspirateur / riverbed

A Minecraft-inspired Bevy game
MIT License
35 stars 2 forks source link

Implement more rendering optimisations #5

Open Inspirateur opened 8 months ago

Inspirateur commented 8 months ago

These optimisations should provide another big performance boost to the rendering (cf: this excellent video on the topic)

When it's done we should be able to crank the render distance all the way to 4km or so (eq to 256 in Minecraft)

Inspirateur commented 7 months ago

So I just tried implementing the first optimization in the list (with the help of @kokounet !) BUT frame rate took a big hit (approx x3 times worse).

After checking with RenderDoc, the performance issue seems to be caused by draw calls (~100k per frame, way too much!) This is because we're doing 1 draw call per mesh so multiplying the meshes by 6 (1 per face type) and culling half of them ~multiplies draw calls by 3.

In conclusion the first optimization will only pay out when we manage to batch draw calls, which is next on the list.

Inspirateur commented 3 months ago

A side effect of upping the chunk size from 32 to 62 (64 when padded, for optimal meshing performance) is that the draw calls have been reduced by a factor of ~8 !

So even without instancing we get good performance at a render distance equivalent to 120 in Minecraft :)

That said instancing is still necessary for an optimal experience.