Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple light sources and light types #8518

Open
lilleyse opened this issue Jan 8, 2020 · 11 comments
Open

Multiple light sources and light types #8518

lilleyse opened this issue Jan 8, 2020 · 11 comments

Comments

@lilleyse
Copy link
Contributor

lilleyse commented Jan 8, 2020

Custom light sources were added in #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 Custom light source #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
@emackey
Copy link
Contributor

emackey commented Jan 8, 2020

For reference, STK supports:

  • Directional
  • Positional (Point light)
  • Spot

Spot and Positional each have a position that can be specified in any of STK's various coordinate frames, allowing for example headlights on a vehicle to ride along with it, etc. These also offer constant, linear, and quadratic falloff.

Spot and Directional can be aimed from one frame to another (for example Sun to Earth, or one moving vehicle to another like a helicopter search light tracking a car).

For glTF 2.0 models, it's worth considering IBL as an additional form of lighting.

@weiyinggh
Copy link

Please ask when multi light source can support, thank you

@hugcoday
Copy link

hugcoday commented May 25, 2022

Babylon JS

  • PointLight
  • DirectionalLight
  • SpotLight
  • HemisphericLight

ThreeJS

  • AmbientLight
  • DirectionalLight
  • HemisphereLight
  • PointLight
  • RectAreaLight
  • SpotLight

Above the light can be supported ?

@ggetz
Copy link
Contributor

ggetz commented Dec 9, 2022

@ggetz
Copy link
Contributor

ggetz commented Jul 31, 2023

Point light sources requested in #11431.

@nuclearsecrecy
Copy link

I just wanted to put in another +1 for this — if Cesium allowed for the rendering of actual light sources, it would DRAMATICALLY increase its usability for a million different applications. Being limited to essentially a single light source is very limiting. Obviously this is non-trivially difficult to implement. But it would be HUGE if it could be. HUGE! :-)

@emackey
Copy link
Contributor

emackey commented Dec 1, 2023

My $0.02: From the PBR 3D model point of view, having robust support for HDRI / IBL environment lighting can dramatically improve the look of models, to the point where all the various ThreeJS/BabylonJS/STK light source types described above are actually discouraged as they interfere and/or compete with natural IBL lighting.

It might be interesting to light an entire set of 3D Tiles from an IBL, and see if that yields better results than the default or a point light someplace.

@nuclearsecrecy
Copy link

I imagine it depends on what one is trying to do with it, yes? I am interested in being able to bring 3D models into a Cesium JS environment, and am not worried so much about the appearance of 3D Tiles. Being able to model multiple light sources, and/or having a real emission property for objects, is absolutely necessary if one wants flexibility for modeling anything other than a building. I'm interested in being able to render non-Sun lights, night scenes, better clouds, fog, smoke, glowing things, etc. Some of these things require more than multiple point or directional light sources to work well, of course, but you can fake a lot of them if you had them (and it's hard to fake them without them).

@JensonMiao
Copy link

I really hope to see multiple light sources in Cesium, it would make the virtual earth scenes more realistic. I hope you can consider this suggestion, thank you!

@nghiajenius-dev
Copy link

Hi @lilleyse, @ggetz,
I see there is an example of multiple shadows in Cesium, but when I tried it, only the first shadowmap in the list is rendered in the view scene. Do you have any idea why or how can I add multiple shadowmaps in the scene? Thanks alot!

@syzdev
Copy link
Contributor

syzdev commented Jun 19, 2024

@nghiajenius-dev In that example, only multiple shadow maps were created, but only one shadow map can take effect, and it is currently not possible to add multiple shadow maps to the scene.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment