From 0b6afdf69ce2feb437fbc1fc649a94ded554dcf4 Mon Sep 17 00:00:00 2001 From: stm <14291421+stephanmeesters@users.noreply.github.com> Date: Sat, 27 Jun 2026 16:18:11 +0200 Subject: [PATCH] perf: Render ground-aligned particles without sorting --- Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp b/Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp index bd7f2c9a84e..82b381219f1 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/pointgr.cpp @@ -926,8 +926,14 @@ void PointGroupClass::Render(RenderInfoClass &rinfo) DX8Wrapper::Set_Shader(Shader); DX8Wrapper::Set_Texture(0,Texture); + // TheSuperHackers @perf stephanmeesters 27/06/2026 // Enable sorting if the primitives are translucent and alpha testing is not enabled. - const bool sort = (Shader.Get_Dst_Blend_Func() != ShaderClass::DSTBLEND_ZERO) && (Shader.Get_Alpha_Test() == ShaderClass::ALPHATEST_DISABLE) && (WW3D::Is_Sorting_Enabled()); + // However, do not apply sorting for ground-aligned (i.e. non-billboard) particles. + // This is for performance reasons and because ground-aligned particles do not generally benefit from back-to-front sorting. + const bool sort = Billboard && + (Shader.Get_Dst_Blend_Func() != ShaderClass::DSTBLEND_ZERO) && + (Shader.Get_Alpha_Test() == ShaderClass::ALPHATEST_DISABLE) && + (WW3D::Is_Sorting_Enabled()); IndexBufferClass *indexbuffer; int verticesperprimitive;/// lorenzen fixed