Skip to content

Design Proposal: Ambient occlusion for fill-extrusion layerΒ #1796

Description

@zarechnyy

Design Proposal: Ambient occlusion for fill-extrusion layer.

Motivation

MapLibre has no ambient occlusion feature for fill-extrusion layer today. This helps to make 3D features look more realistic. Although, there is an open-sourced implementation for GL JS. But I am not sure, if we can translate similar approach to Native one. Moreover, there is an opened issue for supporting ambient occlusion out of box for GL JS version.

Proposed Change

The proposed changes covers MapLibre Native implementation details, things could be changed for GL JS map.

The effect could be computed as a part of existing building geometry processing step, thats a place where the map has the wall geometry for each building's footprint. It makes more sense to me rather then implementing a new render pass.

API Modifications

At the high level, we can introduce two style properties to support following feature:

  • An intensity property (number for a given range [0;1], default value is 0).
  • A radius property (number, default chosen to give a reasonable).

Maybe anything more if we would like to allow customize for end-users.

Migration Plan and Compatibility

The changes are additive. The default values of style properties make the feature disabled.

Rejected Alternatives

This section covers the state of Native project. I might miss anything, feel free to add! πŸ™

  1. We could implement similar behavior using MLNCustomStyleLayer/MLNPluginStyleLayer for Darwin platforms and keep this feature at consumer app level. But why I don't think thats an option: both types of layers with no access to another layer's geometry. To get building geometry we have either query rendered/visible features and then apply ambient occlusion for a given geometry. It impacts performance from my tests.
  2. Maybe we can consider using cxx plugins system to support this feature for native projects, but I am afraid that It might have similar problems as option 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions