1
0

docs: two stale references in the ground material — the fade's name, and why two materials may share one cache key

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude
2026-08-24 20:15:21 -07:00
parent 76ca903cd2
commit 389245fd60
+15 -7
View File
@@ -334,9 +334,10 @@ function groundDetailTexture(): THREE.DataTexture {
texture.magFilter = THREE.LinearFilter;
// Mipmapped for the reason `swellNormalTexture` states: the mip chain of a
// normal map converges on flat, so the ground a long way off stops perturbing
// its normal without anything having to decide when — and `GROUND_DETAIL_FAR_M`
// then finishes the job by taking the fetch's *result* to zero rather than
// leaving a residue of the coarsest mip on the horizon.
// its normal without anything having to decide when — and the fade at
// `GROUND_DETAIL_NOISE_PX` then finishes the job by taking the fetch's
// *result* to zero rather than leaving a residue of the coarsest mip on the
// horizon.
texture.minFilter = THREE.LinearMipmapLinearFilter;
texture.generateMipmaps = true;
// Eight, as the sea has: from a map pose the ground is seen at a grazing
@@ -537,10 +538,17 @@ mapN.xy *= normalScale * groundFlat * groundSeen;
normal = normalize( tbn * mapN );`,
);
};
// Two materials that compile to different programs must not share a cache
// key, and `onBeforeCompile` is invisible to three's default key. Set only
// on the patched branch: an unpatched ground is an ordinary standard
// material and must go on sharing whatever key three gives it.
/*
* `onBeforeCompile` is invisible to three's default key, so a patched
* material that does not declare one gets handed somebody else's program.
*
* The terrain and the shore plate both answer `"tera:ground"` and that is
* correct rather than a collision: `WebGLPrograms.getProgramCacheKey`
* appends this string to the *whole* parameter list, and `vertexColors`
* is in that list — so the two still hash apart, and two boards of the same
* kind still share. Set only on the patched branch: an unpatched ground is
* an ordinary standard material and must go on sharing three's own key.
*/
material.customProgramCacheKey = () => "tera:ground";
}
return material;