Shader rework for terrain polygon clipping - #13637
Open
mzschwartz5 wants to merge 5 commits into
Open
Conversation
This was referenced Jul 20, 2026
Contributor
|
Thank you for the pull request, @mzschwartz5! ✅ We can confirm we have a CLA on file for you. |
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
July 20, 2026 16:45
987ae15 to
28c14d6
Compare
8 tasks
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
July 21, 2026 15:54
0bcf38f to
cfc9407
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
July 21, 2026 17:31
28c14d6 to
6fb2a70
Compare
This was referenced Jul 21, 2026
8 tasks
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
July 29, 2026 18:55
cfc9407 to
7886bf6
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
July 29, 2026 18:55
6fb2a70 to
9953e6b
Compare
mzschwartz5
commented
Jul 30, 2026
Contributor
Author
There was a problem hiding this comment.
Here, I'm mainly just factoring out some code into a reusable function (vectorCellRange), and adding a new function vectorClip for the actual clipping flow. Two notes:
- You'll notice
vectorClipis pretty similar structurally tovectorPolygonRender. It's possible they could be refactored to share even more code and avoid repeating ourselves. I did try this, but it was kind of ugly and added a little performance overhead. Decided to leave as-is. - I added a couple uniforms for clipping. Ideally, I think a better solution would be for this file to not explicitly declare uniforms, and to have the functions be parameterized to accept them. I'm leaving that as a TODO; it's good enough as-is.
mzschwartz5
marked this pull request as ready for review
July 30, 2026 15:21
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
July 31, 2026 16:57
7886bf6 to
0c9fd7e
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
July 31, 2026 16:57
1704714 to
c8346e0
Compare
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
July 31, 2026 18:55
0c9fd7e to
e044831
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
July 31, 2026 18:55
c8346e0 to
4b3bd7d
Compare
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
July 31, 2026 22:24
e044831 to
3ec33e6
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
July 31, 2026 22:25
4b3bd7d to
512656d
Compare
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
August 3, 2026 01:07
3ec33e6 to
05ce087
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
August 3, 2026 01:07
512656d to
453391f
Compare
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
August 3, 2026 01:14
05ce087 to
29f0964
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
August 3, 2026 01:14
453391f to
27cbc04
Compare
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
August 3, 2026 19:32
29f0964 to
6431186
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
August 3, 2026 19:32
27cbc04 to
027db9d
Compare
8 tasks
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
August 10, 2026 19:39
6431186 to
b9abfb8
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
August 10, 2026 19:39
027db9d to
455e445
Compare
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
August 18, 2026 17:20
b9abfb8 to
83888d6
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
August 18, 2026 17:20
455e445 to
4430325
Compare
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
August 19, 2026 17:08
83888d6 to
058325c
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
August 19, 2026 17:08
4430325 to
01ee56a
Compare
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
August 19, 2026 19:38
058325c to
00e0a0b
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
August 19, 2026 19:38
01ee56a to
fe9d895
Compare
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
August 20, 2026 14:17
00e0a0b to
91f077b
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
August 20, 2026 14:17
fe9d895 to
6386ffa
Compare
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
August 20, 2026 14:33
91f077b to
ea4ba28
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
August 20, 2026 14:33
6386ffa to
b1d302e
Compare
mzschwartz5
commented
Aug 20, 2026
| @@ -457,9 +457,16 @@ void main() | |||
| #endif | |||
Contributor
Author
There was a problem hiding this comment.
This is the meat of this PR: here, we actually switch over from the old SDF-based clipping function, to the new vector-based clipping function.
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
August 21, 2026 16:14
ea4ba28 to
a326f98
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
August 21, 2026 16:14
b1d302e to
7f92ee6
Compare
mzschwartz5
force-pushed
the
clipping-texture-plumbing
branch
from
August 21, 2026 16:16
a326f98 to
79c8b25
Compare
mzschwartz5
force-pushed
the
clipping-globe-shader-rework
branch
from
August 21, 2026 16:16
7f92ee6 to
1a42e12
Compare
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.
Description
This PR is the 4th installment in the effort to reimplement Clipping Polygons on top of the vector data pipeline -- specifically, for terrain (3d tiles and models to come).
In this PR, I wire up the vector-clipping texture uniforms and make the shader changes to actually use them. Thus, as of this PR, terrain clipping actually operates via the vector shaders!
And just look at the difference in quality:
Vector-based clipping:
SDF-based clipping:
Issue number and link
https://github.com/iTwin/cesiumjs-web3d-internal/issues/34
Testing plan
A sandcastle that uses a star shaped polygon to clip the globe (feel free to add terrain and test that too). Use the slider or input field to change the scale of the star and ensure it's crisp at all scales.
Dynamic clipping collection -- this one tests adding and removing clipping polygons from a collection. On this PR branch, the 3D tiles option still uses the SDF approach and will not render crisply.
Standard clipping regions sandcastle -- basic functionality check
The clipping performance dev sandcastle is another good one for testing various numbers (of polygons, points per polygon, spacing, etc.). NOTE: in this PR, I have not yet removed the SDF code paths. So the performance of clipping will appear the same or worse, as the SDF textures are still being generated.
Author checklist
CONTRIBUTORS.mdCHANGES.mdwith a short summary of my changeAI acknowledgment
If yes, I used the following Tools(s) and/or Service(s):
If yes, I used the following Model(s):
PR Dependency Tree
This tree was auto-generated by Charcoal