Hi guys!
So lately I've been messing around with some post processing effects, and came across the Vignetting effect, which makes the user focus in the middle, giving this cinematic effect. But, it's not working properly.
The result: (The corners are fine, but as I'm approaching the middle, it goes horribly wrong)
The shader itself is rather simple:
struct VS_Output
{
float4 Pos : SV_POSITION;
float2 Tex : TEXCOORD0;
};
VS_Output VShader(uint id : SV_VertexID)
{
VS_Output Output;
Output.Tex = float2((id << 1) & 2, id & 2);
Output.Pos = float4(Output.Tex * float2(2,-2) + float2(-1,1), 0, 1);
return Output;
}
float4 PShader(VS_Output input) : SV_TARGET
{
float4 color = float4(0, 0, 0, 1);
float2 dist = input.Tex - 0.5f;
dist.x = 1 - dot(dist, dist);
color.a *= 1.0f - saturate(pow(dist.x, 5.5f));
return color;
}
PS. I hope I have given enough information to approach the issue.
Now what on earth have I done wrong?
-MIGI0027