I have refactored the question in the second post.
Original discussion:
I am trying to grasp some LOD concepts, to improve performance, using LOD.
For a starter, I will use as reference point
EntityComponentSystemSamples/ECSSamples/Assets/StressTests/LODSubSceneTest/
Ops, I thought it will be bigger sorry.
Switching along LOD tree, between entities, for each LOD group of the root LOD.
In this case scenario, we have LOD cubes rotating.
The structure looks like this
MeshLODGroupComponent (root group), with LOD instances0 ranges ( 24, 146, inf, inf ), parent mask 0
| - MeshLODGroupComponent (group0), with LOD instances0 ranges ( 2, 21, 300, inf ), parent mask 1
… | - MeshLODComponent (s), with LOD mask 1, yellow cubes.
| - MeshLODGroupComponent (group1), with LOD instances0 ranges ( 2, 21, 300, inf ), parent mask 1
… | - MeshLODComponent (s), with LOD mask 2, red cubes ( with 2 LODs)
| - MeshLODGroupComponent (group2), with LOD instances0 ranges ( 2, 21, 300, inf ), parent mask 1
… | - MeshLODComponent (s), with LOD mask 4, blue cubes
My understanding is, that:
- Based on group’s parent mask 1, LOD group0-2 are only active and conduct mesh LOD checks, when root group is in range 24 to 146.
- Then that should trigger yellow cubes in between range 2 to 21.
- Then that should trigger red cubes in between range 21 to 300.
- Then that should trigger blue cubes in between range 300 to inf. But already outside parent mask 1 (24 to 146)! So technically, this mesh LOD should be unable to get activated?
A bit confused here however.
Another thing is, I hoped that MeshLODGroupComponent, helps on gaining some perfomrance.
But zooming close in and out, to the point that blue cubes LOD cause them to disappear, makes no performance difference. I have disabled burst in this case.
Maybe LOD instances0 can be set better? Or is too small sample for testing?
Of course there is gain on rendering part (ignore GC).
2 Questions:
-
So my first question is, can I gain on LOD group (MeshLODGroupComponent) performance, by appropriately nesting them?
-
The second question is related to translation and specifically rotation.
How do I check, which LOD level is currently active on mesh. For example I don’t want to perform rotation on meshes, which are not currently visible. Having for example 100k invisible rotating cubes, makes not viable as an option.
My use case:
Below is my current use case, which I want to further improve.
In this vid, I don’t use LOD. My performance drops significantly at 300k entities, below 30FPS, when looking at whole scene.
In later version (not in this vid), I have applied basics LOD, gaining significant performance improvement and able getting stable 30FPS at 500k entities, while looking at whole scene. However, LodRequirementsUpdateSystem takes a CPU toll, which I want to reduce, hoping by utilizing correctly MeshLODGroupComponent. I think I have gained already something. But I would like to know, how much more I can gain of LOD?
https://www.youtube.com/watch?v=Fk8EPBYnOS8
I also watched that LOD talk from 2018. But I don’t see anything mentioned, about LOD groups gain.
https://www.youtube.com/watch?v=k_ORJXmPu9M