Search Issue Tracker

Fixed in Unity 2018.2

Votes

31

Found in

2017.2.0f2

Issue ID

962142

Regression

Yes

[Regression] [Win] Videos are dark when using Linear color space

Graphics - General

-

-

Priority: 2Necessary for shipping a final release

-

Severity: 3Secondary functionality broken

How to reproduce:
1. Download attached project file and open "1" Scene
2. Enter Play Mode (make sure Linear color space is selected in Player Settings)

Actual result: All videos are too dark when using the Linear color space. They are correct with the Gamma color space.

Reproduced with: 2017.1.2p2, 2017.2.0f3, 2017.3.0b6, 2018.1.0a1
Not reproduced with: 2017.1.2f1, 2017.2.b10, 2017.3.0a7

Regression since: 2017.1.2p1, 2017.2.0b11, 2017.3.0b1

Reproduced only with Windows.

---------
Fixed in: 2018.2.0a6

Comments (17)

  1. 3b03d455940ab6d67b904f95e9cfcd2d?d=mm

    sound-and-vision

    Jul 05, 2018 17:54

    I applied RATT's fix and it works well with the Video Player Component in 2017.4.1f1.If you want a simple breakdown:

    - In Project Window: Create > Shader > Unlit Shader

    - Underneath the line: fixed4 col = tex2D(_MainTex, i.uv);
    add the following line:
    col.rgb = LinearToGammaSpace(col.rgb);

    - Create a new material: Create > Material
    - Select the new Shader
    - Drag that Material onto the GameObject where your Video Player Component is.
    - Enjoy life!

    Remember that if you upgrade your project to 2018.2 or above in the future, you might need to swap the shader back to the default Unlit Shader.

  2. 040e156173ba5d6e7fa458011862611e?d=mm

    rad1c

    Apr 30, 2018 13:35

    ergh, I meant "private RenderTexture myRTTarget;" OFC, but couldn't modify the comment once it was posted in an "oh no second" :)

  3. 040e156173ba5d6e7fa458011862611e?d=mm

    rad1c

    Apr 30, 2018 13:33

    Mark-Davis Mar 20, 2018 22:37 <--- LIFE SAVER, THANKS!

    For all those who just want to copypaste, create a class level "private RenderTexture targetRT;", have your UI RawImage ready, then in Awake()

    RenderTextureDescriptor rtDesc = new RenderTextureDescriptor([int_vidclip_width], [int_vidclip_height], RenderTextureFormat.Default, 24);
    rtDesc.sRGB = false; //Thank this to Mark Davis! :)
    myRTTarget = new RenderTexture(rtDesc);
    myRTTarget.Create();
    [your_ui_rawimage].texture = myRTTarget;

    And when you want to play a clip:
    myVideoPlayer.targetTexture = myRTTarget;

    Tada, untested joke-engine bug million-th workaround applied!

  4. B965c3693288a27b20bf7b55e0527884?d=mm

    Spanky11

    Mar 30, 2018 02:04

    FYI - This issue is definitely fixed in Unity 2018.1.0b12. I just upgraded from 2017.3 and had the dark videos, and they look great now.

  5. A2b30891a38bf4d9585bc369e07924ca?d=mm

    Mark-Davis

    Mar 20, 2018 22:37

    Hey guys - I just ran into the same issue, but found a workaround. Maybe this will help someone.

    Try using a RenderTexture as the target. An easy way to handle this is to link the RenderTexture to a RawImage. When you create the RenderTexture, in the RenderTextureDescriptor,
    set: desc.sRGB = false;

    Good luck!

  6. Dccaf85fd3c8d88848779d5d279bb7e4?d=mm

    chadidi97

    Mar 17, 2018 12:11

    The issue still exists in 2017.3.1f1 please fix asap.

  7. 996f99c08d9c20a86b1bb2e72b167bc6?d=mm

    tracetronic

    Mar 16, 2018 11:14

    Still exists in 2017.2.1f1

  8. 3f3d2dd908207b795e6f18f3de6e0fff?d=mm

    Ghaleon25

    Mar 12, 2018 14:01

    Tried both workaround but on dark areas, there are bad artifacts and you can clearly see the difference in quality if you play the video outside of unity.
    Any idea if this will be fixed soon or if there is a better workaround?

  9. Bc2cbb3ace9601f01f34dd28340d3113?d=mm

    Ratt

    Mar 05, 2018 22:33

    We ran into the same issue, we fixed it by making a custom shader based on the default Unity UI shader.

    We added:

    fixed4 col = tex2D(_MainTex, i.uv); //this is the line before, should be in the shader
    col.rgb = LinearToGammaSpace(col.rgb); //this is the line we added

    And then make a material with that, put it as the material for the VideoPlayer and you should be good to go

  10. 303f0d96b6aaeb34bdfc654eb31633aa?d=mm

    CorwinJ

    Jan 18, 2018 23:51

    I'm trying to get a workaround going.
    Another thread mentioned it might be lacking gamma correction so I wrote a quick shader to try and add in gamma correction using a formula I found online.

    // Where _GammaFactor is a range of 1-2.4
    col.rgb = pow( col, 1.0 / _GammaFactor);

    This brings the color and some brightness back but it up introducing some weird artifacting.
    Anyone else had any luck with this?

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.