CesiumGS / CesiumGS/cesium

Multiple light sources and light types

Open
#8,518 12 comments 25 reactions 0 assignees View on GitHub
category - architecture / api category - graphics category - lighting theme - visual quality type - enhancement
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Custom light sources were added in https://github.com/AnalyticalGraphicsInc/cesium/pull/8493 but there are still some limitations: only one light is supported and it must be a directional light.

It would awesome to have a scene with sun lighting, moon lighting, street lamps, and car headlights all working together. This could really open up new rendering possibilities for Cesium.

I see these being the main API changes:
* Add `LightingCollection` class
* Deprecate and remove `scene.light` in favor of `scene.lights`
* Add `PointLight`, `SpotLight`, and other new light types
* Deprecate and remove `lightColor` from models and 3D Tiles

Some questions:
* How does this affect our rendering architecture? Do we care about supporting hundreds of lights efficiently? Do we need to move to deferred rendering or forward plus rendering, or whatever else is now state-of-the-art.
* Would this also be the time to switch to PBR everywhere? The globe, moon, and geometries are still using phong shading.
* Would we support light links? This would let you chose which primitives are lit by which light source. If implemented this would make an even better case for removing `lightColor` from models and 3D Tiles.
* How does this all work with the shadow system? We already support directional, point, and spot light shadows but the scene only has a single shadow map.
* How do we specify which light source affects globe lighting such as atmosphere and fog? See @IanLilleyT's comment in https://github.com/AnalyticalGraphicsInc/cesium/pull/8493:
> My main API confusion is Globe.dynamicAtmosphereLightingFromSun, since the light source is the sun in most cases anyway, and so users might think they must set this property too. I can't think of a better name though. This isn't a big deal as it might be solved in the future by giving the atmosphere system its own light source, and then we can remove this custom behavior for the sun.
* Which light types would we support? Here's what some other engines support:
* Babylon JS
* `PointLight`
* `DirectionalLight`
* `SpotLight`
* `HemisphericLight`
* ThreeJS
* `AmbientLight`
* `DirectionalLight`
* `HemisphereLight`
* `PointLight`
* `RectAreaLight`
* `SpotLight`

Contributor guide

Open the contributing guide

Research direction

Start by reviewing PR #8493 and the current custom-light implementation around scene.light. Clarify the intended scope for scene.lights and LightingCollection, supported light types, rendering architecture, shadows, atmosphere, and model or 3D Tiles lighting; done means an agreed design and implementation plan.

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.