diff options
author | 2013-05-19 21:53:08 +0000 | |
---|---|---|
committer | 2013-05-19 21:53:08 +0000 | |
commit | 675796fe23ce384197ffd0b9596687ce1cfcafbe (patch) | |
tree | 8fe52d13387a5b153db22ca94c4e282267dba765 /hlsl | |
parent | 1d3030a04ed27bb6abe9607d48e89995e59eb203 (diff) |
fix vector bloom, nw
Diffstat (limited to 'hlsl')
-rw-r--r-- | hlsl/bloom.fx | 42 | ||||
-rw-r--r-- | hlsl/downsample.fx | 31 | ||||
-rw-r--r-- | hlsl/vector.fx | 2 |
3 files changed, 29 insertions, 46 deletions
diff --git a/hlsl/bloom.fx b/hlsl/bloom.fx index aa856118e1b..2dd8ffbe2b7 100644 --- a/hlsl/bloom.fx +++ b/hlsl/bloom.fx @@ -189,16 +189,16 @@ VS_OUTPUT vs_main(VS_INPUT Input) float2 inversePixel = 1.0f / TargetSize; float2 TexCoord = Input.Position.xy * inversePixel + float2(0.5f, 0.5f) * inversePixel; Output.TexCoord01.xy = TexCoord; - Output.TexCoord01.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.5f; - Output.TexCoord23.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.25f; - Output.TexCoord23.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.125f; - Output.TexCoord45.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.0625f; - Output.TexCoord45.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.03125f; - Output.TexCoord67.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.015625f; - Output.TexCoord67.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.0078125f; - Output.TexCoord89.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.00390625f; - Output.TexCoord89.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.001953125f; - Output.TexCoordA = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 0.0009765625f; + Output.TexCoord01.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.5f; + Output.TexCoord23.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.25f; + Output.TexCoord23.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.125f; + Output.TexCoord45.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.0625f; + Output.TexCoord45.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.03125f; + Output.TexCoord67.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.015625f; + Output.TexCoord67.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.0078125f; + Output.TexCoord89.xy = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.00390625f; + Output.TexCoord89.zw = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.001953125f; + Output.TexCoordA = ((TexCoord - 0.5f) * 1.00f + 0.5f) * 1.0f;//0.0009765625f; return Output; } @@ -225,17 +225,17 @@ float4 ps_main(PS_INPUT Input) : COLOR float3 texel9 = tex2D(DiffuseSampler9, Input.TexCoord89.zw).rgb; float3 texelA = tex2D(DiffuseSamplerA, Input.TexCoordA).rgb; - texel0 = texel0 * Level0123Weight.x; // 1.0f; - texel1 = texel1 * Level0123Weight.y; // 0.21f; - texel2 = texel2 * Level0123Weight.z; // 0.19f; - texel3 = texel3 * Level0123Weight.w; // 0.17f; - texel4 = texel4 * Level4567Weight.x; // 0.15f; - texel5 = texel5 * Level4567Weight.y; // 0.14f; - texel6 = texel6 * Level4567Weight.z; // 0.13f; - texel7 = texel7 * Level4567Weight.w; // 0.12f; - texel8 = texel8 * Level89AWeight.x; // 0.11f; - texel9 = texel9 * Level89AWeight.y; // 0.10f; - texelA = texelA * Level89AWeight.z; // 0.09f; + texel0 = texel0 * Level0123Weight.x; + texel1 = texel1 * Level0123Weight.y; + texel2 = texel2 * Level0123Weight.z; + texel3 = texel3 * Level0123Weight.w; + texel4 = texel4 * Level4567Weight.x; + texel5 = texel5 * Level4567Weight.y; + texel6 = texel6 * Level4567Weight.z; + texel7 = texel7 * Level4567Weight.w; + texel8 = texel8 * Level89AWeight.x; + texel9 = texel9 * Level89AWeight.y; + texelA = texelA * Level89AWeight.z; float4 sum = float4(texel0 + texel1 + texel2 + texel3 + texel4 + texel5 + texel6 + texel7 + texel8 + texel9 + texelA, 1.0f); diff --git a/hlsl/downsample.fx b/hlsl/downsample.fx index 9a77d12d6ac..9dcaf7b90a0 100644 --- a/hlsl/downsample.fx +++ b/hlsl/downsample.fx @@ -25,9 +25,6 @@ struct VS_OUTPUT float4 Color : COLOR0; float4 TexCoord01 : TEXCOORD0; float4 TexCoord23 : TEXCOORD1; - float4 TexCoord45 : TEXCOORD2; - float4 TexCoord67 : TEXCOORD3; - float4 TexCoord89 : TEXCOORD4; }; struct VS_INPUT @@ -42,9 +39,6 @@ struct PS_INPUT float4 Color : COLOR0; float4 TexCoord01 : TEXCOORD0; float4 TexCoord23 : TEXCOORD1; - float4 TexCoord45 : TEXCOORD2; - float4 TexCoord67 : TEXCOORD3; - float4 TexCoord89 : TEXCOORD4; }; //----------------------------------------------------------------------------- @@ -53,6 +47,7 @@ struct PS_INPUT uniform float2 TargetSize; uniform float2 SourceSize; +uniform float BloomRescale; VS_OUTPUT vs_main(VS_INPUT Input) { @@ -64,17 +59,11 @@ VS_OUTPUT vs_main(VS_INPUT Input) Output.Position.xy -= 0.5f; Output.Position.xy *= 2.0f; Output.Color = Input.Color; - float2 inversePixel = 1.0f / TargetSize; - Output.TexCoord01.xy = Input.Position.xy * inversePixel + float2(0.00f + 0.5f, 0.00f + 0.5f) * inversePixel; - Output.TexCoord01.zw = Input.Position.xy * inversePixel + float2(0.50f + 0.5f, 0.00f + 0.5f) * inversePixel; - Output.TexCoord23.xy = Input.Position.xy * inversePixel + float2(0.25f + 0.5f, 0.25f + 0.5f) * inversePixel; - Output.TexCoord23.zw = Input.Position.xy * inversePixel + float2(0.50f + 0.5f, 0.25f + 0.5f) * inversePixel; - Output.TexCoord45.xy = Input.Position.xy * inversePixel + float2(0.75f + 0.5f, 0.25f + 0.5f) * inversePixel; - Output.TexCoord45.zw = Input.Position.xy * inversePixel + float2(0.00f + 0.5f, 0.50f + 0.5f) * inversePixel; - Output.TexCoord67.xy = Input.Position.xy * inversePixel + float2(0.50f + 0.5f, 0.50f + 0.5f) * inversePixel; - Output.TexCoord67.zw = Input.Position.xy * inversePixel + float2(0.00f + 0.5f, 0.75f + 0.5f) * inversePixel; - Output.TexCoord89.xy = Input.Position.xy * inversePixel + float2(0.25f + 0.5f, 0.75f + 0.5f) * inversePixel; - Output.TexCoord89.zw = Input.Position.xy * inversePixel + float2(0.75f + 0.5f, 0.75f + 0.5f) * inversePixel; + float2 inversePixel = 1.0f / SourceSize; + Output.TexCoord01.xy = Input.Position.xy * inversePixel + float2(0.5f, 0.5f) * inversePixel; + Output.TexCoord01.zw = Input.Position.xy * inversePixel + float2(1.5f, 0.5f) * inversePixel; + Output.TexCoord23.xy = Input.Position.xy * inversePixel + float2(0.5f, 1.5f) * inversePixel; + Output.TexCoord23.zw = Input.Position.xy * inversePixel + float2(1.5f, 1.5f) * inversePixel; return Output; } @@ -89,13 +78,7 @@ float4 ps_main(PS_INPUT Input) : COLOR float4 texel1 = tex2D(DiffuseSampler, Input.TexCoord01.zw); float4 texel2 = tex2D(DiffuseSampler, Input.TexCoord23.xy); float4 texel3 = tex2D(DiffuseSampler, Input.TexCoord23.zw); - float4 texel4 = tex2D(DiffuseSampler, Input.TexCoord45.xy); - float4 texel5 = tex2D(DiffuseSampler, Input.TexCoord45.zw); - float4 texel6 = tex2D(DiffuseSampler, Input.TexCoord67.xy); - float4 texel7 = tex2D(DiffuseSampler, Input.TexCoord67.zw); - float4 texel8 = tex2D(DiffuseSampler, Input.TexCoord89.xy); - float4 texel9 = tex2D(DiffuseSampler, Input.TexCoord89.zw); - float4 outTexel = (texel0 + texel1 + texel2 + texel3 + texel4 + texel5 + texel6 + texel7 + texel8 + texel9) * 0.1f; + float4 outTexel = (texel0 + texel1 + texel2 + texel3) * BloomRescale; return float4(outTexel.rgb, 1.0f); } diff --git a/hlsl/vector.fx b/hlsl/vector.fx index 8b9aa6333f3..e93d8dee4cf 100644 --- a/hlsl/vector.fx +++ b/hlsl/vector.fx @@ -68,7 +68,7 @@ float4 ps_main(PS_INPUT Input) : COLOR float lengthModulate = clamp(1.0f - LengthParams.x / LengthParams.z, 0.0f, 1.0f); lengthModulate = lerp(1.0f, timeModulate * lengthModulate, LengthParams.y) * 2.0; - float4 outColor = Input.Color * float4(lengthModulate, lengthModulate, lengthModulate, 1.0f) * 2.5; + float4 outColor = Input.Color * float4(lengthModulate, lengthModulate, lengthModulate, 1.0f) * 8.0; return outColor; } |