Qhimm.com Forums

Miscellaneous Forums => Troubleshooting => Topic started by: DLPB_ on 2014-01-12 18:54:10

Title: FMV Brightness
Post by: DLPB_ 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?
Title: Re: FMV Brightness
Post by: Rumbah 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.
Title: Re: FMV Brightness
Post by: DLPB_ 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.
Title: Re: FMV Brightness
Post by: Rumbah 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);
Title: Re: FMV Brightness
Post by: DLPB_ 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.
Title: Re: FMV Brightness
Post by: Rumbah 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.
Title: Re: FMV Brightness
Post by: DLPB_ 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).
Title: Re: FMV Brightness
Post by: Aali 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.
Title: Re: FMV Brightness
Post by: DLPB_ on 2014-01-13 14:35:25
Yup, works fine, Aali.
Title: Re: FMV Brightness
Post by: Rumbah 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.
Title: Re: FMV Brightness
Post by: Kranmer 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 :)
Title: Re: FMV Brightness
Post by: dizzy format 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