Hmm. Subtracting those two images in Photoshop is only showing differences in the parts that were moving, AFAICT:
Even if there is any difference, I think it is indeed close enough, so Iāll push it up to the repo.
You guys may be interested in an extended image adjustment shader I made that gives full control over the color matrix in runtime params (e.g., you can control how much red is in the blue channel or how much green is in the red channel), which may be easier to work with than what you guys have been doing:
/*
Color Mangler
Author: hunterk
License: Public domain
*/
// Shader that replicates the LCD dynamics from a GameBoy Advance
#pragma parameter display_gamma "Display Gamma" 2.2 0.0 10.0 0.1
#pragma parameter target_gamma "Target Gamma" 2.2 0.0 10.0 0.1
#pragma parameter overscan_percent_x "Horizontal Overscan %" 0.0 -25.0 25.0 1.0
#pragma parameter overscan_percent_y "Vertical Overscan %" 0.0 -25.0 25.0 1.0
#pragma parameter sat "Saturation" 1.0 0.0 3.0 0.01
#pragma parameter lum "Luminance" 1.0 0.0 5.0 0.01
#pragma parameter contrast "Contrast" 1.0 0.0 2.0 0.01
#pragma parameter r "Red" 1.0 0.0 2.0 0.01
#pragma parameter g "Green" 1.0 0.0 2.0 0.01
#pragma parameter b "Blue" 1.0 0.0 2.0 0.01
#pragma parameter rg "Red-Green Tint" 0.0 0.0 1.0 0.005
#pragma parameter rb "Red-Blue Tint" 0.0 0.0 1.0 0.005
#pragma parameter gr "Green-Red Tint" 0.0 0.0 1.0 0.005
#pragma parameter gb "Green-Blue Tint" 0.0 0.0 1.0 0.005
#pragma parameter br "Blue-Red Tint" 0.0 0.0 1.0 0.005
#pragma parameter bg "Blue-Green Tint" 0.0 0.0 1.0 0.005
#pragma parameter blr "Black-Red Tint" 0.0 0.0 1.0 0.005
#pragma parameter blg "Black-Green Tint" 0.0 0.0 1.0 0.005
#pragma parameter blb "Black-Blue Tint" 0.0 0.0 1.0 0.005
#ifdef PARAMETER_UNIFORM
uniform float display_gamma;
uniform float target_gamma;
uniform float sat;
uniform float lum;
uniform float contrast;
uniform float blr;
uniform float blg;
uniform float blb;
uniform float r;
uniform float g;
uniform float b;
uniform float rg;
uniform float rb;
uniform float gr;
uniform float gb;
uniform float br;
uniform float bg;
uniform float overscan_percent_x;
uniform float overscan_percent_y;
#else
#define display_gamma 2.2
#define target_gamma 2.2
#define sat 1.0
#define lum 1.0
#define contrast 1.0
#define blr 0.0
#define blg 0.0
#define blb 0.0
#define r 1.0
#define g 1.0
#define b 1.0
#define rg 0.0
#define rb 0.0
#define gr 0.0
#define gb 0.0
#define br 0.0
#define bg 0.0
#define overscan_percent_x 0.0
#define overscan_percent_y 0.0
#endif
struct input
{
float2 video_size;
float2 texture_size;
float2 output_size;
float frame_count;
float frame_direction;
float frame_rotation;
};
void main_vertex
(
float4 position : POSITION,
out float4 oPosition : POSITION,
uniform float4x4 modelViewProj,
uniform input IN,
float2 tex : TEXCOORD,
out float2 oTex : TEXCOORD
)
{
oPosition = mul(modelViewProj, position);
float2 shift = 0.5 * IN.video_size / IN.texture_size;
float2 overscan_coord = (tex - shift) * (1.0 - float2(overscan_percent_x / 100.0, overscan_percent_y / 100.0)) + shift;
oTex = overscan_coord;
}
float4 main_fragment(float2 tex : TEXCOORD, uniform sampler2D s0 : TEXUNIT0) : COLOR
{
float4 screen = pow(tex2D(s0, tex), target_gamma).rgba; //sample image in linear colorspace
float4 avglum = float4(0.5);
screen = lerp(screen, avglum, (1.0 - contrast));
// r g b black
mat4x4 color = {r, gr, br, blr, //red channel
rg, g, bg, blg, //green channel
rb, gb, b, blb, //blue channel
0.0, 0.0, 0.0, 1.0}; //alpha channel; these numbers do nothing for our purposes.
mat4x4 adjust = {(1.0 - sat) * 0.3086 + sat, (1.0 - sat) * 0.6094, (1.0 - sat) * 0.0820, 0.0,
(1.0 - sat) * 0.3086, (1.0 - sat) * 0.6094 + sat, (1.0 - sat) * 0.0820, 0.0,
(1.0 - sat) * 0.3086, (1.0 - sat) * 0.6094, (1.0 - sat) * 0.0820 + sat, 0.0,
1.0, 1.0, 1.0, 1.0};
color = mul(color, adjust);
screen = saturate(screen * lum);
screen = mul(color, screen);
return pow(screen, 1.0 / display_gamma);
}