Files
LuaCsForBarotraumaEP/Barotrauma/BarotraumaShared/Content/losshader.fx
T
Joonas Rikkonen da7ea779b7 LOS effect optimization/changes:
- Rendering the shadows instead of light volumes to avoid the expensive raycasts needed to calculate the light volume.
- The LOS shadows are now rendered in two passes (fully obscured + penumbra) instead of each convex hull taking up 2 passes.

TODO: fix linux
2018-03-03 21:57:36 +02:00

31 lines
729 B
HLSL

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 sampleColor = xTexture.Sample(TextureSampler, texCoord);
float4 losColor = xLosTexture.Sample(LosSampler, texCoord);
float obscureAmount = 1.0f - losColor.r;
float4 outColor = float4(
sampleColor.r * color.r,
sampleColor.g * color.g,
sampleColor.b * color.b,
obscureAmount);
return outColor;
}
technique LosShader
{
pass Pass1
{
PixelShader = compile ps_4_0_level_9_1 main();
}
}