Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

unity_LODFade behaviour

Discussion in 'Shaders' started by Atair, Feb 16, 2018.

  1. Atair

    Atair

    Joined:
    Oct 16, 2015
    Posts:
    42
    I want to use the unity_LODFade to drive different values in my shader.
    e.g. size multiplier in a geometry shader that renders point clouds - so that the points fade in/out - scale from / to zero

    attached is the graph i figured out that unity_LODFade follows:
    fade.jpg

    either i don't get it, or it is not possible to get a simple fade in / out value that i can use to drive my values.
    as it starts with 0, goes to 1.0, but as soon as the fade is complete, it jumps back to zero, effectively fading out until the next transition starts..

    i hope this makes sense - maybe i am looking to long at the problem.

    is there any function wizardry to make that graph stay at 1.0 in the middle part?
     
  2. Atair

    Atair

    Joined:
    Oct 16, 2015
    Posts:
    42
    ok solved it:
    the #ifdef needs an #else set to 1.

    #ifdef LOD_FADE_CROSSFADE
    something = unity_LODFade.x;
    #else
    something = 1
    #endif