Search Unity

Will forcing the LOD level stop an LOD Group from doing screen calculations?

Discussion in 'General Graphics' started by SomeGuy22, Jun 12, 2020.

  1. SomeGuy22

    SomeGuy22

    Joined:
    Jun 3, 2011
    Posts:
    722
    The LOD Group component has a public void for ForceLOD(), which lets you override the default behavior and just set what level the group should use. It works as expected, but it got me thinking about some of the inner workings here.

    Question

    According to the docs, "Passing index < 0 will return to standard LOD processing." So does that mean when the LOD forced index is >= 0, it will stop doing distance/screen size calculations to determine which LOD to use? Or will they still occur and just get overridden at the end?

    Why this matters

    A common technique I've seen in my studies of AAA games is to use nested chunks of environment art for loading/unloading parts of big levels. Typically this is used nowadays for streaming purposes, but could also be utilized for LOD in both rendered meshes and even the frequency of threaded code.

    So my idea is that if you have hundreds/thousands of objects that are far away but still visible, traditionally they will each calculate their own LOD screen size checks and pick the correct level. I know that LOD checks are very optimized and typically are outweighed by the benefits, but it's easy to imagine in some cases on tightly managed console games or huge worlds where this LOD checking could be improved and net some big gains in terms of performance if your game is bound by the CPU (which does the screen size checks, right?). If Forcing an LOD level disables these checks, then you could theoretically make an "LOD Group Group" which does a single check, and sets the LOD level of all children if they are distant, saving you potentially hundreds of these checking calls if your groups are far away.

    I'm aware that Unity has done some research into HLOD here, which is sort of similar to this. So, is my reasoning correct? And will this optimization be viable for these sorts of situations? Mostly this is out of curiosity to understand a bit more of how the LOD Group works internally. Thank you!