Files
LuaCsForBarotraumaEP/Barotrauma/BarotraumaClient/Shaders/damageshader_opengl.fx
T
Markus Isberg 9470edead3 Build 1.1.4.0
2023-03-31 18:40:44 +03:00

60 lines
1.3 KiB
HLSL

Texture xTexture;
sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; };
Texture xStencil;
sampler StencilSampler = sampler_state { Texture = <xStencil>; };
float4 solidColor;
float4 inColor;
float aCutoff;
float aMultiplier;
float cCutoff;
float cMultiplier;
float4 main(float4 position : POSITION0, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{
float4 c = tex2D(TextureSampler, texCoord) * inColor;
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));
}
float4 solidColorStencil(float4 position : POSITION0, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{
float4 c = tex2D(TextureSampler, texCoord) * inColor;
float4 stencilColor = tex2D(StencilSampler, texCoord);
float aDiff = stencilColor.a - aCutoff;
clip(aDiff);
return float4(solidColor.rgb, solidColor.a * min(aDiff * aMultiplier, c.a));
}
technique StencilShader
{
pass Pass1
{
PixelShader = compile ps_2_0 main();
}
}
technique StencilShaderSolidColor
{
pass Pass1
{
PixelShader = compile ps_2_0 solidColorStencil();
}
}