Sky gradient¶
In thermal imaging, a common artifact is observed where a small portion of the sky at the top of the image fades to black. This occurs because thermal cameras cannot capture the full dynamic range, resulting in a fade-to-black gradient effect.
Sky gradient controls¶
To reproduce this fade-to-black gradient artifact at the top of thermal images, adjust the following controls:
-
Specifies the base thermal temperature of the sky, which is the base color that the gradient transitions from into black. This value ranges from 0 to 1, where 0 represents the coldest (darkest) thermal state and 1 represents the warmest (brightest) thermal state.
Code for varying sky temperature
world.camera.thermal.set_sky_temperature(...) world.camera.thermal.set_sky_transition_point(0.2) world.camera.thermal.set_sky_gradient_intensity(0.5)
-
Defines where the fade-to-black gradient begins. This value ranges from 0 to 1, with 0 representing the top of the screen (screen space) or top of the sky (world space). 1 represents the bottom of the screen (screen space) or horizon (world space). Note that in screen space, the gradient effect is only evaluated to the horizon, even if the value would otherwise extend to the bottom of the screen. A value of 0 means there is no gradient at the top, so the sky remains visible with no darkening. As the value increases toward 1, the darkening gradient starts lower in the image, causing more of the sky to fade to black from the transition point upward.
Code for varying sky transition point
world.camera.thermal.set_sky_temperature(0.5) world.camera.thermal.set_sky_transition_point(...) world.camera.thermal.set_sky_gradient_intensity(0.5)
-
Controls the overall strength of the gradient effect. This value ranges from 0 to 1, where 0 makes the darkening very gradual and 1 makes it turn dark almost immediately above the transition point.
Code for varying sky gradient intensity
world.camera.thermal.set_sky_temperature(0.5) world.camera.thermal.set_sky_transition_point(1.0) world.camera.thermal.set_sky_gradient_intensity(...)
set_sky_transition_world_spaceControls whether the sky transition is calculated in world space or screen space. When enabled, the transition point is based on world space rather than screen space, providing consistent results regardless of camera orientation.
Code for toggling sky transition world space
world.camera.thermal.set_sky_transition_world_space(True)
Keyframing¶
If you prefer to adjust the sky gradient settings on a per frame basis, you can keyframe these values directly in a scenario.
scenario.set_keyframe(
world.camera,
frame_id=i,
thermal_sky_temperature=...,
thermal_sky_transition_point=...,
thermal_sky_gradient_intensity=...,
thermal_sky_transition_world_space=...,
)