(f0d812055) v0.9.9.0
This commit is contained in:
@@ -19,11 +19,6 @@
|
||||
/processorParam:DebugMode=Auto
|
||||
/build:blurshader_opengl.fx
|
||||
|
||||
#begin Content_opengl.mgcb
|
||||
/importer:
|
||||
/processor:
|
||||
/build:Content_opengl.mgcb
|
||||
|
||||
#begin damageshader_opengl.fx
|
||||
/importer:EffectImporter
|
||||
/processor:EffectProcessor
|
||||
|
||||
@@ -10,7 +10,7 @@ float2 SampleOffsets[SAMPLE_COUNT];
|
||||
float SampleWeights[SAMPLE_COUNT];
|
||||
|
||||
|
||||
float4 PixelShaderF(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 PixelShaderF(float4 position : POSITION0, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 c = 0;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ float2 SampleOffsets[SAMPLE_COUNT];
|
||||
float SampleWeights[SAMPLE_COUNT];
|
||||
|
||||
|
||||
float4 PixelShaderF(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 PixelShaderF(float4 position : POSITION0, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 c = 0;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ float aMultiplier;
|
||||
float cCutoff;
|
||||
float cMultiplier;
|
||||
|
||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 main(float4 position : POSITION0, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 c = xTexture.Sample(TextureSampler, texCoord) * inColor;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ float aMultiplier;
|
||||
float cCutoff;
|
||||
float cMultiplier;
|
||||
|
||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 main(float4 position : POSITION0, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 c = tex2D(TextureSampler, texCoord) * inColor;
|
||||
|
||||
|
||||
@@ -18,14 +18,14 @@ float4 solidColor;
|
||||
|
||||
struct VertexShaderInput
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 Position : POSITION0;
|
||||
float4 Color : COLOR0;
|
||||
float2 TexCoords: TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VertexShaderOutput
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 Position : POSITION0;
|
||||
float4 Color : COLOR0;
|
||||
float2 TexCoords: TEXCOORD0;
|
||||
};
|
||||
|
||||
@@ -18,14 +18,14 @@ float4 solidColor;
|
||||
|
||||
struct VertexShaderInput
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 Position : POSITION0;
|
||||
float4 Color : COLOR0;
|
||||
float2 TexCoords: TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VertexShaderOutput
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 Position : POSITION0;
|
||||
float4 Color : COLOR0;
|
||||
float2 TexCoords: TEXCOORD0;
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@ float4 color2;
|
||||
float midPoint;
|
||||
float fadeDist;
|
||||
|
||||
float4 PixelShaderF(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 PixelShaderF(float4 position : POSITION0, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 t = tex2D(TextureSampler, texCoord);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ float4 color2;
|
||||
float midPoint;
|
||||
float fadeDist;
|
||||
|
||||
float4 PixelShaderF(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 PixelShaderF(float4 position : POSITION0, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 t = tex2D(TextureSampler, texCoord);
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
struct VertexShaderInput
|
||||
{
|
||||
float4 Position : POSITION0;
|
||||
float2 TexCoords: TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VertexShaderOutput
|
||||
{
|
||||
float4 Position : POSITION0;
|
||||
float2 TexCoords: TEXCOORD0;
|
||||
};
|
||||
|
||||
VertexShaderOutput mainVS(in VertexShaderInput input)
|
||||
{
|
||||
VertexShaderOutput output = (VertexShaderOutput)0;
|
||||
|
||||
output.Position = input.Position;
|
||||
output.TexCoords = input.TexCoords;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
Texture2D xTexture;
|
||||
sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; };
|
||||
@@ -5,17 +26,19 @@ sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; }
|
||||
Texture2D xLosTexture;
|
||||
sampler LosSampler = sampler_state { Texture = <xLosTexture>; };
|
||||
|
||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 xColor;
|
||||
|
||||
float4 mainPS(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float4 sampleColor = xTexture.Sample(TextureSampler, texCoord);
|
||||
float4 losColor = xLosTexture.Sample(LosSampler, texCoord);
|
||||
float4 sampleColor = xTexture.Sample(TextureSampler, input.TexCoords);
|
||||
float4 losColor = xLosTexture.Sample(LosSampler, input.TexCoords);
|
||||
|
||||
float obscureAmount = 1.0f - losColor.r;
|
||||
|
||||
float4 outColor = float4(
|
||||
sampleColor.r * color.r,
|
||||
sampleColor.g * color.g,
|
||||
sampleColor.b * color.b,
|
||||
sampleColor.r * xColor.r,
|
||||
sampleColor.g * xColor.g,
|
||||
sampleColor.b * xColor.b,
|
||||
obscureAmount);
|
||||
|
||||
return outColor;
|
||||
@@ -25,6 +48,7 @@ technique LosShader
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
PixelShader = compile ps_4_0_level_9_1 main();
|
||||
VertexShader = compile vs_4_0_level_9_1 mainVS();
|
||||
PixelShader = compile ps_4_0_level_9_1 mainPS();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
struct VertexShaderInput
|
||||
{
|
||||
float4 Position : POSITION0;
|
||||
float2 TexCoords: TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VertexShaderOutput
|
||||
{
|
||||
float4 Position : POSITION0;
|
||||
float2 TexCoords: TEXCOORD0;
|
||||
};
|
||||
|
||||
VertexShaderOutput mainVS(in VertexShaderInput input)
|
||||
{
|
||||
VertexShaderOutput output = (VertexShaderOutput)0;
|
||||
|
||||
output.Position = input.Position;
|
||||
output.TexCoords = input.TexCoords;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
Texture xTexture;
|
||||
sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; };
|
||||
@@ -5,17 +26,19 @@ sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; }
|
||||
Texture xLosTexture;
|
||||
sampler LosSampler = sampler_state { Texture = <xLosTexture>; };
|
||||
|
||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 xColor;
|
||||
|
||||
float4 mainPS(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float4 sampleColor = tex2D(TextureSampler, texCoord);
|
||||
float4 losColor = tex2D(LosSampler, texCoord);
|
||||
float4 sampleColor = tex2D(TextureSampler, input.TexCoords);
|
||||
float4 losColor = tex2D(LosSampler, input.TexCoords);
|
||||
|
||||
float obscureAmount = 1.0f - losColor.r;
|
||||
|
||||
float4 outColor = float4(
|
||||
sampleColor.r * color.r,
|
||||
sampleColor.g * color.g,
|
||||
sampleColor.b * color.b,
|
||||
sampleColor.r * xColor.r,
|
||||
sampleColor.g * xColor.g,
|
||||
sampleColor.b * xColor.b,
|
||||
obscureAmount);
|
||||
|
||||
return outColor;
|
||||
@@ -25,6 +48,7 @@ technique LosShader
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
PixelShader = compile ps_2_0 main();
|
||||
VertexShader = compile vs_2_0 mainVS();
|
||||
PixelShader = compile ps_2_0 mainPS();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,27 @@
|
||||
struct VertexShaderInput
|
||||
{
|
||||
float4 Position : POSITION0;
|
||||
float2 TexCoords: TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VertexShaderOutput
|
||||
{
|
||||
float4 Position : POSITION0;
|
||||
float2 TexCoords: TEXCOORD0;
|
||||
};
|
||||
|
||||
float4x4 MatrixTransform;
|
||||
|
||||
VertexShaderOutput mainVS(in VertexShaderInput input)
|
||||
{
|
||||
VertexShaderOutput output = (VertexShaderOutput)0;
|
||||
|
||||
output.Position = mul(input.Position, MatrixTransform);
|
||||
output.TexCoords = input.TexCoords;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
Texture2D xTexture;
|
||||
sampler TextureSampler = sampler_state { Texture = <xTexture>; };
|
||||
|
||||
@@ -32,84 +56,84 @@ float2 radialDistortion(float2 coord, float distortion)
|
||||
/*float4 sampleWithChromaticAberration(float2 samplePos)
|
||||
{
|
||||
return float4(
|
||||
tex2D(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.r)).r,
|
||||
tex2D(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.g)).g,
|
||||
tex2D(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.b)).b,
|
||||
xTexture.Sample(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.r)).r,
|
||||
xTexture.Sample(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.g)).g,
|
||||
xTexture.Sample(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.b)).b,
|
||||
1);
|
||||
}*/
|
||||
float3 sampleChannelsSeparately(float2 samplePosR, float2 samplePosG, float2 samplePosB)
|
||||
{
|
||||
return float3(
|
||||
tex2D(TextureSampler, samplePosR).r,
|
||||
tex2D(TextureSampler, samplePosG).g,
|
||||
tex2D(TextureSampler, samplePosB).b);
|
||||
xTexture.Sample(TextureSampler, samplePosR).r,
|
||||
xTexture.Sample(TextureSampler, samplePosG).g,
|
||||
xTexture.Sample(TextureSampler, samplePosB).b);
|
||||
}
|
||||
|
||||
float3 sampleWithChromaticAberration(float2 samplePos)
|
||||
{
|
||||
return float3(
|
||||
tex2D(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.r)).r,
|
||||
tex2D(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.g)).g,
|
||||
tex2D(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.b)).b);
|
||||
xTexture.Sample(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.r)).r,
|
||||
xTexture.Sample(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.g)).g,
|
||||
xTexture.Sample(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.b)).b);
|
||||
}
|
||||
|
||||
float4 blur(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 blur(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float4 sample;
|
||||
sample = tex2D(TextureSampler, float2(texCoord.x + blurDistance, texCoord.y + blurDistance));
|
||||
sample += tex2D(TextureSampler, float2(texCoord.x - blurDistance, texCoord.y - blurDistance));
|
||||
sample += tex2D(TextureSampler, float2(texCoord.x + blurDistance, texCoord.y - blurDistance));
|
||||
sample += tex2D(TextureSampler, float2(texCoord.x - blurDistance, texCoord.y + blurDistance));
|
||||
sample = xTexture.Sample(TextureSampler, float2(input.TexCoords.x + blurDistance, input.TexCoords.y + blurDistance));
|
||||
sample += xTexture.Sample(TextureSampler, float2(input.TexCoords.x - blurDistance, input.TexCoords.y - blurDistance));
|
||||
sample += xTexture.Sample(TextureSampler, float2(input.TexCoords.x + blurDistance, input.TexCoords.y - blurDistance));
|
||||
sample += xTexture.Sample(TextureSampler, float2(input.TexCoords.x - blurDistance, input.TexCoords.y + blurDistance));
|
||||
sample = sample * 0.25f;
|
||||
|
||||
return sample;
|
||||
}
|
||||
|
||||
float4 distort(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 distort(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float4 bumpColor = tex2D(DistortSampler, texCoord + distortUvOffset);
|
||||
bumpColor = (bumpColor + tex2D(DistortSampler, texCoord - distortUvOffset * 2.0f)) * 0.5f;
|
||||
float4 bumpColor = xDistortTexture.Sample(DistortSampler, input.TexCoords + distortUvOffset);
|
||||
bumpColor = (bumpColor + xDistortTexture.Sample(DistortSampler, input.TexCoords - distortUvOffset * 2.0f)) * 0.5f;
|
||||
|
||||
float2 samplePos = texCoord;
|
||||
float2 samplePos = input.TexCoords;
|
||||
|
||||
samplePos.x += (bumpColor.r - 0.5f) * distortScale.x;
|
||||
samplePos.y += (bumpColor.g - 0.5f) * distortScale.y;
|
||||
|
||||
return tex2D(TextureSampler, samplePos);
|
||||
return xTexture.Sample(TextureSampler, samplePos);
|
||||
}
|
||||
|
||||
float4 blurDistort(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 blurDistort(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float4 bumpColor = tex2D(DistortSampler, texCoord + distortUvOffset);
|
||||
bumpColor = (bumpColor + tex2D(DistortSampler, texCoord - distortUvOffset * 2.0f)) * 0.5f;
|
||||
float4 bumpColor = xDistortTexture.Sample(DistortSampler, input.TexCoords + distortUvOffset);
|
||||
bumpColor = (bumpColor + xDistortTexture.Sample(DistortSampler, input.TexCoords - distortUvOffset * 2.0f)) * 0.5f;
|
||||
|
||||
float2 samplePos = texCoord;
|
||||
float2 samplePos = input.TexCoords;
|
||||
|
||||
samplePos.x += (bumpColor.r - 0.5f) * distortScale.x;
|
||||
samplePos.y += (bumpColor.g - 0.5f) * distortScale.y;
|
||||
|
||||
float4 sample;
|
||||
sample = tex2D(TextureSampler, float2(samplePos.x + blurDistance, samplePos.y + blurDistance));
|
||||
sample += tex2D(TextureSampler, float2(samplePos.x - blurDistance, samplePos.y - blurDistance));
|
||||
sample += tex2D(TextureSampler, float2(samplePos.x + blurDistance, samplePos.y - blurDistance));
|
||||
sample += tex2D(TextureSampler, float2(samplePos.x - blurDistance, samplePos.y + blurDistance));
|
||||
sample = xTexture.Sample(TextureSampler, float2(samplePos.x + blurDistance, samplePos.y + blurDistance));
|
||||
sample += xTexture.Sample(TextureSampler, float2(samplePos.x - blurDistance, samplePos.y - blurDistance));
|
||||
sample += xTexture.Sample(TextureSampler, float2(samplePos.x + blurDistance, samplePos.y - blurDistance));
|
||||
sample += xTexture.Sample(TextureSampler, float2(samplePos.x - blurDistance, samplePos.y + blurDistance));
|
||||
|
||||
sample = sample * 0.25f;
|
||||
|
||||
return sample;
|
||||
}
|
||||
|
||||
float4 chromaticAberration(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 chromaticAberration(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
return float4(sampleWithChromaticAberration(texCoord), 1);
|
||||
return float4(sampleWithChromaticAberration(input.TexCoords), 1);
|
||||
}
|
||||
|
||||
float4 chromaticAberrationDistort(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 chromaticAberrationDistort(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float4 bumpColor = tex2D(DistortSampler, texCoord + distortUvOffset);
|
||||
bumpColor = (bumpColor + tex2D(DistortSampler, texCoord - distortUvOffset * 2.0f)) * 0.5f;
|
||||
float4 bumpColor = xDistortTexture.Sample(DistortSampler, input.TexCoords + distortUvOffset);
|
||||
bumpColor = (bumpColor + xDistortTexture.Sample(DistortSampler, input.TexCoords - distortUvOffset * 2.0f)) * 0.5f;
|
||||
|
||||
float2 samplePos = texCoord;
|
||||
float2 samplePos = input.TexCoords;
|
||||
|
||||
samplePos.x += (bumpColor.r - 0.5f) * distortScale.x;
|
||||
samplePos.y += (bumpColor.g - 0.5f) * distortScale.y;
|
||||
@@ -117,11 +141,11 @@ float4 chromaticAberrationDistort(float4 position : SV_Position, float4 color :
|
||||
return float4(sampleWithChromaticAberration(samplePos), 1);
|
||||
}
|
||||
|
||||
float4 blurChromaticAberration(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 blurChromaticAberration(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float2 samplePosR = radialDistortion(texCoord, chromaticAberrationStrength.r);
|
||||
float2 samplePosG = radialDistortion(texCoord, chromaticAberrationStrength.g);
|
||||
float2 samplePosB = radialDistortion(texCoord, chromaticAberrationStrength.b);
|
||||
float2 samplePosR = radialDistortion(input.TexCoords, chromaticAberrationStrength.r);
|
||||
float2 samplePosG = radialDistortion(input.TexCoords, chromaticAberrationStrength.g);
|
||||
float2 samplePosB = radialDistortion(input.TexCoords, chromaticAberrationStrength.b);
|
||||
|
||||
float2 blurTopLeft = -blurDistance;
|
||||
float2 blurTopRight = float2(blurDistance, -blurDistance);
|
||||
@@ -139,12 +163,12 @@ float4 blurChromaticAberration(float4 position : SV_Position, float4 color : COL
|
||||
return float4(sample, 1);
|
||||
}
|
||||
|
||||
float4 blurChromaticAberrationDistort(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 blurChromaticAberrationDistort(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float4 bumpColor = tex2D(DistortSampler, texCoord + distortUvOffset);
|
||||
bumpColor = (bumpColor + tex2D(DistortSampler, texCoord - distortUvOffset * 2.0f)) * 0.5f;
|
||||
float4 bumpColor = xDistortTexture.Sample(DistortSampler, input.TexCoords + distortUvOffset);
|
||||
bumpColor = (bumpColor + xDistortTexture.Sample(DistortSampler, input.TexCoords - distortUvOffset * 2.0f)) * 0.5f;
|
||||
|
||||
float2 samplePos = texCoord;
|
||||
float2 samplePos = input.TexCoords;
|
||||
|
||||
samplePos.x += (bumpColor.r - 0.5f) * distortScale.x;
|
||||
samplePos.y += (bumpColor.g - 0.5f) * distortScale.y;
|
||||
@@ -173,6 +197,7 @@ technique Distort
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
VertexShader = compile vs_4_0_level_9_1 mainVS();
|
||||
PixelShader = compile ps_4_0_level_9_1 distort();
|
||||
}
|
||||
}
|
||||
@@ -181,6 +206,7 @@ technique Blur
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
VertexShader = compile vs_4_0_level_9_1 mainVS();
|
||||
PixelShader = compile ps_4_0_level_9_1 blur();
|
||||
}
|
||||
}
|
||||
@@ -189,6 +215,7 @@ technique BlurDistort
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
VertexShader = compile vs_4_0_level_9_1 mainVS();
|
||||
PixelShader = compile ps_4_0_level_9_1 blurDistort();
|
||||
}
|
||||
}
|
||||
@@ -197,6 +224,7 @@ technique BlurChromaticAberration
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
VertexShader = compile vs_4_0_level_9_1 mainVS();
|
||||
PixelShader = compile ps_4_0_level_9_1 blurChromaticAberration();
|
||||
}
|
||||
}
|
||||
@@ -206,6 +234,7 @@ technique ChromaticAberration
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
VertexShader = compile vs_4_0_level_9_1 mainVS();
|
||||
PixelShader = compile ps_4_0_level_9_1 chromaticAberration();
|
||||
}
|
||||
}
|
||||
@@ -214,6 +243,7 @@ technique ChromaticAberrationDistort
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
VertexShader = compile vs_4_0_level_9_1 mainVS();
|
||||
PixelShader = compile ps_4_0_level_9_1 chromaticAberrationDistort();
|
||||
}
|
||||
}
|
||||
@@ -222,6 +252,7 @@ technique BlurChromaticAberrationDistort
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
VertexShader = compile vs_4_0_level_9_1 mainVS();
|
||||
PixelShader = compile ps_4_0_level_9_1 blurChromaticAberrationDistort();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,31 @@
|
||||
Texture2D xTexture;
|
||||
struct VertexShaderInput
|
||||
{
|
||||
float4 Position : POSITION0;
|
||||
float2 TexCoords: TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VertexShaderOutput
|
||||
{
|
||||
float4 Position : POSITION0;
|
||||
float2 TexCoords: TEXCOORD0;
|
||||
};
|
||||
|
||||
float4x4 MatrixTransform;
|
||||
|
||||
VertexShaderOutput mainVS(in VertexShaderInput input)
|
||||
{
|
||||
VertexShaderOutput output = (VertexShaderOutput)0;
|
||||
|
||||
output.Position = mul(input.Position, MatrixTransform);
|
||||
output.TexCoords = input.TexCoords;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
Texture xTexture;
|
||||
sampler TextureSampler = sampler_state { Texture = <xTexture>; };
|
||||
|
||||
Texture2D xDistortTexture;
|
||||
Texture xDistortTexture;
|
||||
sampler DistortSampler =
|
||||
sampler_state
|
||||
{
|
||||
@@ -53,24 +77,24 @@ float3 sampleWithChromaticAberration(float2 samplePos)
|
||||
tex2D(TextureSampler, radialDistortion(samplePos, chromaticAberrationStrength.b)).b);
|
||||
}
|
||||
|
||||
float4 blur(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 blur(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float4 sample;
|
||||
sample = tex2D(TextureSampler, float2(texCoord.x + blurDistance, texCoord.y + blurDistance));
|
||||
sample += tex2D(TextureSampler, float2(texCoord.x - blurDistance, texCoord.y - blurDistance));
|
||||
sample += tex2D(TextureSampler, float2(texCoord.x + blurDistance, texCoord.y - blurDistance));
|
||||
sample += tex2D(TextureSampler, float2(texCoord.x - blurDistance, texCoord.y + blurDistance));
|
||||
sample = tex2D(TextureSampler, float2(input.TexCoords.x + blurDistance, input.TexCoords.y + blurDistance));
|
||||
sample += tex2D(TextureSampler, float2(input.TexCoords.x - blurDistance, input.TexCoords.y - blurDistance));
|
||||
sample += tex2D(TextureSampler, float2(input.TexCoords.x + blurDistance, input.TexCoords.y - blurDistance));
|
||||
sample += tex2D(TextureSampler, float2(input.TexCoords.x - blurDistance, input.TexCoords.y + blurDistance));
|
||||
sample = sample * 0.25f;
|
||||
|
||||
return sample;
|
||||
}
|
||||
|
||||
float4 distort(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 distort(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float4 bumpColor = tex2D(DistortSampler, texCoord + distortUvOffset);
|
||||
bumpColor = (bumpColor + tex2D(DistortSampler, texCoord - distortUvOffset * 2.0f)) * 0.5f;
|
||||
float4 bumpColor = tex2D(DistortSampler, input.TexCoords + distortUvOffset);
|
||||
bumpColor = (bumpColor + tex2D(DistortSampler, input.TexCoords - distortUvOffset * 2.0f)) * 0.5f;
|
||||
|
||||
float2 samplePos = texCoord;
|
||||
float2 samplePos = input.TexCoords;
|
||||
|
||||
samplePos.x += (bumpColor.r - 0.5f) * distortScale.x;
|
||||
samplePos.y += (bumpColor.g - 0.5f) * distortScale.y;
|
||||
@@ -78,12 +102,12 @@ float4 distort(float4 position : SV_Position, float4 color : COLOR0, float2 texC
|
||||
return tex2D(TextureSampler, samplePos);
|
||||
}
|
||||
|
||||
float4 blurDistort(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 blurDistort(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float4 bumpColor = tex2D(DistortSampler, texCoord + distortUvOffset);
|
||||
bumpColor = (bumpColor + tex2D(DistortSampler, texCoord - distortUvOffset * 2.0f)) * 0.5f;
|
||||
float4 bumpColor = tex2D(DistortSampler, input.TexCoords + distortUvOffset);
|
||||
bumpColor = (bumpColor + tex2D(DistortSampler, input.TexCoords - distortUvOffset * 2.0f)) * 0.5f;
|
||||
|
||||
float2 samplePos = texCoord;
|
||||
float2 samplePos = input.TexCoords;
|
||||
|
||||
samplePos.x += (bumpColor.r - 0.5f) * distortScale.x;
|
||||
samplePos.y += (bumpColor.g - 0.5f) * distortScale.y;
|
||||
@@ -99,17 +123,17 @@ float4 blurDistort(float4 position : SV_Position, float4 color : COLOR0, float2
|
||||
return sample;
|
||||
}
|
||||
|
||||
float4 chromaticAberration(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 chromaticAberration(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
return float4(sampleWithChromaticAberration(texCoord), 1);
|
||||
return float4(sampleWithChromaticAberration(input.TexCoords), 1);
|
||||
}
|
||||
|
||||
float4 chromaticAberrationDistort(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 chromaticAberrationDistort(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float4 bumpColor = tex2D(DistortSampler, texCoord + distortUvOffset);
|
||||
bumpColor = (bumpColor + tex2D(DistortSampler, texCoord - distortUvOffset * 2.0f)) * 0.5f;
|
||||
float4 bumpColor = tex2D(DistortSampler, input.TexCoords + distortUvOffset);
|
||||
bumpColor = (bumpColor + tex2D(DistortSampler, input.TexCoords - distortUvOffset * 2.0f)) * 0.5f;
|
||||
|
||||
float2 samplePos = texCoord;
|
||||
float2 samplePos = input.TexCoords;
|
||||
|
||||
samplePos.x += (bumpColor.r - 0.5f) * distortScale.x;
|
||||
samplePos.y += (bumpColor.g - 0.5f) * distortScale.y;
|
||||
@@ -117,11 +141,11 @@ float4 chromaticAberrationDistort(float4 position : SV_Position, float4 color :
|
||||
return float4(sampleWithChromaticAberration(samplePos), 1);
|
||||
}
|
||||
|
||||
float4 blurChromaticAberration(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 blurChromaticAberration(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float2 samplePosR = radialDistortion(texCoord, chromaticAberrationStrength.r);
|
||||
float2 samplePosG = radialDistortion(texCoord, chromaticAberrationStrength.g);
|
||||
float2 samplePosB = radialDistortion(texCoord, chromaticAberrationStrength.b);
|
||||
float2 samplePosR = radialDistortion(input.TexCoords, chromaticAberrationStrength.r);
|
||||
float2 samplePosG = radialDistortion(input.TexCoords, chromaticAberrationStrength.g);
|
||||
float2 samplePosB = radialDistortion(input.TexCoords, chromaticAberrationStrength.b);
|
||||
|
||||
float2 blurTopLeft = -blurDistance;
|
||||
float2 blurTopRight = float2(blurDistance, -blurDistance);
|
||||
@@ -139,12 +163,12 @@ float4 blurChromaticAberration(float4 position : SV_Position, float4 color : COL
|
||||
return float4(sample, 1);
|
||||
}
|
||||
|
||||
float4 blurChromaticAberrationDistort(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 blurChromaticAberrationDistort(VertexShaderOutput input) : COLOR0
|
||||
{
|
||||
float4 bumpColor = tex2D(DistortSampler, texCoord + distortUvOffset);
|
||||
bumpColor = (bumpColor + tex2D(DistortSampler, texCoord - distortUvOffset * 2.0f)) * 0.5f;
|
||||
float4 bumpColor = tex2D(DistortSampler, input.TexCoords + distortUvOffset);
|
||||
bumpColor = (bumpColor + tex2D(DistortSampler, input.TexCoords - distortUvOffset * 2.0f)) * 0.5f;
|
||||
|
||||
float2 samplePos = texCoord;
|
||||
float2 samplePos = input.TexCoords;
|
||||
|
||||
samplePos.x += (bumpColor.r - 0.5f) * distortScale.x;
|
||||
samplePos.y += (bumpColor.g - 0.5f) * distortScale.y;
|
||||
@@ -173,6 +197,7 @@ technique Distort
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
VertexShader = compile vs_3_0 mainVS();
|
||||
PixelShader = compile ps_3_0 distort();
|
||||
}
|
||||
}
|
||||
@@ -181,6 +206,7 @@ technique Blur
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
VertexShader = compile vs_3_0 mainVS();
|
||||
PixelShader = compile ps_3_0 blur();
|
||||
}
|
||||
}
|
||||
@@ -189,6 +215,7 @@ technique BlurDistort
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
VertexShader = compile vs_3_0 mainVS();
|
||||
PixelShader = compile ps_3_0 blurDistort();
|
||||
}
|
||||
}
|
||||
@@ -197,6 +224,7 @@ technique BlurChromaticAberration
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
VertexShader = compile vs_3_0 mainVS();
|
||||
PixelShader = compile ps_3_0 blurChromaticAberration();
|
||||
}
|
||||
}
|
||||
@@ -206,6 +234,7 @@ technique ChromaticAberration
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
VertexShader = compile vs_3_0 mainVS();
|
||||
PixelShader = compile ps_3_0 chromaticAberration();
|
||||
}
|
||||
}
|
||||
@@ -214,6 +243,7 @@ technique ChromaticAberrationDistort
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
VertexShader = compile vs_3_0 mainVS();
|
||||
PixelShader = compile ps_3_0 chromaticAberrationDistort();
|
||||
}
|
||||
}
|
||||
@@ -222,6 +252,7 @@ technique BlurChromaticAberrationDistort
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
VertexShader = compile vs_3_0 mainVS();
|
||||
PixelShader = compile ps_3_0 blurChromaticAberrationDistort();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ sampler TextureSampler = sampler_state { Texture = <xTexture>; };
|
||||
float blurDistance;
|
||||
float4 color;
|
||||
|
||||
float4 solidColor(float4 position : SV_Position, float4 clr : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 solidColor(float4 position : POSITION0, float4 clr : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float a = tex2D(TextureSampler, texCoord).a;
|
||||
return color * a;
|
||||
}
|
||||
|
||||
float4 solidColorBlur(float4 position : SV_Position, float4 clr : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 solidColorBlur(float4 position : POSITION0, float4 clr : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float sample;
|
||||
sample = tex2D(TextureSampler, float2(texCoord.x + blurDistance, texCoord.y + blurDistance)).a;
|
||||
|
||||
@@ -4,13 +4,13 @@ sampler TextureSampler = sampler_state { Texture = <xTexture>; };
|
||||
float blurDistance;
|
||||
float4 color;
|
||||
|
||||
float4 solidColor(float4 position : SV_Position, float4 clr : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 solidColor(float4 position : POSITION0, float4 clr : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float a = tex2D(TextureSampler, texCoord).a;
|
||||
return color * a;
|
||||
}
|
||||
|
||||
float4 solidColorBlur(float4 position : SV_Position, float4 clr : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 solidColorBlur(float4 position : POSITION0, float4 clr : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float sample;
|
||||
sample = tex2D(TextureSampler, float2(texCoord.x + blurDistance, texCoord.y + blurDistance)).a;
|
||||
|
||||
@@ -20,14 +20,14 @@ float4x4 xUvTransform;
|
||||
|
||||
struct VertexShaderInput
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 Position : POSITION0;
|
||||
float4 Color : COLOR0;
|
||||
float2 TexCoords: TEXCOORD0; // added
|
||||
};
|
||||
|
||||
struct VertexShaderOutput
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 Position : POSITION0;
|
||||
float4 Color : COLOR0;
|
||||
float2 TexCoords: TEXCOORD0; // added
|
||||
};
|
||||
@@ -95,7 +95,7 @@ float4 mainPSBlurred(VertexShaderOutput input) : COLOR
|
||||
return sample;
|
||||
}
|
||||
|
||||
float4 mainPostProcess(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 mainPostProcess(float4 position : POSITION0, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 bumpColor = tex2D(WaterBumpSampler, texCoord + xUvOffset + xBumpPos);
|
||||
bumpColor = (bumpColor + tex2D(WaterBumpSampler, texCoord - xUvOffset * 2.0f + xBumpPos)) * 0.5f;
|
||||
|
||||
@@ -20,14 +20,14 @@ float4x4 xUvTransform;
|
||||
|
||||
struct VertexShaderInput
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 Position : POSITION0;
|
||||
float4 Color : COLOR0;
|
||||
float2 TexCoords: TEXCOORD0; // added
|
||||
};
|
||||
|
||||
struct VertexShaderOutput
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float4 Position : POSITION0;
|
||||
float4 Color : COLOR0;
|
||||
float2 TexCoords: TEXCOORD0; // added
|
||||
};
|
||||
@@ -102,7 +102,7 @@ float4 mainPSBlurred(VertexShaderOutput input) : COLOR
|
||||
return sample;
|
||||
}
|
||||
|
||||
float4 mainPostProcess(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
float4 mainPostProcess(float4 position : POSITION0, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 bumpColor = tex2D(WaterBumpSampler, texCoord + xUvOffset + xBumpPos);
|
||||
bumpColor = (bumpColor + tex2D(WaterBumpSampler, texCoord - xUvOffset * 2.0f + xBumpPos)) * 0.5f;
|
||||
|
||||
Reference in New Issue
Block a user