Author Topic: FMV Brightness  (Read 3377 times)

DLPB

  • No life
  • *
  • Posts: 9817
  • Karma: 313
  • The ascension of the ordinary man
    • View Profile
FMV Brightness
« on: 2014-01-12 18:54:10 »
As of Aali's latest driver, FMV (Steam versions) seem to be way too bright.  I vaguely remember some sort of fix for the shaders that sorted this.  But I can't find it.  Anyone?

Rumbah

  • Fast newbie
  • *
  • Posts: 49
  • Karma: 2
    • View Profile
Re: FMV Brightness
« Reply #1 on: 2014-01-12 23:21:25 »
Well, if it is from wrong colour conversion then it is in the yuv.frag shader. There are two transforms in there, the jpeg one for full range yuv and the mpeg one for compressed range yuv. You could just harcode the correct one for the videos you are using.

DLPB

  • No life
  • *
  • Posts: 9817
  • Karma: 313
  • The ascension of the ordinary man
    • View Profile
Re: FMV Brightness
« Reply #2 on: 2014-01-12 23:41:30 »
Do you know how to do this for the Steam releases?

In other news, Kranmer saw that the older driver plugin for movies doesn't have this issue, but newest does.

Rumbah

  • Fast newbie
  • *
  • Posts: 49
  • Karma: 2
    • View Profile
Re: FMV Brightness
« Reply #3 on: 2014-01-13 09:50:14 »
Which way round, using different videos in the FF7 Steam release vesion or using the Steam release version videos in the 98er version with Aalis driver?

Anyway downloading the Steam release version, might take a while.


EDIT: Looked at the steam version, the pixel shader there uses the compressed range conversion matrix so I guess the movies are the same.
Aali's driver should use the mpeg_rgb_transform matrix defined in the fragment shader. But I don't know if the Steam videos are correctly tagged sothe driver might recognize it wrong anduse the jpeg_rgb_transform matrix.

You could test it by just hardwire the matrix in the shader, e.g. change

Code: [Select]
if(full_range) rgba_color = vec4(jpeg_rgb_transform * yuv_color, 1.0);
else rgba_color = vec4(mpeg_rgb_transform * yuv_color, 1.0);
to
Code: [Select]
rgba_color = vec4(mpeg_rgb_transform * yuv_color, 1.0);
« Last Edit: 2014-01-13 14:06:42 by Rumbah »

DLPB

  • No life
  • *
  • Posts: 9817
  • Karma: 313
  • The ascension of the ordinary man
    • View Profile
Re: FMV Brightness
« Reply #4 on: 2014-01-13 14:00:39 »
It doesn't seem to matter which.  The new driver plugin for videos seems to have some issue with brightness.

Rumbah

  • Fast newbie
  • *
  • Posts: 49
  • Karma: 2
    • View Profile
Re: FMV Brightness
« Reply #5 on: 2014-01-13 14:12:31 »
Ah, I guess I found an error in the driver shader, could you try to change

Code: [Select]
float y = texture2D(y_tex, gl_TexCoord[0].st).x;to
Code: [Select]
float y = texture2D(y_tex, gl_TexCoord[0].st).x - 1.0/16.0;in the yuv.frag shader. Seems like Aali forgot to substract the constant so everything was too bright as you reported.
« Last Edit: 2014-01-13 14:17:13 by Rumbah »

DLPB

  • No life
  • *
  • Posts: 9817
  • Karma: 313
  • The ascension of the ordinary man
    • View Profile
Re: FMV Brightness
« Reply #6 on: 2014-01-13 14:22:49 »
That's fixed it.  Star.  Weird though that with Kranmer it was being fixed by replacing the old plugin with new.  (Not shaders).

Aali

  • No life
  • *
  • Posts: 1197
  • Karma: 116
    • View Profile
Re: FMV Brightness
« Reply #7 on: 2014-01-13 14:29:06 »
Thanks Rumbah, that does seem to be the problem! Your change will break full range codecs though so try this shader instead:

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
{
yuv_color.x = yuv_color.x - (1.0 / 16.0);
rgba_color = vec4(mpeg_rgb_transform * yuv_color, 1.0);
}

gl_FragColor = rgba_color;
}

If it works fine it will be in the next version.

DLPB

  • No life
  • *
  • Posts: 9817
  • Karma: 313
  • The ascension of the ordinary man
    • View Profile
Re: FMV Brightness
« Reply #8 on: 2014-01-13 14:35:25 »
Yup, works fine, Aali.

Rumbah

  • Fast newbie
  • *
  • Posts: 49
  • Karma: 2
    • View Profile
Re: FMV Brightness
« Reply #9 on: 2014-01-13 15:59:59 »
Your change will break full range codecs though so try this shader instead:
Yes, you're right, I didn't see that one. Now your corrected formula looks correct for both ranges.

Kranmer

  • Freak
  • *
  • Posts: 767
  • Karma: 9
    • View Profile
Re: FMV Brightness
« Reply #10 on: 2014-01-13 23:39:42 »
That's fixed it.  Star.  Weird though that with Kranmer it was being fixed by replacing the old plugin with new.  (Not shaders).
Well i did find replacing the "ffmpeg_movies.fgp" from 0.7.11 seemed to fix the problem in 0.8.1 but i suppose could have caused other problems since i didn't fully test it (only tested 2 movies at the start of the game), it was just a observation after testing a few things.
But looks like it has been fixed now anyway :)

dizzy format

  • Fast newbie
  • *
  • Posts: 10
  • Karma: 1
    • View Profile
Re: FMV Brightness
« Reply #11 on: 2016-02-10 15:44:53 »
U two need to stand up and take a bow i had these problem for ages but didnt have a clue why ie the stars in the intro vid surrounded by a white light mist god i know im a freak but it bugged me well ya fix that for me so cheers keep up the good work lads ps rumbah if by a mircle u :) read this dont suppose u have a working link for ya 1280 sharp vids please im using bootleg because 7h is not playing ball