Skip to content

fix(geo-layers): draw textured I3S meshes in MeshLayer - #11203

Merged
ibgreen merged 2 commits into
visgl:masterfrom
javandres:fix/mesh-layer-i3s-shaders
Nov 19, 2026
Merged

ibgreen merged 2 commits into
visgl:masterfrom
javandres:fix/mesh-layer-i3s-shaders

Conversation

@javandres

@javandres javandres commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #11202

Background

MeshLayer (the I3S sublayer of Tile3DLayer) passes vec4(0) to pbr_filterColor, which luma.gl multiplies into the base colour as the vertex colour, so textured tiles are transparent. On WebGL it also tests HAS_UV_REGIONS with #ifdef while always defining it (0 or 1), so meshes without uvRegions sample a single texture column.

Change List

  • MeshLayer fragment shaders (GLSL, WGSL): pass the vertex colour to pbr_filterColor, as ScenegraphLayer does
  • MeshLayer vertex shader: #if HAS_UV_REGIONS in place of #ifdef
  • Unit tests: a textured PBR mesh read back pixel by pixel on WebGL, with and without uvRegions

Both new tests fail on master (nothing drawn; then red over the blue half). test/modules/geo-layers and test/modules/mesh-layers pass headless (158 tests), as do ocular-lint and test-fast.


Note

Low Risk
Low risk bug fixes to shader macros and color calculations in MeshLayer, accompanied by WebGL pixel regression tests.

Overview
Fixes rendering of textured PBR meshes in MeshLayer by passing vertex color directly into pbr_filterColor across GLSL and WGSL fragment shaders, preventing textured tiles from rendering transparently.

Additionally, updates the vertex shader preprocessor directive from #ifdef HAS_UV_REGIONS to #if HAS_UV_REGIONS so meshes without UV regions are not mistakenly treated as having them. New WebGL pixel readback unit tests verify textured mesh rendering with and without uvRegions.

Reviewed by Cursor Bugbot for commit ffd73cd. Bugbot is set up for automated code reviews on this repo. Configure here.

MeshLayer's fragment shader passed vec4(0) to pbr_filterColor. luma.gl
multiplies the base colour by that argument as the glTF vertex colour,
so every fragment came out transparent and textured I3S tiles were not
drawn. The vertex colour is now passed in, as ScenegraphLayer does.

The vertex shader tested HAS_UV_REGIONS with #ifdef, but the layer
always defines it, as 1 or 0, so a mesh without uvRegions read the
missing attribute and sampled one column of its texture (streaks on
I3S integrated meshes). It is tested with #if.

Signed-off-by: Javier Andrés García <[email protected]>
@greptile-apps

greptile-apps Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues remain.

Summary

Fixes textured I3S meshes in MeshLayer.

  • Textured PBR meshes render with their material colors.
  • Meshes use UV regions only when the mesh provides them.

No new actionable issues found. Tests were not run during this review.

Reviews (4) · Last reviewed commit: "test(geo-layers): check uvRegions offset..." · Reviewed by Greptile

Texture coordinates of 0.25 and 0.75 over four texels, so the region
test tells a mapped coordinate from a constant one. The draw times out
and releases the WebGL context, and the new constants carry TSDoc.

Signed-off-by: Javier Andrés García <[email protected]>
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 82.546% (+0.03%) from 82.521% — javandres:fix/mesh-layer-i3s-shaders into visgl:master

@ibgreen
ibgreen added this pull request to the merge queue Nov 19, 2026
Merged via the queue into visgl:master with commit fe96c6f Nov 19, 2026
9 checks passed

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

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.

[Bug] Tile3DLayer draws textured I3S meshes transparent, and streaked without uvRegions

3 participants