CARLA
Loading...
Searching...
No Matches
SkyLightMap.h
Go to the documentation of this file.
1// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#pragma once
8
9#include <util/ue-header-guard-begin.h>
10#include "CoreMinimal.h"
11#include <util/ue-header-guard-end.h>
12
13class UTextureCube;
14
15/// Environment-map support for the sky light (the `set_sky_light_map` RPC).
16///
17/// Convention of the input panorama (equirectangular, CARLA world frame,
18/// which is Unreal's left-handed X forward / Y right / Z up):
19/// column u in [0, W): azimuth phi = 2*pi * (u + 0.5) / W, measured from +X
20/// toward +Y (the same sense as a CARLA yaw: 0 = +X, 90 deg = +Y).
21/// row v in [0, H): elevation theta = pi/2 - pi * (v + 0.5) / H
22/// (row 0 = zenith, last row = nadir).
23/// direction d = (cos(theta) cos(phi), cos(theta) sin(phi), sin(theta)).
24/// Pixels are linear RGBA float, row-major, top row first. Values are scene
25/// radiance in whatever unit the caller wants; the sky light's Intensity is
26/// the multiplier on top.
28{
29 /// Resamples the panorama into a transient 6-face HDR cubemap
30 /// (PF_FloatRGBA, FaceSize x FaceSize per face) laid out in Unreal's
31 /// cubemap face convention (+X, -X, +Y, -Y, +Z, -Z, see GetCubemapVector in
32 /// ReflectionEnvironmentShaders.usf), so that sampling the cube with a
33 /// world direction returns the panorama value for that direction.
34 /// Returns nullptr on bad input. The texture is NOT rooted: the caller owns
35 /// keeping it alive.
36 CARLA_API UTextureCube* CreateCubemapFromEquirect(
37 const float* RGBA, int32 Width, int32 Height, int32 FaceSize = 512);
38}
Environment-map support for the sky light (the set_sky_light_map RPC).
Definition SkyLightMap.h:28
CARLA_API UTextureCube * CreateCubemapFromEquirect(const float *RGBA, int32 Width, int32 Height, int32 FaceSize=512)
Resamples the panorama into a transient 6-face HDR cubemap (PF_FloatRGBA, FaceSize x FaceSize per fac...