cesium icon indicating copy to clipboard operation
cesium copied to clipboard

Turn off direct lighting when environment maps are supplied

Open jjhembd opened this issue 1 year ago • 1 comments

Feature

In LightingStageFS, if image-based lighting is enabled, we currently add it to the already-computed direct lighting color. However, if users provide an environment map for lighting, they most likely expect that map to be the only light source.

The current setup can provide some surprising results. For example, here is the Clearcoat Car Paint model, with two specular reflections from the sun: one from the environment map, and one from the default Sunlight. image

The two-sun effect can be avoided with some hacks, such as setting Scene.light to a DirectionalLight with an intensity of 0. However, this is probably non-intuitive for most users. Also, the resulting lighting is somewhat too dim, and our current imageBasedLightingFactor does not allow values greater than 1.0.

Questions for the implementation:

  • Do we still want to support the current weighted combination of direct lighting and image-based lighting?
  • How should the API be structured to switch between lighting types?

jjhembd avatar Jun 06 '24 16:06 jjhembd

Summing the direct and IBL lighting results can also result in clipping artifacts when both light sources are near their maxima. See this image from @ggetz, as reported in https://github.com/CesiumGS/cesium/pull/12070#issuecomment-2217986123 image

jjhembd avatar Jul 09 '24 15:07 jjhembd