Skip to content

fix: resolve water rendering white-out and depth sorting issues#1329

Merged
braedonsaunders merged 1 commit into
mainfrom
claude/investigate-water-rendering-9GuJz
Feb 3, 2026
Merged

fix: resolve water rendering white-out and depth sorting issues#1329
braedonsaunders merged 1 commit into
mainfrom
claude/investigate-water-rendering-9GuJz

Conversation

@braedonsaunders

Copy link
Copy Markdown
Owner

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

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
@braedonsaunders braedonsaunders merged commit a2a1ee4 into main Feb 3, 2026
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.

2 participants