UnityPlugin-AVProVideo icon indicating copy to clipboard operation
UnityPlugin-AVProVideo copied to clipboard

[Android] Gamma coloring seems to be applied to the video when it is not playing even though gamma is deselected in the shader

Open LukeFarrer opened this issue 8 months ago • 6 comments

Unity version

2022.3.34f1

Unity editor platform

Windows

AVPro Video edition

Core

AVPro Video version

3.2.2

Device hardware

Quest 3

Which Android OS version are you using?

12

Unity Graphics API

OpenGLES 3

Video API

media3/ExoPlayer

Texture format

Y Cb Cr 420_OES

Audio output

Unity

Any other Media Player component configuration required to reproduce the issue.

No response

Which output component(s) are you using?

Apply to Material

Any other component configuration required to reproduce the issue.

No response

The issue

When using OES to render videos, we notice that when the video is not playing, and the default texture is being used (ApplyToMaterial), that it seems to have gamma applied to it when the app is running. The AVProVideo shader being used is AvProVideo/Unlit/Opaque/Android OES Only. Even though "Apply Gamma" is deselected, the texture is having gamma applied to it as it appears much darker.

To reproduce this issue, simply press Play in the Unity Editor and stop the video. You will see the default texture is too dark as gamma has been applied even though Apply Gamma is deselected. If you then select Apply Gamma and then immediately deselect it, the texture then looks correct.

When the actual video is playing everything looks correct.

We are using Linear Color Space in the Unity project and URP.

What is the reason for this?

Media information

No response

Logcat output


LukeFarrer avatar Apr 14 '25 09:04 LukeFarrer

Image Image

LukeFarrer avatar Apr 14 '25 09:04 LukeFarrer

Hmm, that's very strange. Does this occur on the device as well as the simulator? In AVPro Video version 3.2.3, we included a big improvement in our support for the Vulkan API. I would be interested to know if this gives you equivalent or better performance compared to OpenGLES + OES. Also, if this issue still occurs.

Chris-RH avatar Apr 14 '25 14:04 Chris-RH

It does occur on the Quest 3, yes, as well as the simulator. Migrating over to Vulkan API on the Quest 3 sounds like a big move. We are concerned about needing to make lots of changes to shaders, etc. Would we still need to use OES shaders - I assume not. Do you explain somewhere in the docs how to go about this, especially as we are using a tailor-made URP?

LukeFarrer avatar Apr 14 '25 14:04 LukeFarrer

Default textures require separate handling to OES textures so it's quite possible something isn't working quite right there. We'll investigate and see what can be done in the shader code.

For now, could you try and uncheck sRGB on your default texture in the texture inspector. This will prevent Unity from gamma correcting and allow the shader code to do it instead. This should resolve the issue.

Switching to Vulkan shouldn't require changing anything in your scene. However if you're playing back very hires videos I would still recommend using OpenGLES with OES textures as it cuts out a texture copy and as a result is more performant.

MorrisRH avatar Apr 15 '25 09:04 MorrisRH

Unchecking sRGB on the default texture does fix the issue. Thank you. I don't know if you want to keep this support request open or not.

LukeFarrer avatar Apr 15 '25 15:04 LukeFarrer

A fix for this issue will make it into the next release (version 3.2.7). You'll probably need to re-apply the sRGB check after updating.

MorrisRH avatar May 27 '25 13:05 MorrisRH

AVPro Video version 3.2.7 has been released. Please let us know if this has not fixed the issue for you.

Chris-RH avatar Jul 03 '25 08:07 Chris-RH