Separate versions of each shader are now more easily available for compilation
TODO: write up some way to share shader code and use platform-specific features
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
|
||||
#----------------------------- Global Properties ----------------------------#
|
||||
|
||||
/outputDir:bin/$(Platform)
|
||||
/intermediateDir:obj/$(Platform)
|
||||
/platform:DesktopGL
|
||||
/config:
|
||||
/profile:Reach
|
||||
/compress:False
|
||||
|
||||
#-------------------------------- References --------------------------------#
|
||||
|
||||
|
||||
#---------------------------------- Content ---------------------------------#
|
||||
|
||||
#begin watershader_opengl.fx
|
||||
/importer:EffectImporter
|
||||
/processor:EffectProcessor
|
||||
/processorParam:DebugMode=Auto
|
||||
/build:watershader_opengl.fx
|
||||
|
||||
#begin blurshader_opengl.fx
|
||||
/importer:EffectImporter
|
||||
/processor:EffectProcessor
|
||||
/processorParam:DebugMode=Auto
|
||||
/build:blurshader_opengl.fx
|
||||
|
||||
#begin damageshader_opengl.fx
|
||||
/importer:EffectImporter
|
||||
/processor:EffectProcessor
|
||||
/processorParam:DebugMode=Auto
|
||||
/build:damageshader_opengl.fx
|
||||
|
||||
#begin losshader_opengl.fx
|
||||
/importer:EffectImporter
|
||||
/processor:EffectProcessor
|
||||
/processorParam:DebugMode=Auto
|
||||
/build:losshader_opengl.fx
|
||||
|
||||
#begin utg_4.mp4
|
||||
/importer:H264Importer
|
||||
/processor:VideoProcessor
|
||||
/build:utg_4.mp4
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// Pixel shader applies a one dimensional gaussian blur filter.
|
||||
// This is used twice by the bloom postprocess, first to
|
||||
// blur horizontally, and then again to blur vertically.
|
||||
|
||||
sampler TextureSampler : register(s0);
|
||||
|
||||
#define SAMPLE_COUNT 15
|
||||
|
||||
float2 SampleOffsets[SAMPLE_COUNT];
|
||||
float SampleWeights[SAMPLE_COUNT];
|
||||
|
||||
|
||||
float4 PixelShaderF(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 c = 0;
|
||||
|
||||
// Combine a number of weighted image filter taps.
|
||||
for (int i = 0; i < SAMPLE_COUNT; i++)
|
||||
{
|
||||
c += tex2D(TextureSampler, texCoord + SampleOffsets[i]) * SampleWeights[i];
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
technique GaussianBlur
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
PixelShader = compile ps_2_0 PixelShaderF();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -34,6 +34,6 @@ technique StencilShader
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
PixelShader = compile ps_2_0 main();
|
||||
PixelShader = compile ps_4_0_level_9_1 main();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
Texture xTexture;
|
||||
sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; };
|
||||
|
||||
Texture xStencil;
|
||||
sampler StencilSampler = sampler_state { Texture = <xStencil>; };
|
||||
|
||||
float4 color;
|
||||
|
||||
float aCutoff;
|
||||
float aMultiplier;
|
||||
|
||||
float cCutoff;
|
||||
float cMultiplier;
|
||||
|
||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 c = tex2D(TextureSampler, texCoord) * color;
|
||||
|
||||
float4 stencilColor = tex2D(StencilSampler, texCoord);
|
||||
|
||||
float aDiff = stencilColor.a - aCutoff;
|
||||
|
||||
clip(aDiff);
|
||||
|
||||
float cDiff = stencilColor.a - cCutoff;
|
||||
|
||||
return float4(
|
||||
lerp(stencilColor.rgb, c.rgb, clamp(cDiff * cMultiplier, 0.0f, 1.0f)),
|
||||
min(aDiff * aMultiplier, c.a));
|
||||
}
|
||||
|
||||
technique StencilShader
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
PixelShader = compile ps_2_0 main();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -19,6 +19,6 @@ technique LosShader
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
PixelShader = compile ps_2_0 main();
|
||||
PixelShader = compile ps_4_0_level_9_1 main();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
Texture2D xTexture;
|
||||
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 losColor = tex2D(LosSampler, texCoord);
|
||||
float4 sample = tex2D(TextureSampler, texCoord);
|
||||
|
||||
float4 outColor = float4(sample.x*losColor.x, sample.y*losColor.x, sample.z*losColor.x, losColor.x);
|
||||
|
||||
return outColor;
|
||||
}
|
||||
|
||||
technique LosShader
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
PixelShader = compile ps_2_0 main();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,50 @@
|
||||
float xBlurDistance;
|
||||
|
||||
Texture xTexture;
|
||||
sampler TextureSampler = sampler_state { Texture = <xTexture>; };
|
||||
|
||||
Texture xWaterBumpMap;
|
||||
sampler WaterBumpSampler =
|
||||
sampler_state
|
||||
{
|
||||
Texture = <xWaterBumpMap>;
|
||||
MagFilter = LINEAR;
|
||||
MinFilter = LINEAR;
|
||||
MipFilter = LINEAR;
|
||||
AddressU = WRAP;
|
||||
AddressV = WRAP;
|
||||
};
|
||||
|
||||
float xWaveWidth;
|
||||
float xWaveHeight;
|
||||
float2 xWavePos;
|
||||
float2 xBumpPos;
|
||||
|
||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 bumpColor = tex2D(WaterBumpSampler, texCoord+xWavePos+xBumpPos);
|
||||
bumpColor = (bumpColor + tex2D(WaterBumpSampler, texCoord-xWavePos*2.0f+xBumpPos))*0.5f;
|
||||
|
||||
float2 samplePos = texCoord;
|
||||
|
||||
samplePos.x+=(bumpColor.r-0.5f)*xWaveWidth;
|
||||
samplePos.y+=(bumpColor.g-0.5f)*xWaveHeight;
|
||||
|
||||
float4 sample;
|
||||
sample = tex2D( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y+xBlurDistance));
|
||||
sample += tex2D( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y-xBlurDistance));
|
||||
sample += tex2D( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y-xBlurDistance));
|
||||
sample += tex2D( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y+xBlurDistance));
|
||||
|
||||
sample = sample * 0.25;
|
||||
|
||||
return sample;
|
||||
}
|
||||
|
||||
technique WaterShader
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
PixelShader = compile ps_2_0 main();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user