From 8b6d2f3cc1b5a66d0fa0409812449ded0a700113 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Sun, 4 Mar 2018 21:00:12 +0200 Subject: [PATCH] Updated OpenGL LOS shader --- .../Content/losshader_opengl.fx | 18 ++++++++++++------ .../Content/losshader_opengl.xnb | Bin 670 -> 794 bytes 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Content/losshader_opengl.fx b/Barotrauma/BarotraumaShared/Content/losshader_opengl.fx index cfa59e796..55e68fddc 100644 --- a/Barotrauma/BarotraumaShared/Content/losshader_opengl.fx +++ b/Barotrauma/BarotraumaShared/Content/losshader_opengl.fx @@ -6,12 +6,18 @@ Texture2D xLosTexture; sampler LosSampler = sampler_state { Texture = ; }; 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); - +{ + 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; } diff --git a/Barotrauma/BarotraumaShared/Content/losshader_opengl.xnb b/Barotrauma/BarotraumaShared/Content/losshader_opengl.xnb index 071bd901e53507b7ca740101a02f45dbac847b17..af566e9768b75a5e963b2f21361cdd8ca2b47476 100644 GIT binary patch delta 333 zcmbQoI*W}X!p|v%l|hPmB1emG7ZU@6ue)0W2g5Gk8E+UE8Q7U7&iBzt&d)0@Q7B7I zHc==jj!!mFumy884D}3j6bz6FP3ws-WhM(TiZL2a=4X_&FtX<5DoZS?%*;!N=r40C z%Fiot&d6ZUM?mEMn(o!pir?P z0|OHiglWVGWHYmihon}Nloq81C*~F?U$Sp`*;?`!~7VFVPZ<>lh#0y>z1ffZk`EBO`=q g$jHFJ#LUi75yGEZQBqoz3R1+tz|77)`2&*{07o}JUjP6A