發白是有原因的..<<<====也是老梗問題了..
這問題靠Shader Code就解決了...
sampler s0 : register(s0);
float4 p0 : register(c0);
float4 p1 : register(c1);
#define width (p0[0])
#define height (p0[1])
#define counter (p0[2])
#define clock (p0[3])
#define one_over_width (p1[0])
#define one_over_height (p1[1])
#define PI acos(-1)
#define BT_709
#ifdef BT_709
#define Kb 0.0722
#define Kr 0.2126
#else
#ifdef SMPTE_240M
#define Kb 0.087
#define Kr 0.212
#else
#define Kb 0.114
#define Kr 0.299
#endif
#endif
static float3x3 r2y =
{
Kr, 1-Kr-Kb, Kb,
-Kr/(1-Kb)*0.5, -(1-Kr-Kb)/(1-Kb)*0.5, 0.5,
0.5, -(1-Kr-Kb)/(1-Kr)*0.5, -Kb/(1-Kr)*0.5,
};
static float3x3 y2r =
{
1.000, 0.000, (1-Kr)*2,
1.000, -(1-Kr)*2*Kb/(1-Kr-Kb), -(1-Kb)*2*Kr/(1-Kr-Kb),
1.000, (1-Kb)*2, 0.000,
};
// Brightness: -1.0 to 1.0, default 0.0
// Contrast: 0.0 to 10.0, default 1.0
// Hue: -180.0 to +180.0, default 0.0
// Saturation: 0.0 to 10.0, default 1.0
#define Brightness 0.0
#define Contrast 1.0
#define Hue 0.0
#define Saturation 1.0
static float2x2 HueMatrix =
{
cos(Hue * PI / 180), sin(Hue * PI / 180),
-sin(Hue * PI / 180), cos(Hue * PI / 180)
};
float4 main(float2 tex : TEXCOORD0) : COLOR
{
float4 c0 = tex2D(s0, tex);
c0.rgb = mul(r2y, c0.rgb);
// Y range is [16,235], PbPr range is [-112,112]
c0.r = (c0.r * 255 - 16) / 219;
c0.gb = (c0.gb * 255) / 224;
//c0.r = Contrast * c0.r + Brightness;
//c0.gb = mul(HueMatrix, c0.gb) * Saturation;
c0.rgb = mul(y2r, c0.rgb);
return c0;
}