エフェクト-色調補正 †画面の色味を補正するもの。 モノクロ †RGB色空間をYCbCr色空間に変換。 const float3 RGBtoY = {0.299, 0.587, 0.114}; float4 color = tex2D(TextureSampler, tex_coord0); color.rgb = dot(color, RGBtoY); return color; セピア †モノクロ化した後に、Cb, Cr に適当な数値をいれて、再度RGBに戻す。 const float3 RGBtoY = { 0.299, 0.587, 0.114}; float3x3 YCbCrtoRGB = { {1.0, 0.00000, 1.40200}, {1.0, -0.34414, -0.71414}, {1.0, 1.77200, 0.00000}, }; float4 color = tex2D(TextureSampler, tex_coord0); // RGBからYCbCrへ変換 float3 YCbCr; YCbCr.x = dot(color, RGBtoY); YCbCr.y = -0.091; YCbCr.z = 0.056; // YCbCr -> rgb color.rgb = mul(YCbCrtoRGB, YCbCr); return color; コントラスト調整 †明るい所は明るく、暗い所は暗く強調する。 float4 color = tex2D(TextureSampler, tex_coord0); // -0.5~0.5の範囲 color.rgb = ((color.rgb - 0.5) * Rate) + 0.5; return color; |