fix: resolve water rendering white-out and depth sorting issues#1329
Merged
Conversation
White-out fix (WaterMaterial.ts): - Remove .mul(0.5).add(0.5) encoding from normalNode - TSL expects actual normals in [-1,1] range, not texture-encoded [0,1] values - Remove manual fresnel/specular calculation from colorNode that was causing double-lighting with PBR pipeline - Switch to MeshPhysicalNodeMaterial with proper IOR (1.33 for water) for physically-correct fresnel without manual calculation - Remove unused uniforms (uFresnelPower was defined but never wired) - Simplify quality settings to PBR-appropriate values Depth sorting fix (UnifiedWaterMesh.ts): - Add globalWaterLevel and useGlobalSeaLevel config options - Track minElevation per region during flood-fill - Use consistent water level per region instead of per-cell elevation - Ocean biome uses global sea level, others use region minimum - Prevents water from rendering above terrain due to elevation mismatch Re-enable water in previously disabled biomes: - Frozen, Void, Jungle biomes had water disabled due to "animated diagonal stripe artifacts" - same root cause - Re-enable with appropriate water levels now that fix is in place - Also re-enable void spores particle effect Root causes identified: 1. normalNode returned [0,1] encoded normals instead of [-1,1] actual 2. Manual fresnel/specular in colorNode double-counted with PBR lighting 3. Per-cell elevation caused water height inconsistency within regions 4. AI-generated maps could have water cells with high elevations https://claude.ai/code/session_01ChDF73v8WwcjKe7cWV82iB
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.
White-out fix (WaterMaterial.ts):
Depth sorting fix (UnifiedWaterMesh.ts):
Re-enable water in previously disabled biomes:
Root causes identified:
https://claude.ai/code/session_01ChDF73v8WwcjKe7cWV82iB