Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Help Wanted "implicit truncation of vector type" - Should I care?

Discussion in 'Shader Graph' started by dgoyette, Jun 16, 2020.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    3,679
    I was getting some warnings in a graph: "implicit truncation of vector type"

    This seems to be because I was sending a V4 into a V3 input, such as this:

    upload_2020-6-16_1-34-57.png

    In these cases, am I really supposed to do something like the following in order to now get a warning?

    upload_2020-6-16_1-36-30.png

    Is the second approach "better" in some way? It prevents the warning, but it adds more cruft to the graph. I also don't know whether it has any performance impact one way or the other.
     
    bobbaluba and JPDoiron like this.
  2. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    1,307
    I'd like to know as well :)
     
  3. goran_okomotive

    goran_okomotive

    Joined:
    Apr 26, 2017
    Posts:
    46
  4. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    143
    Me too interesting in this.
    I see two questions here:
    1. Can it cause any trouble? For example console has more strict requirements for shaders that sometimes cause compilation errors.
    2. What is preferable way in terms of optimization?
     
  5. MagdielM

    MagdielM

    Joined:
    May 27, 2020
    Posts:
    32
    Implicit truncation warnings serve to, well, warn you that the truncation is happening so that you're not surprised when the alpha channel of your RGBA output is suddenly missing from your variable later in the graph because you passed it through a node that takes in a three-component vector.

    If I recall correctly, it's about as computationally expensive as a swizzle operation. You probably shouldn't worry about it.
     
  6. Sphax84

    Sphax84

    Joined:
    Jun 23, 2015
    Posts:
    28
    I'm interested in that as well because I get spammed in the Console by those warnings and it's pretty annoying.
    Are we supposed to get rid of those warnings by editing the Shader Graphs the way @dgoyette showed in the screenshot and is it expensive in a way or another or another method exists to remove/hide that kind of warnings?
     
  7. Dorodo

    Dorodo

    Joined:
    Mar 8, 2015
    Posts:
    40
    Getting the same warnings here. Would be nice if we could get rid of that, as it seems to be a bug.
     
    bobbaluba likes this.
  8. vyacheslav_zemlyanik

    vyacheslav_zemlyanik

    Joined:
    Sep 21, 2020
    Posts:
    1
    I would love to know that too!
     
  9. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    88
    Maybe one day we'll find out :rolleyes:
     
  10. Double-V

    Double-V

    Joined:
    Aug 13, 2016
    Posts:
    18
    I would like to know too
     
  11. unity_yppDGGle3H5QVQ

    unity_yppDGGle3H5QVQ

    Joined:
    Feb 18, 2021
    Posts:
    1
    any news on this? I am encountering the same issue
     
  12. TheProfessor

    TheProfessor

    Joined:
    Nov 2, 2014
    Posts:
    72
    This problem affects me as well; especially since it says it's an "error" and not a "warning"; if it's an actual error what am I supposed to do? If its a warning, how do I turn it off? Having to swizzle manually just for peace of mind seems inoptimal.
     
unityunity