Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

LODGroup.ForceLOD() with crossfade

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

  1. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    70
    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:
    70
    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.
     
unityunity