diff --git a/binary/src/flex_renderer.cpp b/binary/src/flex_renderer.cpp index 948d73f..6736425 100644 --- a/binary/src/flex_renderer.cpp +++ b/binary/src/flex_renderer.cpp @@ -28,7 +28,7 @@ IMesh* _build_water_anisotropy(int id, FlexRendererThreadData data) { // Frustrum culling Vector4D dst; Vector4DMultiply(data.view_projection_matrix, Vector4D(particle_pos.x, particle_pos.y, particle_pos.z, 1), dst); - if (dst.z < 0 || -dst.x - dst.w > data.radius || dst.x - dst.w > data.radius || -dst.y - dst.w > data.radius || dst.y - dst.w > data.radius) continue; + if (dst.z < data.radius || -dst.x - dst.w > data.radius || dst.x - dst.w > data.radius || -dst.y - dst.w > data.radius || dst.y - dst.w > data.radius) continue; // PVS Culling if (!engine->IsBoxVisible(particle_pos, particle_pos)) continue; diff --git a/binary/src/shaders/GWaterNormals.h b/binary/src/shaders/GWaterNormals.h index cb95059..86095ab 100644 --- a/binary/src/shaders/GWaterNormals.h +++ b/binary/src/shaders/GWaterNormals.h @@ -26,7 +26,7 @@ SHADER_FALLBACK{ SHADER_DRAW { SHADOW_STATE { pShaderShadow->VertexShaderVertexFormat(VERTEX_GWATER2, 1, 0, 0); - //pShaderShadow->EnableAlphaWrites(true); + pShaderShadow->EnableAlphaWrites(true); // we write to the alpha channel DECLARE_STATIC_VERTEX_SHADER(GWaterNormals_vs30); SET_STATIC_VERTEX_SHADER(GWaterNormals_vs30); diff --git a/binary/src/shaders/GWaterSmooth.h b/binary/src/shaders/GWaterSmooth.h index 0a3843f..6b6f1be 100644 --- a/binary/src/shaders/GWaterSmooth.h +++ b/binary/src/shaders/GWaterSmooth.h @@ -34,6 +34,7 @@ SHADER_DRAW { pShaderShadow->VertexShaderVertexFormat(flags, 1, 0, 0); pShaderShadow->EnableTexture(SHADER_SAMPLER0, true); pShaderShadow->EnableTexture(SHADER_SAMPLER1, true); + pShaderShadow->EnableAlphaWrites(true); // We use and update the alpha channel DECLARE_STATIC_VERTEX_SHADER(GWaterVolumetric_vs30); SET_STATIC_VERTEX_SHADER(GWaterVolumetric_vs30); diff --git a/lua/gwater2_shaders.lua b/lua/gwater2_shaders.lua index 21490c0..2173616 100644 --- a/lua/gwater2_shaders.lua +++ b/lua/gwater2_shaders.lua @@ -64,7 +64,6 @@ hook.Add("PostDrawOpaqueRenderables", "gwater2_render", function(depth, sky, sky render.ClearRenderTarget(cache_depth, Color(0, 0, 0, 0)) render.ClearRenderTarget(cache_absorption, Color(0, 0, 0, 0)) render.ClearRenderTarget(cache_bloom, Color(0, 0, 0, 0)) - render.OverrideAlphaWriteEnable(true, true) -- TODO(?): do this internally in shader shadow/dynamic state -- cached variables local scrw = ScrW() @@ -163,9 +162,7 @@ hook.Add("PostDrawOpaqueRenderables", "gwater2_render", function(depth, sky, sky water:SetTexture("$depthtexture", cache_absorption) render.SetMaterial(water) gwater2.renderer:DrawWater() - render.RenderFlashlights( function() gwater2.renderer:DrawWater() end ) - - render.OverrideAlphaWriteEnable(false, false) + render.RenderFlashlights(function() gwater2.renderer:DrawWater() end) render.SetMaterial(water_mist) gwater2.renderer:DrawDiffuse()