Access 3D terrain mesh for use in custom 3D layer
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Motivation
I'm using threebox (three.js + mapbox) to render 3D wind turbines on a Mapbox map including shadows using @mourner's awesome suncalc module.
https://observablehq.com/@chrispahm/visualizing-wind-turbines-in-3d-using-threebox
This works great, however it would be nice if the shadows would also be displayed on the ground when the 3D terrain is enabled.
Right now, this is not possible since the custom 3D layer / three.js is unaware of the underlying 3D terrain mesh (see discussion in the threebox repo: https://github.com/jscastro76/threebox/issues/381).
I guess if there was a way to access the terrain mesh, rendering the shadows should be possible?
Design Alternatives
Another way to approach this would be to re-create the mesh by following the steps outlined in @mourner's ObservableHQ notebook demonstrating MARTINI https://observablehq.com/@mourner/martin-real-time-rtin-terrain-mesh.
However, this would a) require to query the elevation data a second time and b) also require to re-compute the mesh which is presumably available within GL JS internally.
So do nothing is an option for sure, I guess it would just be a nice to heave feature!
Design
Potentially expose the current mesh geometry through an API so it can be consumed by three.js
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the custom 3D layer API and the terrain implementation that owns the current mesh. Compare the proposed API with the three.js use case and the linked threebox discussion. Done means the current terrain mesh geometry can be accessed by a custom layer without re-querying elevation data or recomputing the mesh.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- three.js, typescript
- Domain
- computer-graphics, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100