puchik / godot-extras

LOD and optimization C++ addons and shaders for Godot 4 and Godot 3
137 stars 14 forks source link

[Importance LOD] Unexpected performance test result #10

Open mddm1 opened 3 months ago

mddm1 commented 3 months ago

[LOD ADDON]

plm

I did some tests inside a slightly modified scene from the one provided and the results are as following:

Avg FPS: with 4LODs (lod3=billboard, optimized materials, etc) from far away = 570 Avg FPS with default godot lod, lod0 material mesh from far away = 820

Pros of using this addon are that you have more control over the LODs. Cons for using this addon is 250 frame drop.

I do think my test is flawed. Can someone confirm/infirm this?

puchik commented 3 months ago

That's pretty odd. Do you have a minimal reproduction project you can post?

Also, your pictures don't seem to display the problem (2900 FPS with billboards vs 2200 FPS with mesh LOD).

Right now it's a bit hard to tell what may be happening. Keep in mind that at such high FPS a difference of 250 frames could mean an addition of less than 0.1ms, which could possibly be an increase on the game thread from deferred calls made from the LOD manager thread or some other overhead on the CPU.

On the GPU, it still could be that only a few very distant (i.e., reduced poly count) Suzannes with a basic material cost less than a few billboards which need to access your camera position and do vector math.

Normally something like this would be used for when you have a lot going on and it's helping your project scale, otherwise, in a tiny scene, it's possible you may not experience an improvement (such as the case of insertion sort vs quick sort for small vs large arrays). I would try to integrate this into a more complex scene to get a better idea. (But I also don't know if your game specifically intends to be very simple and run at 800+ FPS 🙂)

The easiest thing to do would be to duplicate your objects many times and experiment with that. That, and disabling code as LOD would be the biggest improvement. Perhaps the example project should come with a larger scene too.

TokisanGames commented 3 months ago

The FPS counter isn't real, it's estimated. You can use an average of GPU time if it stabilizes.

Color your lods.

Use simple materials.

Are your objects increasing in complexity? If all of your objects are the same number of primitives, the test is useless.

Increase your number of objects by 100-1000x.

Document your testing setup and control parameters, and results. This plugin culls objects on the CPU before they get to the GPU. Your test should be designed to test that fact.