fix(TerrainShadows): clear stale heightmap cache on worldspace transitions#1676
fix(TerrainShadows): clear stale heightmap cache on worldspace transitions#1676Copilot wants to merge 4 commits into
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
…ithout heightmap - Clear cachedHeightmap, texHeightMap, and texShadowHeight when: - No worldspace is active - Current worldspace has no heightmap - Worldspace has interior-like flags (kNoSky or kFixedDimensions) - Add debug UI info showing interior-like flag, cached heightmap, and ready state - Prevents stale heightmap data from previous worldspace causing broken shadows in Markarth and similar locations Co-authored-by: alandtse <7086117+alandtse@users.noreply.github.com>
Co-authored-by: alandtse <7086117+alandtse@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes terrain shadow rendering artifacts in Markarth and similar worldspaces by clearing stale heightmap cache during worldspace transitions. Previously, the cache persisted when entering worldspaces without heightmaps or with interior-like characteristics, causing shadows to render with incorrect terrain data from previous worldspaces.
Key Changes:
- Clear heightmap cache (
cachedHeightmap,texHeightMap,texShadowHeight) when entering worldspaces without heightmaps or with interior-like flags (kNoSky,kFixedDimensions) - Add debug UI diagnostics showing interior-like flag status, cached heightmap worldspace, and heightmap ready state
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Features/TerrainShadows.cpp | Added cache invalidation logic for worldspaces without heightmaps or with interior-like flags, and enhanced debug UI with additional diagnostic information |
| _codeql_detected_source_root | CodeQL configuration file addition (not a functional code change) |
- Remove _codeql_detected_source_root symlink created during security scan - Add _codeql_detected_source_root to .gitignore to prevent future commits Co-authored-by: alandtse <7086117+alandtse@users.noreply.github.com>
Verified enum values via CommonLibSSE-NG submodule:
Usage pattern matches existing code in Removed Build verification requires Windows environment with Visual Studio. Code follows existing patterns and uses verified CommonLibSSE-NG APIs. |
|
✅ A pre-release build is available for this PR: |
|
The issue is child worldspaces, not worldspaces pretending to be interiors. We should probably just close this. |
Summary
Fixed terrain shadows breaking in Markarth and similar worldspaces by properly clearing the heightmap cache when transitioning to worldspaces without heightmaps.
Enum Verification: Confirmed that
RE::TESWorldSpace::Flag::kNoSkyandRE::TESWorldSpace::Flag::kFixedDimensionsare valid enum values in CommonLibSSE-NG (lines 133-134 of TESWorldSpace.h). Usage pattern matches existing code insrc/Utils/Game.cpp:308.Root Cause: The
LoadHeightmap()function retained stale heightmap data from previous worldspaces, causing incorrect shadow rendering or display of wrong heightmap data in the debug UI.Solution:
cachedHeightmap,texHeightMap, andtexShadowHeightwhen:kNoSkyorkFixedDimensions)Build Note: This is a Windows-only project requiring Visual Studio. The code changes follow existing patterns in the codebase and use verified CommonLibSSE-NG enum values.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.