Skip to content

fix: respect repeat uniform in POM silhouette discard#8

Open
dswhy wants to merge 1 commit into
promontis:mainfrom
dswhy:main
Open

fix: respect repeat uniform in POM silhouette discard#8
dswhy wants to merge 1 commit into
promontis:mainfrom
dswhy:main

Conversation

@dswhy

@dswhy dswhy commented May 14, 2026

Copy link
Copy Markdown

Hey there! Found a little bug when testing this awesome material :)

createPomMaterial({ repeat: N }) with N > 1 renders only the [0, 1] × [0, 1] corner of the surface. At repeat: 4 you see ~1/16 of the geometry; the rest is discarded.

Cause

The UV is scaled by repeat before marching, so the ray-marcher works in [0, repeat] space — but the silhouette discard still tests against the literal [0, 1]:

const scaledUv = uv().mul(repeatUniform);  // ∈ [0, repeat]
// ...inside parallaxOcclusionMapping:
currentPos.x.greaterThan(1).or(...).discard();  // wrong upper bound

Bounds and coordinate space disagree, so everything past the first tile gets killed.

Fix

Thread repeatUniform into parallaxOcclusionMapping and use it as the discard upper bound. Three-line change, no extra recompile when the slider moves (already a uniform).

Verified

  • repeat: 1 — pixel-identical to current behavior
  • repeat > 1 — full surface tiles, silhouette still clips at the geometry edge
  • POM-disabled path untouched

I verified locally since it didn't really make sense to modify the current example. But happy to set something up if you want.

Best!

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.

1 participant