CesiumGS / CesiumGS/cesium

Animation support in Cesium3DTileStyle

Open
#5,343 7 comments 0 reactions 0 assignees View on GitHub
category - 3d tiles type - enhancement
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Currently you can implement animations in Cesium3DTileStyle only by modifying style in each frame, which causes a recompilation of shader. To prevent this we need a uniform containing the current time.

I see two possible implementation strategies we could use:
* Add a variable `${TIME}` which is a core variable like `${POSITION}`.
* Add interface to Cesium3DTileStyle to user defined uniforms.

Option 1: Implementing `${TIME}` should be easy - but there are some difficult questions: Which is the start time of `${TIME}`? Is 0 start of UNIX time or is 0 time of first frame of this shader? If you want be sure animation starts by 0 you need time of first frame. But if you store time of first frame and you have multiple styles it is hard to synchronize animations. So we could in my opinion we don't should provide this option, if we implement option 2.

Option 2: With adding support of user defined uniforms implementation of animations needs some more lines to user, but you can implement all variables like you want and you have a little better performance (e.g. you can process `${TIME} % 100` once on CPU side instead on GPU side for each vertex). And of course you can use this uniforms for other variables, too ;-).

What do you think about it? It could be we need this in near future, so maybe (if I have time and it has enough priority for us) I will implement it.

Contributor guide

Open the contributing guide

Research direction

Start at the Cesium3DTileStyle entry point and trace how changing a style causes shader recompilation. Resolve whether animation should use a core ${TIME} variable or user-defined uniforms, including the time origin and synchronization behavior. Done means the project has agreed on a concrete API and implementation scope; no specific files or tests are named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.