-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[not ready] client side hillshading with terrain-rgb raster tiles #4701
Conversation
Would it make more sense to call the layer type |
Here's a rough list of what needs to happen before this can be merged into master:
|
bc9a507
to
7c8607f
Compare
We could move the preparation step for terrain textures to the beginning of a frame to improve rendering performance. Right now, the workflow of a frame is like this:
When binding a framebuffer and rendering operations on it, the GPU has to restore the contents of the framebuffer. The driver can optimize that when we do a clear as the first drawing operation (since that discards the contents of the framebuffer). Therefore, drawing to the main framebuffer, then binding a different framebuffer, and rebinding the main framebuffer triggers a framebuffer load on the first draw call. Instead, we could do all operations that require binding a separate framebuffer (computing the preprocessed textures) as the first thing when rendering a frame (i.e. before calling clear on the main framebuffer) and have the following order:
|
add7681
to
3efe4a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there is still a lot of code for supporting the openness visualization that we can remove.
@@ -56,11 +56,11 @@ | |||
"line": 74 | |||
}, | |||
{ | |||
"message": "layers[12].type: expected one of [fill, line, symbol, circle, fill-extrusion, raster, background], invalid found", | |||
"message": "layers[12].type: expected one of [fill, line, symbol, circle, fill-extrusion, raster, terrain, background], invalid found", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hillshade?
src/style/style_layer.js
Outdated
@@ -346,7 +346,7 @@ const subclasses = { | |||
'fill': require('./style_layer/fill_style_layer'), | |||
'fill-extrusion': require('./style_layer/fill_extrusion_style_layer'), | |||
'line': require('./style_layer/line_style_layer'), | |||
'symbol': require('./style_layer/symbol_style_layer') | |||
'symbol': require('./style_layer/symbol_style_layer'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that compatible with Safari?
src/source/source_cache.js
Outdated
this._backfillDEM(tile); | ||
} else { | ||
this._source.fire('data', {dataType: 'source', tile: tile, coord: tile.coord}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leave the call to this._source.fire('data', {dataType: 'source', tile: tile, coord: tile.coord});
at the root and just call backfillDEM
additionally? backfillDEM
calls the same function.
gl_FragColor = accent_color * (1.0 - shade_color.a) + shade_color; | ||
} else { | ||
gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before we merge this, we should remove all unused modes.
array.emplaceBack(this._tileCoords[2].x, this._tileCoords[2].y, maxInt16, maxInt16); | ||
array.emplaceBack(this._tileCoords[1].x, this._tileCoords[1].y, EXTENT, 0); | ||
array.emplaceBack(this._tileCoords[3].x, this._tileCoords[3].y, 0, EXTENT); | ||
array.emplaceBack(this._tileCoords[2].x, this._tileCoords[2].y, EXTENT, EXTENT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we factor out this change into a separate PR that we can merge beforehand? I think it makes sense to have this as a separate change since it affects to many parts of the code that are unrelated to hillshading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep – these changes are in #4770 and mapbox/mapbox-gl-native#9153, but they're blocked until text-pitch changes are merged into native
src/geo/dem_pyramid.js
Outdated
case 1: | ||
_xMax = _xMin + 1; | ||
break; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could break if dx < -1 or > 1
We'd likely need something like mapbox/mapbox-gl-native#9415 to prevent flickering from overlapping parent/child tiles. |
add terrain layer type and associated required files build out DEM pyramid fix setter+getter read buffer process array buffer into texture attempt to draw offscreen texture for terrain-prepare shader calcs use framebuffer to gemerate terrain texture try to render ⛰️ rebase to use monorepo use browser canvas obj begin terrain-raster source scaffolding create DEM from raster source praise be!!! raster is a go 🙏
lint er
linty lint
more ☀️ tweaks
…eighboring tile data try using clipped extents to reduce seam flashes fix strategy for minimizing seams... sorrrrta works
…late slope and NEAREST interpolation"
clean up a lil and lint
clean up dead code and fix some accidental changes terrain --> hillshade: rename layer type clean up and revert accidental changes
3efe4a8
to
c29d7b2
Compare
this work is now tracked at #5286 |
still very very rough here. will update this ticket soon w the to-do list before this is ready for review.
🗻
Launch Checklist