Blender V5.0
sky_multiple_scattering.cpp File Reference
#include <algorithm>
#include "sky_math.h"
#include "sky_nishita.h"

Go to the source code of this file.

Classes

class  SkyMultipleScattering

Functions

float molecular_phase_function (const float cos_theta)
float aerosol_phase_function (const float cos_theta)
float4 get_molecular_scattering_coefficient (const float h)
float4 get_molecular_absorption_coefficient (const float h)
float get_aerosol_density (const float h)
float3 spectral_to_xyz (const float4 L)
void SKY_multiple_scattering_precompute_texture (float *pixels, int stride, int width, int height, float sun_elevation, float altitude, float air_density, float aerosol_density, float ozone_density)
void SKY_multiple_scattering_precompute_sun (float sun_elevation, float angular_diameter, float altitude, float air_density, float aerosol_density, float ozone_density, float r_pixel_bottom[3], float r_pixel_top[3])
float SKY_earth_intersection_angle (float altitude)

Variables

static const float4 GROUND_ALBEDO = make_float4(0.3f, 0.3f, 0.3f, 0.3f)
static const float PHASE_ISOTROPIC = M_1_4PI_F
static const float RAYLEIGH_PHASE_SCALE = (3.0f / 16.0f) * M_1_PI_F
static const float G = 0.8f
static const float SQR_G = G * G
static const float EARTH_RADIUS = 6371.0f
static const float ATMOSPHERE_THICKNESS = 100.0f
static const float ATMOSPHERE_RADIUS = EARTH_RADIUS + ATMOSPHERE_THICKNESS
static const int TRANSMITTANCE_STEPS = 64
static const int IN_SCATTERING_STEPS = 64
static const int TRANSMITTANCE_RES_X = 256
static const int TRANSMITTANCE_RES_Y = 64
static const float4 SUN_SPECTRAL_IRRADIANCE = make_float4(1.679f, 1.828f, 1.986f, 1.307f)
static const float4 MOLECULAR_SCATTERING_COEFFICIENT_BASE
static const float4 OZONE_ABSORPTION_CROSS_SECTION
static const float OZONE_MEAN_DOBSON = 334.5f
static const float4 AEROSOL_ABSORPTION_CROSS_SECTION
static const float4 AEROSOL_SCATTERING_CROSS_SECTION
static const float AEROSOL_BASE_DENSITY = 1.3681e20f
static const float AEROSOL_BACKGROUND_DENSITY = 2e6f
static const float AEROSOL_HEIGHT_SCALE = 0.73f
static const float3 SPECTRAL_XYZ [4]

Function Documentation

◆ aerosol_phase_function()

float aerosol_phase_function ( const float cos_theta)
inline

Definition at line 88 of file sky_multiple_scattering.cpp.

References cos_theta(), G, M_1_4PI_F, SQR_G, and sqrtf.

Referenced by SkyMultipleScattering::get_inscattering().

◆ get_aerosol_density()

◆ get_molecular_absorption_coefficient()

float4 get_molecular_absorption_coefficient ( const float h)
inline

◆ get_molecular_scattering_coefficient()

float4 get_molecular_scattering_coefficient ( const float h)
inline

◆ molecular_phase_function()

float molecular_phase_function ( const float cos_theta)
inline

◆ SKY_earth_intersection_angle()

float SKY_earth_intersection_angle ( float altitude)

Definition at line 397 of file sky_multiple_scattering.cpp.

References asinf, EARTH_RADIUS, and M_PI_2_F.

Referenced by sky_texture_precompute_nishita().

◆ SKY_multiple_scattering_precompute_sun()

void SKY_multiple_scattering_precompute_sun ( float sun_elevation,
float angular_diameter,
float altitude,
float air_density,
float aerosol_density,
float ozone_density,
float r_pixel_bottom[3],
float r_pixel_top[3] )

◆ SKY_multiple_scattering_precompute_texture()

◆ spectral_to_xyz()

float3 spectral_to_xyz ( const float4 L)
inline

Variable Documentation

◆ AEROSOL_ABSORPTION_CROSS_SECTION

const float4 AEROSOL_ABSORPTION_CROSS_SECTION
static
Initial value:
2.8722e-24f, 4.6168e-24f, 7.9706e-24f, 1.3578e-23f)
#define make_float4

Definition at line 68 of file sky_multiple_scattering.cpp.

Referenced by SkyMultipleScattering::get_atmosphere_collision_coefficients().

◆ AEROSOL_BACKGROUND_DENSITY

const float AEROSOL_BACKGROUND_DENSITY = 2e6f
static

Definition at line 73 of file sky_multiple_scattering.cpp.

Referenced by get_aerosol_density().

◆ AEROSOL_BASE_DENSITY

const float AEROSOL_BASE_DENSITY = 1.3681e20f
static

Definition at line 72 of file sky_multiple_scattering.cpp.

Referenced by get_aerosol_density().

◆ AEROSOL_HEIGHT_SCALE

const float AEROSOL_HEIGHT_SCALE = 0.73f
static

Definition at line 74 of file sky_multiple_scattering.cpp.

Referenced by get_aerosol_density().

◆ AEROSOL_SCATTERING_CROSS_SECTION

const float4 AEROSOL_SCATTERING_CROSS_SECTION
static
Initial value:
1.5908e-22f, 1.7711e-22f, 2.0942e-22f, 2.4033e-22f)

Definition at line 70 of file sky_multiple_scattering.cpp.

Referenced by SkyMultipleScattering::get_atmosphere_collision_coefficients().

◆ ATMOSPHERE_RADIUS

◆ ATMOSPHERE_THICKNESS

const float ATMOSPHERE_THICKNESS = 100.0f
static

◆ EARTH_RADIUS

◆ G

const float G = 0.8f
static

Definition at line 45 of file sky_multiple_scattering.cpp.

◆ GROUND_ALBEDO

const float4 GROUND_ALBEDO = make_float4(0.3f, 0.3f, 0.3f, 0.3f)
static

◆ IN_SCATTERING_STEPS

const int IN_SCATTERING_STEPS = 64
static

Definition at line 54 of file sky_multiple_scattering.cpp.

Referenced by SkyMultipleScattering::get_inscattering().

◆ MOLECULAR_SCATTERING_COEFFICIENT_BASE

const float4 MOLECULAR_SCATTERING_COEFFICIENT_BASE
static
Initial value:
6.605e-3f, 1.067e-2f, 1.842e-2f, 3.156e-2f)

Definition at line 62 of file sky_multiple_scattering.cpp.

Referenced by get_molecular_scattering_coefficient().

◆ OZONE_ABSORPTION_CROSS_SECTION

const float4 OZONE_ABSORPTION_CROSS_SECTION
static
Initial value:
3.472e-25f, 3.914e-25f, 1.349e-25f, 11.03e-27f)

Definition at line 64 of file sky_multiple_scattering.cpp.

Referenced by get_molecular_absorption_coefficient().

◆ OZONE_MEAN_DOBSON

const float OZONE_MEAN_DOBSON = 334.5f
static

Definition at line 67 of file sky_multiple_scattering.cpp.

Referenced by get_molecular_absorption_coefficient().

◆ PHASE_ISOTROPIC

const float PHASE_ISOTROPIC = M_1_4PI_F
static

◆ RAYLEIGH_PHASE_SCALE

const float RAYLEIGH_PHASE_SCALE = (3.0f / 16.0f) * M_1_PI_F
static

Definition at line 43 of file sky_multiple_scattering.cpp.

Referenced by molecular_phase_function().

◆ SPECTRAL_XYZ

const float3 SPECTRAL_XYZ[4]
static
Initial value:
= {
make_float3(53.386917738564668023f, 22.981337506691024754f, 0.0f),
make_float3(43.904844466369358263f, 71.347795700053393866f, 0.102506867965741307f),
make_float3(1.6137278251608962005f, 18.422960591455485011f, 31.742921188390805758f),
make_float3(20.762668673810577145f, 2.3614213523314368527f, 110.48009643252140334f),
}
ccl_device_forceinline float3 make_float3(const float x, const float y, const float z)

Definition at line 76 of file sky_multiple_scattering.cpp.

Referenced by spectral_to_xyz().

◆ SQR_G

const float SQR_G = G * G
static

Definition at line 46 of file sky_multiple_scattering.cpp.

Referenced by aerosol_phase_function(), and phase_mie().

◆ SUN_SPECTRAL_IRRADIANCE

const float4 SUN_SPECTRAL_IRRADIANCE = make_float4(1.679f, 1.828f, 1.986f, 1.307f)
static

◆ TRANSMITTANCE_RES_X

◆ TRANSMITTANCE_RES_Y

◆ TRANSMITTANCE_STEPS

const int TRANSMITTANCE_STEPS = 64
static