mapbox / mapbox/mapbox-gl-js

Fill extrusion optimization: face normals on GPU

Open
#11,083 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

performance :zap:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

Using OES_standard_derivatives we could:

a) Generate face normals on GPU and half the number of vertices sent to GPU for fill extrusions. Approach in Three.js: https://github.com/mrdoob/three.js/blob/master/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js#L4-L12
b) prototyping idea: using barycentric coordinates (and for vertical and horizontal edges only), combine smooth normals around edges and flat shading in inner part of faces, to achieve smooth edges without introducing additional vertices.

Approach is already verified to work in gl-native.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Three.js normal_fragment_begin.glsl.js example linked in the issue and the OES_standard_derivatives approach. Compare it with the existing fill-extrusion rendering path and the gl-native prototype mentioned. Done would mean a verified GPU-normal approach that reduces vertices, or a validated barycentric-coordinate approach for smooth edges and flat face interiors.

Written by the indexing model from the issue text.

Assessment

Tech stack
three.js, typescript
Domain
computer-graphics, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.