Search Unity

Bug BUG??? Why are floats not working as expected in my shader???

Discussion in 'General Graphics' started by MMeyers23, Oct 26, 2022.

  1. MMeyers23

    MMeyers23

    Joined:
    Dec 29, 2019
    Posts:
    101
    I dont know what the hell is going on with my project. Every time I define a float2 or float3 or float4, and try to use an individual component of that variable it ALWAYS returns the last component? For example if I declare float4 test = (0.1f, 0.2f, 0.3f, 1.0f); and then return float4 out = (test.x, test.x, test.x, 1) it outputs a white color! If I change the last component of float4 test to a different value such as 0.5, then the output uses 0.5 for the r, g, and b values. WHAT THE HELL??
     
  2. georgerh

    georgerh

    Joined:
    Feb 28, 2020
    Posts:
    72
  3. MMeyers23

    MMeyers23

    Joined:
    Dec 29, 2019
    Posts:
    101
    Thank you!