Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Question Shader Graph - Distance falloff to blend between 2 textures

Discussion in 'Shader Graph' started by newguy123, Oct 25, 2021.

  1. newguy123

    newguy123

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

    Can I create a distance falloff tyope thing where I show 1 texture when the camera is up close, but the further away the camera gets, it blends to another texture?

    That's pretty simple with 3ds Max, but I have no idea how to do that with Shader Graph.....
     
  2. Aazadan

    Aazadan

    Joined:
    Jun 21, 2014
    Posts:
    14
    You'll need to get distance from the object. To do this use a distance node with your A input being Camera Position, and your B input being Position (probably in absolute world, though this will depend on what you want). Pass this into the T node of a lerp or inverse lerp, with the textures you're wanting being in A and B.

    At least, I think that should work. I do something very similar except lerping a single texture with 0, in order to make detailed textures disappear at a distance.
     
    newguy123 likes this.