Search Unity

Question Shader fixed world positioning

Discussion in 'Shaders' started by sinedsem, Jun 1, 2020.

  1. sinedsem

    sinedsem

    Joined:
    May 7, 2020
    Posts:
    9
    I have created the following shader. I expected my sprite to be gradiently colored, depending of each point coordinate.
    photo_2020-06-01_14-20-34.jpg
    Instead, it is colored as 4 rectangulars, with center in (0,0)
    photo_2020-06-01_14-17-49.jpg
    What am I doing or undestanding wrong?
     
  2. sinedsem

    sinedsem

    Joined:
    May 7, 2020
    Posts:
    9
    Problem solved. I had very lagre scale, and color should be between 0 and 1. Therefore all what above 1 will have same color.
     
    Olmi likes this.
  3. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Just a tip; I always use a multiplier when I use coordinates or such bit hard to interpret values (like view space or world space). Then it's easier to debug things when you can just adjust that multiplier and see if things look correct when you scale that multiplier up and down. When things start working, you can remove those test things... But they make life much easier.