cesium-unreal icon indicating copy to clipboard operation
cesium-unreal copied to clipboard

SkyLight should be attached to Pawn instead of CesiumSunSky

Open kring opened this issue 2 years ago • 2 comments

Unreal's SkyLight component captures atmospheric lighting conditions (such as a bright blue sky, or a sunset, or even shadows from clouds), and uses it to light your scene. It's especially useful for filling areas that would otherwise be very dark.

For example, without a Sky Light: image

With a Sky Light: image

We currently include a SkyLight component in the CesiumSunSky Actor, and we place it at the CesiumGeoreference origin. This is fine if you're near the origin, but it breaks down when you move far away from it. For example, if it's dark at the georeference origin, but light where you're actually looking, then you'll get those dark shadows in the first screenshot above because the SkyLight won't be contributing anything.

Instead of placing the SkyLight component at the georeference origin, we should place it wherever the user is located. An easy way to do this is to add it to the DynamicPawn. Then it will automatically travel around with the player and dynamically capture the sky lighting conditions wherever it goes.

kring avatar Jul 19 '23 01:07 kring

I think the best approach here is:

  1. Remove the SkyLight component from CesiumSunSky.
  2. Add a SkyLight to DynamicPawn (but make it easy to disable, in case the user is using a different lighting setup)
  3. Make sure the lighting tutorial(s) cover this.

We should do 1 and 2 (and probably 3) in 2.0 because it's a potentially breaking change.

kring avatar Jul 19 '23 02:07 kring

I see some of the related code.

Question though, what if the level doesn't have a DynamicPawn? Will it not get a SkyLight?

One other approach might be to leave the SkyLight under the CesiumSunSky, and have it try to find a DynamicPawn to attach to. If none, try to attach to whatever the active camera in the scene is. If all else fails, default to the Georeference origin.

image

csciguy8 avatar Sep 14 '23 21:09 csciguy8