Author Topic: FF7 FMVs brighter in-game than in a media player  (Read 160 times)

CaptRobau

  • Fast newbie
  • *
  • Posts: 30
  • Karma: 5
    • View Profile
FF7 FMVs brighter in-game than in a media player
« on: 2019-05-12 07:09:24 »
I've been modding away and configuring 7th Heaven for a while now, so I'm far from a clean install at this point. Anyway, I'm now noticing that my in-game movies are showing up much brighter than I think they should be. Looking at these FMVs in a media player confirms that they are indeed brighter in-game: blacks have become grays, etc.

Has anyone seen that before? Is it something I F-ed up during modding, a faulty 7th Heaven setup, etc.

Hope someone can help me solve this problem. Thank you in advance.


Manakaiser

  • Fast newbie
  • *
  • Posts: 22
  • Karma: 3
    • View Profile
Re: FF7 FMVs brighter in-game than in a media player
« Reply #1 on: 2019-05-12 08:13:28 »
Now while im not saying that this is necessarily the reason why this applies to movies but I can tell you that generally speaking colors and brightness between out of game assets and ingame view generally changes and tends to be on the brighter side when displayed ingame; Possibly due to aalis driver but I dont really know "why"; just that its the case as shown in the following example:

Left Is in an image viewer and right is ingame display (disregard the "lights" themselves since most of them have overlaid lighting layers and rather look at the rest of the areas for example the top of the tower in the bottom right part):
https://imgur.com/jyQVS3v
« Last Edit: 2019-05-12 08:15:50 by Manakaiser »

CaptRobau

  • Fast newbie
  • *
  • Posts: 30
  • Karma: 5
    • View Profile
Re: FF7 FMVs brighter in-game than in a media player
« Reply #2 on: 2019-05-12 21:44:52 »
Okay, so it's a problem everyone has, at least with Aali/7th installed?

Covarr

  • Covarr-Let
  • Administrator
  • No life
  • *
  • Posts: 4049
  • Karma: 121
  • Just Covarr. No "n".
    • View Profile
Re: FF7 FMVs brighter in-game than in a media player
« Reply #3 on: 2019-05-12 21:48:14 »
This kinda looks like a colorspace issue. The game seems to be outputting limited range (16-235) while the media player is outputting full range (0-255). I can't really guess at why it's doing that or how to solve it, but I've seen this problem before in other things.

DLPB

  • No life
  • *
  • Posts: 9520
  • Karma: 320
  • For I realized that God's a young man, too.
    • View Profile
Re: FF7 FMVs brighter in-game than in a media player
« Reply #4 on: 2019-05-13 11:06:21 »
Covarr's right.

With 1998, you can adjust the shaders to fix it.  But with Steam, I don't know.

I'll upload some shaders for 1998 that may fix it later.  Assuming Aali didn't already fix it in latest dll.

Rumbah

  • Fast newbie
  • *
  • Posts: 49
  • Karma: 2
    • View Profile
Re: FF7 FMVs brighter in-game than in a media player
« Reply #5 on: 2019-05-13 14:20:17 »
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.



CaptRobau

  • Fast newbie
  • *
  • Posts: 30
  • Karma: 5
    • View Profile
Re: FF7 FMVs brighter in-game than in a media player
« Reply #6 on: 2019-05-13 20:22:49 »
That's it guys. I tried replacing the text in yuv.frag with one of them (last one) and it worked on the first try.

Is this brightness issue everyone has, until they fix it like that? Or would it only affect some PCs? Asking for the installation instructions of my mod's upcoming release.

Rumbah

  • Fast newbie
  • *
  • Posts: 49
  • Karma: 2
    • View Profile
Re: FF7 FMVs brighter in-game than in a media player
« Reply #7 on: 2019-05-13 21:28:44 »
Everyone should have this issue I guess.

The original videos are full range and the shader seems to assume this. And if the modded videos are tv range you'll get the grey blacks and washed out look.
You could either use the above shader for your mod and not worry about full/tv range or you could code the videos in full range.