Mapbox-gl-js: fill-extrusion-flat-ceilings style spec property

Created on 5 Feb 2021  路  3Comments  路  Source: mapbox/mapbox-gl-js

Motivation

When using fill-extrusions on a map with terrain enabled, since #10347 the extrusion ceiling will be flat. This is good for buildings, but per https://github.com/mapbox/mapbox-gl-js/issues/10170#issuecomment-770496123 sometimes you might want these extrusions to follow the terrain.

One example is for vegetation extrusions to show forest areas of a fixed height above the terrain.

Design Alternatives

The user could split the polygons but they still would be flat, just stepped. A smoother extrusion which follows the terrain could only be achieved my unlocking it with a style spec property.

Design

Using a style spec property which defaults to flat allows backwards compatibility, but still supporting curved extrusion ceilings.

It's fine if this is not something you're keen on implementing, but thought I'd raise this ticket for further discussion since the existing ones were closed out.

cross-platform feature

Most helpful comment

Some other interesting use cases for such a property: https://cameronwkruse.com/home/projects/glacslide/.

Some considerations to properly support the non-flat case:

  • Adjust the normals to follow slope, so that shading used on the fill-extrusions is accurate. Currently, normals are always pointing up on the top geometry.
  • Subdivide the polygon to fit the terrain geometry, some artifacts may be seen when the polygon does not have enough subdivision to properly follow the terrain slopes.

All 3 comments

@karimnaaji started work on scoping the mechanism.

@andrewharvey ,

One example is for vegetation extrusions to show forest areas of a fixed height above the terrain.

Do you see that it would be beneficial to style it differently?
E.g.

  • round top (chamfer at top),
  • extrude in direction of slope normal (not vertically),
  • or something else?

cc @karimnaaji @asheemmamoowala

Do you see that it would be beneficial to style it differently?

For the vegetation use case, I don't think that's too important.

Some other interesting use cases for such a property: https://cameronwkruse.com/home/projects/glacslide/.

Some considerations to properly support the non-flat case:

  • Adjust the normals to follow slope, so that shading used on the fill-extrusions is accurate. Currently, normals are always pointing up on the top geometry.
  • Subdivide the polygon to fit the terrain geometry, some artifacts may be seen when the polygon does not have enough subdivision to properly follow the terrain slopes.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

aaronlidman picture aaronlidman  路  3Comments

yoursweater picture yoursweater  路  3Comments

rigoneri picture rigoneri  路  3Comments

stevage picture stevage  路  3Comments

mollymerp picture mollymerp  路  3Comments