View source: R/sky_light_image.R
| sky_light_image | R Documentation |
Generate a cached sky EXR with skymodelr::generate_sky_latlong() and use it
as an infinite light. Add it to a scene with add_infinite_light(). The image
represents one observer and illuminates every scene position with the same
sky. Use sky_light() for altitude-dependent lighting and finite-distance haze.
Both constructors include Sun and Moon by default, controlled with sun and
moon, and support optional stars and planets.
sky_light_image(
lat,
long,
datetime,
intensity = 1,
rotation = 0,
name = "sky",
altitude = 0,
visibility = 131.8,
albedo = 0.5,
resolution = 2048,
hosek = TRUE,
render_mode = "all",
turbidity = 3,
wide_spectrum = FALSE,
below_horizon = TRUE,
prague_rgb_correction = TRUE,
prague_rgb_correction_strength = 1,
prague_rgb_correction_gain = "auto",
stars = FALSE,
star_width = 1,
stars_exposure = 0,
planets = FALSE,
moon = TRUE,
moon_atmosphere = FALSE,
moon_hosek = TRUE,
exr_adopted_white = "D60",
exr_metadata = TRUE,
number_cores = 1,
verbose = FALSE,
sun = TRUE,
environment_light_bake_white = FALSE,
environment_light_bake_white_target = "D65",
...
)
lat |
Latitude in degrees, between -90 and 90. |
long |
Longitude in degrees, between -180 and 180. |
datetime |
A single |
intensity |
Default |
rotation |
Default |
name |
Default |
altitude |
Default |
visibility |
Default |
albedo |
Default |
resolution |
Default |
hosek |
Default |
render_mode |
Default |
turbidity |
Default |
wide_spectrum |
Default |
below_horizon |
Default |
prague_rgb_correction |
Default |
prague_rgb_correction_strength |
Default |
prague_rgb_correction_gain |
Default |
stars |
Default |
star_width |
Default |
stars_exposure |
Default |
planets |
Default |
moon |
Default |
moon_atmosphere |
Default |
moon_hosek |
Default |
exr_adopted_white |
Default |
exr_metadata |
Default |
number_cores |
Default |
verbose |
Default |
sun |
Default |
environment_light_bake_white |
Default |
environment_light_bake_white_target |
Default |
... |
Additional named arguments forwarded by
|
Image generation happens before rendering and is cached for the R
session. Changing only intensity, rotation, or name reuses the image.
Changing the baked target white point reuses the generated sky and caches a
separate adapted image. White-balance controls belong to this light; pass the
light to add_infinite_light() before calling render_scene() or
render_animation().
Install any required Prague data with skymodelr::download_sky_data() first;
rendering does not download datasets.
With zero rotation, north is world +Z and east is world -X. Date, time, and
observer altitude remain fixed throughout the image. This light supports the
same integrators as infinite_light() and adds no finite atmospheric haze.
Use render_scene()'s iso to adjust exposure.
For a separately sampled Sun, set render_mode = "atmosphere" and add
sun_light() with matching location, time, and atmospheric settings. This
avoids relying on the environment image to resolve the small solar disk.
A ray_infinite_light containing a cached-image sky description.
sky_light(), infinite_light(), sun_light(), moon_light()
time = as.POSIXct("2026-06-21 18:00:00", tz = "America/New_York")
scene = sphere(material = diffuse("white")) |>
add_object(generate_ground())
scene |>
add_infinite_light(sky_light_image(40.7, -74, time)) |>
render_scene(
lookfrom = c(0, 1, 10),
lookat = c(0, 0, 0),
width = 600,
height = 300,
samples = 32,
iso = 3
)
# A Prague image sky with an independently sampled solar disk.
# Install Prague data with skymodelr::download_sky_data() before rendering.
scene |>
add_infinite_light(sky_light_image(
40.7,
-74,
time,
hosek = FALSE,
render_mode = "atmosphere",
altitude = 0,
visibility = 50,
albedo = 0.3
)) |>
add_infinite_light(sun_light(
40.7,
-74,
time,
sky_args = list(altitude = 0, visibility = 50, albedo = 0.3)
)) |>
render_scene(
lookfrom = c(0, 1, 10),
lookat = c(0, 0, 0),
aperture = 0,
width = 600,
height = 300,
samples = 32,
iso = 3
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.