-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Terrain rendering layer #1215
Comments
@markov00 Are you talking about 3D terrain? It is a cool idea.
|
@ibgreen Yes was looking exactly at 3d terrain rendering. Cesium is using the following terrain providers https://cesiumjs.org/data-and-assets/terrain/ but it's possible to use other terrain tile set like the one from mapbox mapbox.terrain-rgb used on this demo with threejs https://www.mapbox.com/bites/00332/#13.4682/36.3871/-112.6445/18.0142/30.5289 |
There is also an issue open since 2015 in mapboxgl mapbox/mapbox-gl-js#1489 but seems that is something with low priority or quite complex to achieve |
This would be super cool for tools we are building internally as well.... imagine the terrain of SF... :) |
One of the possible problems is how to handle map elements like roads, labels and any other object. They are currently clamped to the ground. |
We've been working internally on some tools for using Cesium + Mapbox together and swapping libraries to jump between 2d/3d. Would love to hear more about how other people are approaching it. The main missing piece is around MVT support, which doesn't exist in cesium right now as far as we can tell. |
I've used three.js in the past with bump/height mapping. I did a small experiment with D3.js, three.js and rendering a state (california) and then extruding it. Then to that, add mapping with a black/white image (low resolution). Here's an early rendering of what I was doing (sans height map): https://pbs.twimg.com/media/CsBMIlwVMAA258s.jpg I found a few people doing the same and used parts of their research/code. The challenge, for me, was finding high enough resolution height map imagery. Awesome to know mapbox has basically a tile server equivalent for elevation maps. That didn't exist before. This is probably one of the biggest hurdles. This is definitely something I'm interested in too and given the limited time I have right now and the heavy lifting Uber has done here already...I'm likely going to look to do this again using deck.gl. I have no interest in hobbled together three.js + d3.js when there's a framework here that will help me put this into production faster. Though for me, I do want to see if it's possible to just render an isolated state/region with geojson. I like the idea of an "illustration" more than a "map" if that makes sense. I don't want to see everything around what I'm visualizing and I don't want the fidelity of roads, etc. Maybe just mountains and streams and a few city labels. I'll follow along here and if by chance I make any progress before anyone else (slim chance), I'll also post back and share. Maybe the above links help someone. |
I agree. I haven't spent a lot of time trying the mapbox datasets, but I'm eventually going to work something that converts them to height map images like the kind used in the deck.gl elevation layer. For now, I've only made height maps with some internal data. But that test proved to me this layer is definitely good enough to be a starting point for a terrain layer. I modified it a bit in december and got a nice result. If folks are interested, I can probably put together a PR for the modifications I used. I'd argue until we have the function that converts mapbox data to the right kind of image, the deck.gl layer isn't super duper useful, but I believe this function is possible to make. |
If you're able to, that'd be awesome. I'd love to see how it works. Even if it's a whole new layer and not so much a PR. I don't know how it works or what makes sense. If it's really that close to working that it's more of a small addition to the layer than a brand new one in its own right, that sounds even nicer. |
This would be amazing, did any progress get made on it? |
I've been doing some research on this... Mapbox's Terrain RGB tiles store raw, tiled elevation data in 0.1m increments. I figured out a very basic working example to generate a mesh using Mapbox's open-source Martini, which is a fast way to generate a terrain mesh. (It looks like you could use The mesh outputs vertices and triangle indices, and I'm working now to figure out how to integrate that into deck.gl. Is it just: var Geometry = require('@luma.gl/core').Geometry
var attributes = {
indices: mesh.triangles,
positions: mesh.vertices
}
var geometry = new Geometry({attributes: attributes})
const layer = new SimpleMeshLayer({
id: 'mesh-layer',
mesh: geometry
}); The SimpleMeshLayer docs say that the attributes object is expected to have I'm working on trying to bundle things to test in the browser. I'm still new to JS... Then I suppose if all of this works out, you could just pass the terrain-rgb tiles to |
I’m nearly done with the implementation of the TerrainLayer. It’s very functional except for a new runtime error that we’re still working out. #3984 |
I didn't think to check for PRs because it had been a while since you had commented. I'll check/test out your fork! |
Sorry for forgetting to update this thread. I only opened the PR a couple days ago :) |
Btw, I’m not using Martini yet but would love to add that as a geometry option. I’m currently making a basic square grid for the geometry. If you can see how what you’ve written can fit into the PR, please leave some comments. Thanks! |
I think this can be closed now! 🎉 |
Hopefully the new layers works well for folks! Fee free to open a new one and cc me if you run into issues. |
Additionally, since there's been historical interest in this thread, I wanted to note that I'm working on tools to render deck vector layers clamped to the terrain. I have a preliminary library to snap 2D vector features to the terrain mesh, which works for point and line features. |
Wow that looks sooo cool |
Hi, I was wondering if there is any future idea to support terrain rendering as a layer of deckgl.
The only useable solution for this type of rendering is Cesiumjs but I can't find any other libs with decent performances.
Any plan to include it in the feature releases?
The text was updated successfully, but these errors were encountered: