RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
239 stars 29 forks source link

HDRP video way too dark, unclear how to avoid Gamma over-correction #2028

Closed wybo closed 3 weeks ago

wybo commented 4 weeks ago

I'm using the HDRP render pipeline on Unity 6. In the screenshot the picture in the left bottom is what it looks like in windows media player, and what it should look like.

The large middle picture in the middle is what comes out. Looks over-corrected to Gamma color space. I have gamma disabled in the shader, and have searched the AVPro source code for gamma settings / adjustments as well. But couldn't find anything that affects DisplayUGUI / can be tweaked there.

And the picture on the right bottom is probably what it looks like in linear color space, uncorrected.

How can I make it look like in windows media player (left bottom picture) ?

Screenshot

Might be a question as much as an issue...

AVPro 3.0.4. in this project OS: Windows 10, desktop. Mp4 h264 video

Chris-RH commented 3 weeks ago

Could you update to the latest version (3.0.11) and retest please? :)

wybo commented 3 weeks ago

Upgraded to 3.0.11, also unity to 6000.0.22f1 still the same.

Screenshot2

Am using the Playlist Video Player. Don't know if that makes any difference, or requires tweaking the shaders or such.

wybo commented 3 weeks ago

Ran it with the standard Video Player. No difference either. Problem persists

wybo commented 3 weeks ago

Did some experiments:

I tore out things deliminated by AVPRO_CHEAP_GAMMA_CONVERSION in AVProVideo.cginc. That's not it as it doesn't change anything.

Then I tore out all calls to GammaToLinear (the active one is in SampleRGBA). That does change things, and makes it look almost like the picture in the bottom right, BUT still a little darker. Though not as dark as it should be, in Media Player (obviously, as Gamma to Linear was just disabled).

Screenshot (146)

Looked further. Seems to come from Canvas render mode: Screen Space - Camera. With Screen Space - Overlay, it looks like it should. With GammaToLinear it looks exactly as in Media Player. So it must be in post-processing.

Did some more digging, and Tone Mapping turned out to be the issue; but even when "vertex color always in gamma color space" was disabled...

https://issuetracker.unity3d.com/issues/colors-on-images-become-darker-when-enabling-vertex-color-always-in-gamma-color-space

The solution: disable Tone Mapping in Projects Settings - Graphics - Frame Settings (Default Values) - Camera - Rendering!