Author Topic: [FF7] Changing the Dynamic Range of the FMV output?  (Read 3707 times)

andawra

  • *
  • Posts: 4
    • View Profile
Watching the FMVs in VLC for example seems to utilize the full 0-255 RGB range but in the game itself (Steam version modded with 7thheaven) they're washed out and the blacks are brighter than 0.

Is there any way to alleviate this? It seems related to the OpenGL plugin since launching the steam version itself without 7thHeaven makes the FMVs looks fine.

Rumbah

  • *
  • Posts: 58
    • View Profile
Re: [FF7] Changing the Dynamic Range of the FMV output?
« Reply #1 on: 2019-05-04 14:38:05 »
In the thread someone reported that the 2nd shader did the trick, perhaps you could try it.

The shader to look for is the yuv.frag in the shader folder.

Actually I found two of these in my old folder so you could try both (should do the same, perhaps performance differences):

Code: [Select]
#version 110

uniform sampler2D y_tex;
uniform sampler2D u_tex;
uniform sampler2D v_tex;

uniform bool full_range;

const mat3 mpeg_rgb_transform = mat3(
1.164,  1.164,  1.164,
0.0,   -0.392,  2.017,
1.596, -0.813,  0.0
);

const mat3 jpeg_rgb_transform = mat3(
1.0,  1.0,   1.0,
0.0, -0.343, 1.765,
1.4, -0.711, 0.0
);

void main()
{
float y = texture2D(y_tex, gl_TexCoord[0].st).x;
float u = texture2D(u_tex, gl_TexCoord[0].st).x - 0.5;
float v = texture2D(v_tex, gl_TexCoord[0].st).x - 0.5;
vec3 yuv_color = vec3(y, u, v);
vec4 rgba_color;

if(full_range) rgba_color = vec4(jpeg_rgb_transform * yuv_color, 1.0);
else rgba_color = vec4(mpeg_rgb_transform * yuv_color, 1.0);

gl_FragColor = rgba_color;
}
Code: [Select]
#version 110

uniform sampler2D y_tex;
uniform sampler2D u_tex;
uniform sampler2D v_tex;

uniform bool full_range;

const mat3 rgb_transform = mat3(
1.0,    1.0,   1.0,
0.0,   -0.344, 1.77,
1.403, -0.714, 0.0
);

void main()
{
float y = texture2D(y_tex, gl_TexCoord[0].st).x;
float u = texture2D(u_tex, gl_TexCoord[0].st).x - 0.5;
float v = texture2D(v_tex, gl_TexCoord[0].st).x - 0.5;

if(!full_range) y = (y - (1.0 / 255.0) * 16.0) * (255.0 / (255.0 - 16.0));

vec3 yuv_color = vec3(y, u, v);
vec4 rgba_color = vec4(rgb_transform * yuv_color, 1.0);
gl_FragColor = rgba_color;
}
If both do not work because either ffmpeg does get the info wrong or the videos are not correctly signaled then one could hardcode the correct one in the shader.
And it depends on Aali's driver version, I think earlier ones always assumed full range, then it changed to (buggy?) detection.



andawra

  • *
  • Posts: 4
    • View Profile
Re: [FF7] Changing the Dynamic Range of the FMV output?
« Reply #2 on: 2019-05-06 17:08:05 »
In the thread someone reported that the 2nd shader did the trick, perhaps you could try it.

Yup, that did it. Thanks a lot!

SonicB00M

  • *
  • Posts: 2
    • View Profile
Re: [FF7] Changing the Dynamic Range of the FMV output?
« Reply #3 on: 2020-04-22 20:20:57 »
Hey guys,

sorry to bump this thread but I can't get this shader to work. I changed the yuv.frag according to the one posted above but the FMVs still appear to be washed out. Am I missing a step? Do I have to somehow select the shader inside 7th Heaven? Thanks in advance!