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
  4. Dismiss Notice

Question (Shadergraph)[Solved] How to offset UVs in steps using the Tiling and Offset node?

Discussion in 'Shader Graph' started by akshay2001, Jan 1, 2022.

  1. akshay2001

    akshay2001

    Joined:
    Dec 22, 2015
    Posts:
    7
    How should I go on about scrolling the UVs in a direction in steps? For example, offset texture by 0.2 in the Y direction, then wait for a time and then offset again, rather than smoothly scrolling(Multiplying by Time and Direction), any help would be greatly appreciated. Thanks
     
  2. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,108
    Quite simple, you just want to round number to certain threshold.
    The most simple example is literally floor(In), it rounds input down (to integer), so it does not matter if input is 0, 0.3 or 0.9 it still outputs 0. The trick is you can do something with that number before and after, and round it to anything you want.
    Code (CSharp):
    1.  floor(In / threshold) * threshold
     
  3. akshay2001

    akshay2001

    Joined:
    Dec 22, 2015
    Posts:
    7
    Screenshot (33).png
    Thanks, works flawlessly!!