From d15d53c728b4848e3ed74d66b9ab446811e1acee Mon Sep 17 00:00:00 2001 From: ImJezze Date: Sun, 7 Feb 2016 13:40:24 +0100 Subject: Fixed Bloom Level Alignment - fixed target dimensions of bloom levels, which results in a much better alignment especially for game with very low resolution (therefore current bloom settings might look a little less intense than before) - small cleanups (nw) --- hlsl/downsample.fx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'hlsl/downsample.fx') diff --git a/hlsl/downsample.fx b/hlsl/downsample.fx index 122172350f9..6cb18f53935 100644 --- a/hlsl/downsample.fx +++ b/hlsl/downsample.fx @@ -57,6 +57,11 @@ uniform float2 SourceRect; uniform bool PrepareVector; +static const float2 Coord0Offset = float2(-0.5f, -0.5f); +static const float2 Coord1Offset = float2( 0.5f, -0.5f); +static const float2 Coord2Offset = float2(-0.5f, 0.5f); +static const float2 Coord3Offset = float2( 0.5f, 0.5f); + VS_OUTPUT vs_main(VS_INPUT Input) { VS_OUTPUT Output = (VS_OUTPUT)0; @@ -72,14 +77,12 @@ VS_OUTPUT vs_main(VS_INPUT Input) Output.Color = Input.Color; float2 TexCoord = Input.Position.xy / ScreenDims; - TexCoord += PrepareVector - ? 0.5f / TargetDims // half texel offset correction (DX9) - only for vector grpahics - : 0.0f; - - Output.TexCoord01.xy = TexCoord + float2(-0.5f, -0.5f) * TargetTexelDims; - Output.TexCoord01.zw = TexCoord + float2( 0.5f, -0.5f) * TargetTexelDims; - Output.TexCoord23.xy = TexCoord + float2(-0.5f, 0.5f) * TargetTexelDims; - Output.TexCoord23.zw = TexCoord + float2( 0.5f, 0.5f) * TargetTexelDims; + TexCoord += 0.5f / TargetDims; // half texel offset correction (DX9) + + Output.TexCoord01.xy = TexCoord + Coord0Offset * TargetTexelDims; + Output.TexCoord01.zw = TexCoord + Coord1Offset * TargetTexelDims; + Output.TexCoord23.xy = TexCoord + Coord2Offset * TargetTexelDims; + Output.TexCoord23.zw = TexCoord + Coord3Offset * TargetTexelDims; return Output; } -- cgit v1.2.3-70-g09d2