mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Composit Target and gamma correct rendering
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
Texture2D Texture : register(t0);
|
||||
SamplerState TextureSampler : register(s0);
|
||||
|
||||
struct VS_IN
|
||||
{
|
||||
float2 Position : POSITION;
|
||||
float2 TexCoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float2 TexCoord : TEXCOORD;
|
||||
};
|
||||
|
||||
PS_IN VS(VS_IN input)
|
||||
{
|
||||
PS_IN output;
|
||||
|
||||
output.Position = float4(input.Position, 0, 1);
|
||||
output.TexCoord = input.TexCoord;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 PS(PS_IN input) : SV_TARGET
|
||||
{
|
||||
float4 color = Texture.Sample(TextureSampler, input.TexCoord);
|
||||
|
||||
return float4(pow(color.rgb, 1.0f / 2.2f), color.a);
|
||||
}
|
||||
|
||||
#effect[VS = VS, PS = PS]
|
||||
@@ -28,9 +28,7 @@ float4 PS(PS_IN input) : SV_TARGET
|
||||
float4 rawColor = CameraTarget.Sample(CameraTargetSampler, input.TexCoord);
|
||||
|
||||
float3 color = rawColor.rgb / (rawColor.rgb + 1.0f);
|
||||
|
||||
color = pow(color, 1.0f / 2.2f);
|
||||
|
||||
|
||||
return float4(color, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@ PS_Input VS(VS_Input input)
|
||||
output.Texcoord = input.UVTransform.xy + input.UVTransform.zw * input.Texcoord;
|
||||
output.Color = input.Color;
|
||||
|
||||
// Premultiply Alpha
|
||||
output.Color.rgb *= output.Color.a;
|
||||
|
||||
#ifdef EDITOR
|
||||
output.EntityId = input.EntityId;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user