Search Unity

Animating alpha values in Material's Colors is broken in linear space

Discussion in 'Animation' started by Potaski, Jul 26, 2017.

  1. Potaski

    Potaski

    Joined:
    Aug 21, 2013
    Posts:
    52
    In Linear mode, when animating an color value in Animation Window. The alpha value now will be "Converted" to linear value like RGB values when applied to material. For anyone has basic graphics knowledge would know that alpha values should be treated as linear value. There's two related issue:

    https://issuetracker.unity3d.com/is...6.1169711890.1501038298-1078311820.1494253297

    https://issuetracker.unity3d.com/issues/linear-animated-material-changes-color-in-play-mode

    For I have tested in 5.6.1p2, the rgb component of color and vectors do work correctly in animation window. But the alpha channel is broken, which is the most commonly used channel in effects animation. As a result, the effects team of my project is on hold right now. I never thought such problem would happen in commercial engines.
     
  2. Potaski

    Potaski

    Joined:
    Aug 21, 2013
    Posts:
    52
    image_20170726144835.PNG

    Here is a simple test: the shader used for the two white bar has an instruction of clip(_Color.a - i.uv.x), which means the length of the bar reflects the alpha value. Both bars were supposed to have an _Color value of (1,1,1,0.5), the top bar was controller by material property. The bottom bar was controller by animation. You can see that the actual alpha value applied to the object is ~0.2, which is approximately 0.5 converted to linear.

    Edit: Reproduced in both 5.6.1p2 and 2017.1.0f3

    Issue was submitted, Case 935087
     
    Last edited: Jul 26, 2017
  3. NoiseFloorDev

    NoiseFloorDev

    Joined:
    May 13, 2017
    Posts:
    104
    This sounds similar to the issue I reported here (to which I received no response at all):

    https://forum.unity3d.com/threads/sampling-textures-without-srgb-conversion.480959/

    The only workaround I've found is to set the entire project to linear, but if you have a large existing project, switching over to linear space will probably be a huge task. Might give it a try to see if it's a potential workaround, though.
     
  4. Potaski

    Potaski

    Joined:
    Aug 21, 2013
    Posts:
    52
    My problem happens when the entire project is set to linear, which was what we are working on currently. It is kind of a simple bug, but blocks a lot of work.