Skip to content

Allow negative fill-extrusion-base and fill-extrusion-height (#8051) - #8069

Open
clement-igonet wants to merge 19 commits into
maplibre:mainfrom
clement-igonet:fix/fill-extrusion-negative-base-8051
Open

Allow negative fill-extrusion-base and fill-extrusion-height (#8051)#8069
clement-igonet wants to merge 19 commits into
maplibre:mainfrom
clement-igonet:fix/fill-extrusion-negative-base-8051

Conversation

@clement-igonet

@clement-igonet clement-igonet commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Fill-extrusion layers can now extrude below ground level: negative fill-extrusion-base and fill-extrusion-height values render underground volumes instead of being clamped to the ground. This enables underground floor levels for indoor mapping, for example the basement levels of a station or a building (#8051).

Before / after, an above/below-ground floor stack (levels +2 to -3), left is current main, right is this PR:

before and after: underground floor levels

Live comparison: https://maplibre.confinia.io/debug/underground-compare-8051.html

Pairs with maplibre/maplibre-style-spec#1794, which lifts the minimum: 0 constraint on both properties.

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues: fill-extrusion-base cannot go below 0 #8051
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.
  • Confirm you have read our AI policy here.

Assisted-By: Claude (claude-fable-5)

Remove the ground-level clamp in the fill-extrusion vertex shader so negative
values extrude below ground (maplibre#8051). The terrain basement heuristic now applies
only to bases exactly at ground level, so intentionally negative bases are not
lowered further. The top is kept at or above the base.

Needs the corresponding maplibre-style-spec change dropping minimum: 0 from
both properties.
@clement-igonet
clement-igonet force-pushed the fix/fill-extrusion-negative-base-8051 branch from 8777baf to c9b99e6 Compare August 1, 2026 17:00
@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.92%. Comparing base (37e08c1) to head (9168595).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8069   +/-   ##
=======================================
  Coverage   93.92%   93.92%           
=======================================
  Files         290      290           
  Lines       24916    24916           
  Branches     6575     6575           
=======================================
  Hits        23402    23402           
  Misses       1514     1514           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@CommanderStorm

Copy link
Copy Markdown
Member

I think the one on the left looks quite buggy.
If negative extrusion meant hole, that would make more sense to me.
Just a polygon at ground level is something that an average user likely does not expect when they set this negative.

@HarelM

HarelM commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Can you make the image use something more transparent when the building is underground maybe?
The example above is just a bit confusing because the OSM raster is not really "cut" at the right place.
I would expect a hole for something that's only negative maybe.
Bottom line, I'm not sure it's currently well defined from a user appearance perspective. While the spec itself may support negative values, it's not clear what the user should see when from the provided image.

@clement-igonet

clement-igonet commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Good point, reworked the visual. The PR only defines the geometry; what the user sees is up to the style, and negative bases make an excavation pattern possible: a ring polygon extruded from 0 down forms the pit walls, open in the middle, with the floors inside (right side; on main everything collapses to ground level). A real hole in the draped ground would need polygon clipping of the basemap, which I think is a separate feature. The ground raster is dimmed in the demo for visibility, and an opaque ground-level cover around the pit occludes the interior at the rim, which is what makes it read as a hole rather than a platform.

excavation pattern, main vs this PR

Live version: https://maplibre.confinia.io/debug/underground-pit-8051.html

@clement-igonet

Copy link
Copy Markdown
Contributor Author

Tried your suggestion and it turns out the transparent-ground appearance works purely at the style level: draw the basemap raster, then the underground layer, then the same raster again with raster-opacity around 0.5, then the above-ground layers. Depth ordering makes the semi-transparent ground draw above everything below elevation 0, so underground volumes ghost through it while above-ground buildings stay crisp (right side; left is main). Over normal ground the second raster is invisible, so no masking is needed.

underground ghosting through a semi-transparent ground

Live: https://maplibre.confinia.io/debug/underground-xray-8051.html

Comment thread test/integration/render/tests/fill-extrusion-base/negative-pit/style.json Outdated
clement-igonet and others added 5 commits August 5, 2026 18:31
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…negative-base-8051

# Conflicts:
#	CHANGELOG.md
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…negative-base-8051

# Conflicts:
#	CHANGELOG.md
…stead of a plain fill

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…negative-base-8051

# Conflicts:
#	CHANGELOG.md
#	test/build/bundle_size.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants