Search Unity

Feature Request Possible to blend 2 different textures based on camera distance falloff?

Discussion in 'Shader Graph' started by newguy123, Dec 11, 2020.

  1. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Hi Guys

    Is it possible to blend or swop between 2 textures based on camera distance? As in directly in Shader Graph in the editor, not using any runtime code?

    I have a lowres texture I want to use at far distances and when coming closer, I want to blend to the more detailed highres texture.

    The 2 textures are not different resolutio versions of each other, but more 2 different textures entirely
     
  2. o-san

    o-san

    Joined:
    Jun 23, 2018
    Posts:
    32
    You should be able to do this with the position field in the camera node. In broad strokes... Do a distance check between the camera position and your fragment position, inverselerp the result with your desired effect distance and multiply it with your texture. Then add the two textures together. I’ve done a similar effect but combined the base texture with a detail map.
     
    MichaelEGA likes this.