Repository navigation
The water's mirror clip and haze fixes, and terrain tessellation at a density of 48 - #550
Merged
Merged
Conversation
…n, not before waterF.glsl and underWaterF.glsl called mirrorClip first, which discards under MIRROR_CLIP, and then took derivatives: the wave normals' implicit-LOD reads and dFdx in water_wave_normals, and dFdx(pos) in the sun's shadow. A lane that discards leaves its quad, and GLSL leaves the derivatives of the lanes beside it undefined, so along a mirror's plane the reflected water read its normal maps at the wrong mip and filtered its shadow over the wrong footprint. Both test the plane with mirrorClipped at the top and discard at the end, as pbrterrainF.glsl does. The discard is compiled only in the mirror variant, so the water elsewhere keeps its early depth test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From above, doWaterHaze draws the field with the hardware depth test on (GEQUAL under reverse-Z, writing none), and waterHazeF.glsl repeated the same test by hand and discarded. It did so because some GPUs once could not depth test against a target bound for sampling; the pass now reads the scene's depth past a texture barrier or from a copy (LLPipeline::hazeDepth), and the hardware test runs either way. The manual test, its second copy of the depth convention and the above_water uniform the fragment stage read for it are gone; the vertex stage still reads it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
doWaterHaze fogs the scene under the surface, seen from above, by drawing the whole field over it. Where the view's water does not refract (ALRenderResourcePlan::refractsWater: RenderTransparentWater off, and every probe face), the water is drawn opaque straight after and hides all of it, so the pass read the depth, worked the fog and blended for nothing, once a frame and once a probe face. Where an exclusion prim removed the water the haze fogs nothing either (its NotExcluded stencil). Seen from below the pass is a full-screen fog of what lies in front of the camera and stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AlchemyRenderTerrainTessDensity's default comes down from 64 to 48: a 16 m patch is split 48 ways (33 cm) within 16 m of the camera, 12 ways at 64 m, and not at all past 768 m, where 64 split it to 1 km. The triangle count grows with the square of the density, so the terrain draws a little over half the triangles it did, for an edge a third longer near the camera. The fallback in LLDrawPoolTerrain and the setting's worked example follow it; a saved value is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 41 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Three fixes to the water and its haze from a defect and perf review of the water and sun shadow paths, and a lower terrain tessellation default.
waterF.glsl,underWaterF.glsl). Both calledmirrorClipfirst, which discards underMIRROR_CLIP, and then took derivatives: the wave normals' implicit-LOD reads anddFdxinwater_wave_normals, anddFdx(pos)in the sun's shadow. GLSL leaves a quad's derivatives undefined for the lanes beside one that discards, so along a mirror's plane the reflected water read its normal maps at the wrong mip and filtered its shadow over the wrong footprint. Both now test withmirrorClippedand discard at the end, compiled only in the mirror variant so the water elsewhere keeps its early depth test, aspbrterrainF.glsldoes.waterHazeF.glsl). From above,doWaterHazedraws the field with the hardware depth test on, and the shader repeated it by hand and discarded. The pass reads the scene's depth past a texture barrier or from a copy (LLPipeline::hazeDepth), so the manual test, its second copy of the depth convention, and the fragment stage'sabove_waterare gone.LLPipeline::doWaterHaze). Where the view's water does not refract (ALRenderResourcePlan::refractsWater:RenderTransparentWateroff, and every probe face), the opaque water drawn straight after hides everything the haze fogged, so the pass is skipped above water. Seen from below it is unchanged.AlchemyRenderTerrainTessDensity). A 16 m patch is split 48 ways within 16 m of the camera, 12 at 64 m, and not at all past 768 m, at a little over half the triangles. The fallback inLLDrawPoolTerrainand the setting's worked example follow it; a saved value is kept.Testing.
pipeline.cppandlldrawpoolterrain.cppcompile clean with the viewer's own flags (vs2026-os, RelWithDebInfo,/W3 /WX). The shaders were not compiled standalone. In-world check owed: water seen in a mirror, the water haze from above and below withRenderTransparentWateron and off, and the terrain's look at 48.🤖 Generated with Claude Code