Skip to content

Custom 3D layers cannot correctly occlude with fill-extrusion buildings(iOS and Android) #4301

Description

@st-dmitry

Custom 3D geometry rendered via MLNCustomStyleLayer or MLNPluginLayer cannot correctly occlude with fill-extrusion buildings. Fill-extrusion and custom objects do not occlude each other correctly — the overlap does not match their actual spatial positions relative to the camera. The custom model appears "embedded" inside surrounding buildings instead of being correctly hidden behind them or visible in front of them depending on the camera angle.

The issue is in the C++ core (src/mbgl/renderer/) and affects both iOS and Android.

To Reproduce

  • Create a map style with a fill-extrusion layer (3D buildings)
  • Add a MLNCustomStyleLayer that renders a custom .obj building model at a specific coordinate
  • Use the shared depth buffer and projectionMatrix from the drawing context
  • Tilt the camera and rotate around the scene
  • Observe: occlusion between fill-extrusion buildings and the custom building model does not match actual spatial positions

Confirmed on two independent implementations:

Both produce identical artifacts.

Expected behavior
Correct mutual occlusion: the custom 3D model should be visible in front of buildings that are farther from the camera, and hidden behind buildings that are closer — just like fill-extrusion buildings occlude each other.

Screenshots
Image

Image

Platform information:
Operating System: iOS, Android
Platform: MapLibre Native (C++ core, Metal backend on iOS, OpenGL ES on Android)
Version: 6.25.0 (iOS)

We are willing to sponsor the development of this fix. If anyone from the core team or community is interested — please reach out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions