Skip to content

fix(wsurf): center parallax and align material UVs - #34

Merged
hzqst merged 1 commit into
mainfrom
fix/parallax-midpoint
Nov 11, 2026
Merged

hzqst merged 1 commit into
mainfrom
fix/parallax-midpoint

Conversation

@hzqst

@hzqst hzqst commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Mid-gray pixels in the bundled bullet-hole height map currently receive roughly half the full parallax offset, making the effect appear displaced into the wall. Use a fixed height reference of 0.5 so mid-gray stays on the surface, and share the resulting UVs across diffuse, detail, normal and specular textures while preserving lightmap coordinates.

Start the ray at the top of the height field relative to the new reference plane, retaining the existing 20–40-layer search, scale and full height range. Correct the alpha-solid glow branch to sample the shared UVs without an undefined coordinate or duplicate variable declaration. Update the English and Chinese authoring documentation, including the behavior change for custom maps authored against the old white reference.

Fixes MetaHookSv/MetaHookSv#972

Validation:

  • The new GPU regression first failed against the old shader: mid-gray expected U=0.400000, actual U=0.390015.
  • Win32 Debug CTest: 19/19 passed, no skips.
  • Win32 Debug and Release wsurf_parallax_shader_tests: each passed 24 production VS/GS/FS variant compile/link checks and 432 GPU readback cases on an NVIDIA RTX 5060 / OpenGL 4.4. Cases cover brush/decal paths, parallax on/off, black/mid-gray/white heights, a linear height field with an analytic intersection, positive/negative/zero scale, viewing angles, material UV alignment and unchanged lightmaps. Variants include glow, alpha-solid, shadow and multiview paths.
  • Renderer-format-check: 104 files, no differences; git diff --check passed.

The test executable was built in both configurations. No game deployment or in-game visual acceptance was performed; the GPU checks do not establish full-game visual compatibility.

Co-Authored-By: Codex <codex@openai.com>
@hzqst
hzqst merged commit 7ba450f into main Nov 11, 2026
3 checks passed
hzqst added a commit to MetaHookSv/MetaHookSv that referenced this pull request Nov 11, 2026
Update Renderer to merged PR MetaHookSv/Renderer#34.

Co-Authored-By: Codex <codex@openai.com>
@hzqst
hzqst deleted the fix/parallax-midpoint branch November 12, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Renderer] parallax behaviour

1 participant