-
Notifications
You must be signed in to change notification settings - Fork 103
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Cesium for Unreal includes a CesiumSunSky actor that creates a convincing sky, with some adjustable parameters to aid with geospatial accuracy and lighting customization. We should discuss implementing a similar actor in Cesium for Unity.
Additional context on CesiumSunSky:
- Much of Unreal's CesiumSunSky came from the Unreal Engine Sun Position Calculator plugin, so there was a smaller initial barrier to creating the actor. Our implementation was a modification of the Sun Position Calculator's SunSky actor.
- The primary modifications to the SunSky actor were hooking it up to the Georeference so that the calculated sun angle changed with scene location. We also made some adjustments to the atmosphere settings to avoid visual artifacts.
Desired result
To implement a comparable feature in Unity, we would likely need:
- A prefab GameObject to control sky settings. This could be drag-and-dropped into a scene, and even added to the Quick Add panel.
- A sky controller script that adjusts lighting and shading as needed. It will need to be able to calculate a sun angle based on a given longitude and latitude, date, and time.
- Available settings should include:
- Time of day (float, 0-24)
- Date (Day, month, year)
- Longitude and Latitude (Set by georeference)
- Consideration for Daylight Savings Time (This may be optional.)
- The sky controller should contain a Directional Light gameobject, or be able to reference one from the scene.
- A sky shader
- The color of the sky must change depending on the time of day from the sky controller
- The sky must fade to black as the camera moves away from earth.
Breakdown of current sky shader options in Unity
Available sky options differ between Unity's High Definition Render Pipeline (HDRP) and Universal Render Pipeline (URP). The HDRP options in terms of sky shading are generally suitable. On the shading side, our implementation would focus on URP, where the deficits are more obvious.
- URP
- Skybox material is set per-scene in the Lighting window (Window>Rendering>Lighting)
- Several preset skybox shader options exist. The most realistic is the Procedural Skybox shader, which allows for a skybox split horizontally between a sky and a ground color. The sky color changes with the angle of the sun, and appears black when the sun is set.
- The skybox is very obvious when viewing the earth from space - the background is the skybox's ground color, rather than black.

- Sun angle for skybox calculations is determined by angle of the scene's primary Directional Light actor.
- URP is optimized for many devices, including mobile - therefore a physically-accurate atmosphere calculation may be overkill. We can likely achieve suitable atmosphere visual effects through a custom sky shader.
- A custom sky shader will be needed to handle the transition between earth and space.
- HDRP
- Sky material is set by
- A suitable sky and atmosphere effect can be achieved with a Sky and Fog volume placed in the level. The Sky type should be set to Physically Based Sky.

This means we should not need a custom shader for HDRP. - The atmosphere suffers from spotty artifacts when viewing from space. As in Unreal, we may be able to resolve this by adjusting atmosphere settings based on view height.

Further considerations
- For URP, because the skybox material is determined by a scene setting rather than an object in the scene, we might need functionality to assign the skybox material through the sky controller gameobject.
- We likely would not want to name the sky implementation "CesiumSunSky", as the SunSky name came from Unreal plugin content. Perhaps "CesiumSkyController" instead.
- Some research will need to be done to determine the best way to support both URP and HDRP
JM-Elbambo, dhyams, 1zilc, shuaibowangfromCNH, pedoc and 4 more
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request