CesiumGS / CesiumGS/cesium-native

Cesium Native PinBuilder / billboard support

Open
#1,168 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
623
Forks
277
PR merge metrics
No merged PRs in 30d

Description

One of the goals we've been aiming at with our work on #1154 is being able to load and display the data from the iTwin Feature Service, as shown in CesiumJS in [this sandcastle](https://sandcastle.cesium.com/?src=iTwin%20Feature%20Service.html). With #1163, we're tackling the polylines and polygons component of this task, but the points component remains unfulfilled.

To fulfill this, we need some way of:
1. Loading points from GeoJSON (Done)
2. Fitting those points to the terrain (Done)
3. Putting some sort of billboarded graphic, selected based on data from the GeoJSON file, on the terrain at those points (TODO)

## Ideas

To fulfill requirement number three, the remaining requirement, I see three different approaches we could take.

### Do Nothing

This is the easiest approach. We just don't provide any particular support for billboarded graphics on the terrain. Users will find whatever way that works best for them to display graphics at these positions. With the blueprint support for GeoJSON data in Unreal, this is already possible to do. But this hardly seems like a good solution to me - every person who wants to accomplish this task (which seems to be a fairly common one outside of iTwin Feature Service as well) will have to reinvent the wheel.

### User-Pluggable Point Prefab

We give the user some way of specifying that they'd like to spawn a given prefab, actor, or similar at the points obtained from a GeoJSON file. We could implement some way of passing the metadata from each point to each instance of the prefab/actor/etc (perhaps a base class in Unreal, or attaching a custom component in Unity) so the user can handle styling themselves. This still involves some degree of reinventing the wheel, but we could at least provide our own default implementations of these prefabs to help the users out. This is sort of a compromise between the "Do Nothing" solution, and...

### Full Billboard Support

We take a cue from CesiumJS and provide an equivalent to the [`PinBuilder`](https://cesium.com/learn/cesiumjs/ref-doc/PinBuilder.html). The user tells us how we should display each point (for example, using an icon derived from a metadata property), and we generate textures from them to display on the map. This would probably involve implementing the `KHR_billboard` extension and generating a glTF out of the vector points. This would have the advantage of letting us use the existing texture loading paths for our game engine integrations, and we could benefit from instancing as the same point will likely be duplicated a number of times.

However, this solution doesn't feel very *native runtimes*. We usually lean on the side of giving the users the tools to leverage what the game engines already offer, rather than providing our own bespoke solutions to each issue. The number of people who want the *exact same Cesium pin design* for whatever tool they're making is probably far smaller than the number of people who would like the ability to plug in a prefab and go to town.

## Conclusion

Out of these three options, I think the second is probably the way to go - it might involve more work for the user, but it'll let users do exactly what they want instead of fighting our tool to get it to do something close. We can help by providing basic implementations of these prefabs. It's also a lot less work than the third option! But I'm interested in hearing more about what people think of these options and whether there's alternatives I haven't considered.

Contributor guide

Open the contributing guide

Research direction

Start by reading the related work in #1154 and #1163, then review the GeoJSON point-loading and terrain-fitting paths mentioned in this issue. Compare the proposed user-pluggable prefab approach with full billboard support and existing game-engine texture loading paths; done requires a decided approach and an implementation plan for displaying point graphics.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, unity, unreal-engine
Domain
computer-graphics, game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.