CesiumGS / CesiumGS/cesium-unity

Add bezier support to Cesium Cartographic Polygon

Open
#439 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
535
Forks
132
Avg merge
6h 45m
Merged PRs (30d)
1

Description

We finally have Cartographic Polygons in Unity as of [this PR](https://github.com/CesiumGS/cesium-unity/pull/407)! Looks great, but of course we always want more...

Cartographic Polygons rely on Unity's Spline editor, and we currently only support Linear splines, yet Bezier curves are also available. Bezier curves are incredibly useful for following curved features, like roads and shorelines.

Here is an example spline following a road:
![image](https://github.com/CesiumGS/cesium-unity/assets/130494071/527d8de6-88e9-4e03-aba7-5d16a7e5ffa3)

Looking through the code, one of the easiest ways to accomplish this could be to convert bezier curves into linear curves in our Unity plugin, `CesiumCartographicPolygon::GetCartographicPoints`. We are already dealing with `BezierKnot` objects (cubic beziers), so it would just be a matter of segmenting the curve into a collection of lines, at some level of granularity.

A harder, but maybe more valuable task, could be to support bezier curves completely, all the way down to cesium-native's `CesiumGeospatial::CartographicPolygon` class.

Contributor guide

Open the contributing guide

Research direction

Start with CesiumCartographicPolygon::GetCartographicPoints and inspect how Unity's Spline editor provides BezierKnot objects. Compare the proposed linearization approach with the alternative of carrying Bezier support into cesium-native's CesiumGeospatial::CartographicPolygon. Done means agreeing on one scope and supporting Bezier splines through the relevant polygon path.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
computer-graphics, game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.