From 9e5f28ba807c6e59df8539f1013e528085acb694 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 27 Sep 2020 12:59:56 -0400 Subject: [PATCH] CModelShaders: Check noZWrite for thermal depth test Adds back LightingAlphaWrite extended shader --- Runtime/Graphics/CModelBoo.cpp | 2 +- Runtime/Graphics/Shaders/CModelShaders.cpp | 12 ++++++++---- Runtime/Graphics/Shaders/CModelShaders.hpp | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Runtime/Graphics/CModelBoo.cpp b/Runtime/Graphics/CModelBoo.cpp index 64b9ea74a..6f0de5c38 100644 --- a/Runtime/Graphics/CModelBoo.cpp +++ b/Runtime/Graphics/CModelBoo.cpp @@ -578,7 +578,7 @@ static EExtendedShader ResolveExtendedShader(const MaterialSet::Material& data, if (intermediateExtended == EExtendedShader::Lighting) { /* Transform lighting into thermal cold if the thermal visor is active */ if (g_Renderer->IsThermalVisorHotPass()) - return EExtendedShader::LightingAlphaWriteNoZTest; + return noZWrite ? EExtendedShader::LightingAlphaWriteNoZTestNoZWrite : EExtendedShader::LightingAlphaWrite; else if (g_Renderer->IsThermalVisorActive()) return EExtendedShader::ThermalCold; if (data.blendMode == MaterialSet::Material::BlendMaterial::BlendMode::Opaque) { diff --git a/Runtime/Graphics/Shaders/CModelShaders.cpp b/Runtime/Graphics/Shaders/CModelShaders.cpp index 98fe30c16..3b185734a 100644 --- a/Runtime/Graphics/Shaders/CModelShaders.cpp +++ b/Runtime/Graphics/Shaders/CModelShaders.cpp @@ -80,7 +80,7 @@ constexpr std::array DisintegrateTextures{{ {TexCoordSource::Position, 1, false}, // Ashy tex }}; -static std::array g_ExtensionSlots{{ +static std::array g_ExtensionSlots{{ /* Default solid shading */ {}, /* Normal lit shading */ @@ -149,9 +149,12 @@ static std::array g_ExtensionSlots{{ /* Thermal cold shading */ {0, nullptr, hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Original, false, false, true, false, false, false, true}, - /* Normal lit shading with alpha without depth test */ + /* Normal lit shading with alpha */ {0, nullptr, hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original, - hecl::Backend::ZTest::None, hecl::Backend::CullMode::Backface}, + hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface}, + /* Normal lit shading with alpha without Z-write or depth test */ + {0, nullptr, hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original, + hecl::Backend::ZTest::None, hecl::Backend::CullMode::Backface, true}, /* Normal lit shading with cube reflection */ {0, nullptr, hecl::Backend::BlendFactor::Original, hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface, false, false, true}, @@ -160,7 +163,7 @@ static std::array g_ExtensionSlots{{ hecl::Backend::ZTest::Original, hecl::Backend::CullMode::Backface, false, false, true}, }}; -constexpr std::array ShaderMacros{ +constexpr std::array ShaderMacros{ "URDE_LIGHTING", "URDE_LIGHTING", "URDE_THERMAL_HOT", @@ -185,6 +188,7 @@ constexpr std::array ShaderMacros{ "URDE_LIGHTING", "URDE_THERMAL_COLD", "URDE_LIGHTING", + "URDE_LIGHTING", "URDE_LIGHTING_CUBE_REFLECTION", "URDE_LIGHTING_CUBE_REFLECTION_SHADOW", }; diff --git a/Runtime/Graphics/Shaders/CModelShaders.hpp b/Runtime/Graphics/Shaders/CModelShaders.hpp index 97f895106..22953feff 100644 --- a/Runtime/Graphics/Shaders/CModelShaders.hpp +++ b/Runtime/Graphics/Shaders/CModelShaders.hpp @@ -45,7 +45,8 @@ enum class EExtendedShader : uint8_t { Disintegrate, ForcedAdditiveNoZWriteDepthGreater, ThermalCold, - LightingAlphaWriteNoZTest, + LightingAlphaWrite, + LightingAlphaWriteNoZTestNoZWrite, LightingCubeReflection, LightingCubeReflectionWorldShadow, MAX