エフェクト-色調補正
をテンプレートにして作成
[
ホーム
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
*エフェクト-色調補正 [#u511f066]
画面の色味を補正するもの。
計算式や実装など本来の物と違ったらごめんなさい。
----
#contents
** モノクロ [#m788e47c]
&ref(effect-color_control-mono.JPG,,40%);
RGB色空間をYCbCr色空間に変換。
輝度Yだけ取り出す。
const float3 RGBtoY = {0.299, 0.587, 0.114};
// RGBから輝度Yに変換
float y = dot(hrgb, RGBtoY);
// 輝度YをRGBカラーに適用し、モノクロ化
return float4((float3)y, hrgb.a);
サンプル:&ref(mono.fx);
** セピア [#c3f417b7]
&ref(effect-color_control-sepia.JPG,,40%);
モノクロ化した後に、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},
};
// RGBから輝度Yに変換
// Cb Crには適当な値を入れる
float3 YCbCr;
YCbCr.x = dot(hrgb, RGBtoY);
YCbCr.y = -0.091;
YCbCr.z = 0.056;
// YCbCrからRGBへ復元
return float4(mul(YCbCrtoRGB, YCbCr), hrgb.a);
サンプル:&ref(sepia.fx);
** ネガポジ反転 [#da92d2f3]
&ref(effect-color_control-nega.JPG,,40%);
色を反転。
float4 ret;
ret.r = 1.0 - hrgb.r;
ret.g = 1.0 - hrgb.g;
ret.b = 1.0 - hrgb.b;
ret.a = hrgb.a;
return ret;
サンプル:&ref(nega.fx);
** ガンマ補正 [#vd76a1c1]
&ref(effect-color_control-gamma.JPG,,40%);
ガンマ補正の式:out = color ^ (1.0f / gamma)
より
return float4(pow(abs(hrgb.rgb), (float3)(1.0 / gamma)),...
サンプル:&ref(gamma.fx);
** コントラスト調整 [#b77541b0]
&ref(effect-color_control-contrast.JPG,,40%);
明るい所は明るく、暗い所は暗く強調する。
色は0.0~1.0なので、中間の0.5を基準に上下に引っ張ってます。
return float4(hrgb.rgb * (1.0 + contrast) / 1.0 - contra...
サンプル:&ref(contrast.fx);
終了行:
*エフェクト-色調補正 [#u511f066]
画面の色味を補正するもの。
計算式や実装など本来の物と違ったらごめんなさい。
----
#contents
** モノクロ [#m788e47c]
&ref(effect-color_control-mono.JPG,,40%);
RGB色空間をYCbCr色空間に変換。
輝度Yだけ取り出す。
const float3 RGBtoY = {0.299, 0.587, 0.114};
// RGBから輝度Yに変換
float y = dot(hrgb, RGBtoY);
// 輝度YをRGBカラーに適用し、モノクロ化
return float4((float3)y, hrgb.a);
サンプル:&ref(mono.fx);
** セピア [#c3f417b7]
&ref(effect-color_control-sepia.JPG,,40%);
モノクロ化した後に、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},
};
// RGBから輝度Yに変換
// Cb Crには適当な値を入れる
float3 YCbCr;
YCbCr.x = dot(hrgb, RGBtoY);
YCbCr.y = -0.091;
YCbCr.z = 0.056;
// YCbCrからRGBへ復元
return float4(mul(YCbCrtoRGB, YCbCr), hrgb.a);
サンプル:&ref(sepia.fx);
** ネガポジ反転 [#da92d2f3]
&ref(effect-color_control-nega.JPG,,40%);
色を反転。
float4 ret;
ret.r = 1.0 - hrgb.r;
ret.g = 1.0 - hrgb.g;
ret.b = 1.0 - hrgb.b;
ret.a = hrgb.a;
return ret;
サンプル:&ref(nega.fx);
** ガンマ補正 [#vd76a1c1]
&ref(effect-color_control-gamma.JPG,,40%);
ガンマ補正の式:out = color ^ (1.0f / gamma)
より
return float4(pow(abs(hrgb.rgb), (float3)(1.0 / gamma)),...
サンプル:&ref(gamma.fx);
** コントラスト調整 [#b77541b0]
&ref(effect-color_control-contrast.JPG,,40%);
明るい所は明るく、暗い所は暗く強調する。
色は0.0~1.0なので、中間の0.5を基準に上下に引っ張ってます。
return float4(hrgb.rgb * (1.0 + contrast) / 1.0 - contra...
サンプル:&ref(contrast.fx);
ページ名: