Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

LODGroup.ForceLOD() with crossfade

Discussion in 'Scripting' started by sewy, Jun 17, 2019.

  1. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    46
    Hi,

    Is it possible to use LODGroup.ForceLOD(), and somehow keep the CrossFade functionality?

    Due to the fact, we need to switch LODs at exact distance (rather then percents in pixels), I came up with own LOD Distance Switcher, but would like to use the CrossFade as well.
     
  2. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    46
    I have actualy found solution, that suits my purpose, which actualy does not answers the Q, but in this case can be used.

    I want to switch LODs at exact distance with CrossFade so I am using normal LODGroup functionality with custom calculation of screenRelativeTransitionHeight for given distance.
    For calculating that, I have found code for function GetRelativeHeight() at unity git, where I present my exact distance instead of calculating it from camera position, doing so for every LOD in the group.
    LOD bias has to be set to 1.