fix(shadows): fix fog of war, black infantry, and building shadows#165
Merged
Conversation
Backport Zero Hour's static map-wide shroud texture behavior to the Generals base game. This prevents DXVK dynamic offset matrix sampling out-of-bounds under Vulkan/MoltenVK. Also make SDL3GameEngine audio inclusions mutually exclusive to avoid type redefinition conflicts when both OpenAL and MiniAudio options are present in the cache. Fixes #88
Resolve redefinition conflicts in FFmpegVideoPlayer when both SAGE_USE_MINIAUDIO and SAGE_USE_OPENAL are defined in the CMake cache. This ensures the primary MiniAudio backend takes precedence.
Backport Zero Hour check to W3DVolumetricShadow::initFromHLOD to skip volumetric shadow generation for skin meshes. Infantries are skin meshes, and generating stencil shadow volumes on the CPU for animated skeletal models is incorrect and causes infantry to render as solid black silhouettes under MoltenVK/DXVK.
Skeletal animated hierarchies (like infantry) cannot accurately project CPU shadow volumes. In the base game under MoltenVK/Vulkan/DXVK, attempting to cast volumetric shadows on bone-attached rigid sub-meshes of a skinned model (like the GLA Worker's torso/vest) leaves the stencil/GPU state broken, rendering them as solid black silhouettes. Checking the entire HLOD for skinned meshes and skipping volumetric shadow geometry generation for the whole hierarchy resolves this rendering bug, allowing them to fallback to projected/decal shadows exactly as in Zero Hour. Fixes #88
TheDisplay->step() and TheDisplay->draw() were being called redundantly in GameEngine::execute() in addition to the call already dispatched via TheGameClient->update(). This caused a double-presentation per frame loop iteration, resulting in: - Incorrect FPS calculations (e.g. 170 FPS on 170Hz monitor) - Game logic and animations running at twice normal speed Removing the extra draw call aligns the base game main loop with Zero Hour (GeneralsMD), which did not have this duplicate call. Correct 30 FPS cap and game speed are now restored. // GeneralsX @BugFix MrMeeseeks 17/06/2026
…in initFromMesh initFromHLOD already skipped skinned sub-meshes (CNC3/gth comment at line 651). initFromMesh had no equivalent guard, meaning a standalone MeshClass with the SKIN flag could still enter the CPU shadow volume pipeline, potentially corrupting the stencil state under DXVK/Vulkan. Add SKIN flag check to initFromMesh, mirroring the existing HLOD behavior, matching the fix already applied to the Generals base game in W3DVolumetricShadow.cpp. // GeneralsX @BugFix Mr. Meeseeks 17/06/2026
- Record ZH initFromMesh SKIN guard fix in 2026-06-DIARY.md - Document diffuse=0 audit findings (BaseHeightMap is intentional) - Update INFANTRY_SHADOW_FIX_SUMMARY.md with completed follow-up actions, current clean state, and updated smoke test checklist
… bug in W3DProjectedShadow.cpp causing black square building shadows and black infantry in Generals base game.
The building shadow alpha decal combined with the SHADOW_DECAL flag produced bitmask values (e.g. 0x21) that failed exact enum switch/equality matching in flushDecals, updateShadowNumbers, renderShadows, and updateTexture. Replace exact equality checks with bitwise AND checks to correctly route and render alpha-blended/additive-blended decals and projection updates.
- Clamps scaled ambient and diffuse colors for infantry to 1.0f in W3DScene.cpp - Fixes initialization of lastShadowDecalTexture and lastShadowType in W3DProjectedShadow.cpp loops - Flag animated caster shadows as dynamic projected shadows in addShadow - Support SHADOW_ALPHA_DECAL and SHADOW_ADDITIVE_DECAL type checks in addShadow Closes #88
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses visual issues with terrain Fog of War, infantry rendering, and building shadows in the base game on macOS/Vulkan.
Closes #88
Changes
W3DShroud.cppto prevent texture coordinate coordinate out-of-bounds under Vulkan/DXVK.0xFFFFFFFF(white) when mesh diffuse color is null, resolving GLA Worker pitch-black torso rendering.FALSEininitFromMeshandinitFromHLODfor skinned meshes so they do not enter CPU volumetric stencil shadow generation and corrupt the stencil pipeline.(1.0f, 1.0f, 1.0f)usingVector3::Cap_Absolute_ToinW3DScene.cppto prevent Vulkan/DXVK shader overflows.W3DProjectedShadow.cpp.SHADOW_DYNAMIC_PROJECTIONflags on animated shadow casters.SHADOW_ALPHA_DECALandSHADOW_ADDITIVE_DECALas valid decal shadows insideaddShadow.