13 float cospsi =
sin(thetav) *
sin(theta) *
cos(phi - phiv) +
cos(thetav) *
cos(theta);
41 float ctheta =
cos(theta);
42 float cgamma =
cos(gamma);
44 return (1.0f + lam03[0] *
exp(lam03[1] / ctheta)) *
45 (1.0f + lam03[2] *
exp(lam03[3] * gamma) + lam4 * cgamma * cgamma);
59 if (
y != 0.0f &&
Y != 0.0f) {
60 Z = ((1.0f -
x -
y) /
y) *
Y;
86 float theta = spherical[0];
87 float phi = spherical[1];
89 float suntheta = sun_angles[0];
90 float sunphi = sun_angles[1];
105 color =
float4(
dot(xyz_to_r, xyz),
dot(xyz_to_g, xyz),
dot(xyz_to_b, xyz), 1);
110 float4 config03,
float4 config47,
float config8,
float theta,
float gamma)
112 float ctheta =
cos(theta);
113 float cgamma =
cos(gamma);
115 float expM =
exp(config47[0] * gamma);
116 float rayM = cgamma * cgamma;
117 float mieM = (1.0f + rayM) /
pow((1.0f + config8 * config8 - 2.0f * config8 * cgamma), 1.5f);
118 float zenith =
sqrt(ctheta);
120 return (1.0f + config03[0] *
exp(config03[1] / (ctheta + 0.01f))) *
121 (config03[2] + config03[3] * expM + config47[1] * rayM + config47[2] * mieM +
122 config47[3] * zenith);
143 float theta = spherical[0];
144 float phi = spherical[1];
146 float suntheta = sun_angles[0];
147 float sunphi = sun_angles[1];
163 color =
float4(
dot(xyz_to_r, xyz),
dot(xyz_to_g, xyz),
dot(xyz_to_b, xyz), 1);
182 float dir_elevation =
M_PI_2 - spherical.
x;
183 float x = (spherical.
y +
M_PI + sun_rotation) / (2.0f *
M_PI);
188 float dir_elevation_abs = (dir_elevation < 0.0f) ? -dir_elevation : dir_elevation;
189 y =
sqrt(dir_elevation_abs /
M_PI_2) *
sign(dir_elevation) * 0.5f + 0.5f;
198 float sun_elevation = sun_params.
x;
199 float angular_diameter = sun_params.
y;
200 float sun_intensity = sun_params.
z;
201 float earth_intersection_angle = sun_params.
w;
202 if (angular_diameter > 0.0f && dir_elevation > earth_intersection_angle) {
203 float cos_elevation =
cos(sun_elevation);
205 -cos_elevation *
sin(sun_rotation), cos_elevation *
cos(sun_rotation),
sin(sun_elevation));
207 float half_angular = angular_diameter * 0.5f;
208 if (sun_angle < half_angular) {
210 float angle_fraction = sun_angle / half_angular;
211 float limb_darkening = 1.0f - 0.6f * (1.0f -
sin_from_cos(angle_fraction));
212 float sun_y = ((dir_elevation - sun_elevation) / angular_diameter) + 0.5f;
213 float3 disc =
mix(sun_pixel_bottom, sun_pixel_top, sun_y) * sun_intensity * limb_darkening;
218 color =
float4(rgb, 1.0f);
VecBase< float, D > normalize(VecOp< float, D >) RET
float dot(VecOp< float, D >, VecOp< float, D >) RET
MatBase< R, C > transpose(MatBase< C, R >) RET
float length(VecOp< float, D >) RET
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
SamplerBase< float, 2, false, true > sampler2DArray
float sky_perez_function(float4 lam03, float lam4, float theta, float gamma)
void node_tex_sky_preetham(float3 co, float4 config_Y03, float config_Y4, float4 config_x03, float config_x4, float4 config_y03, float config_y4, float2 sun_angles, float3 radiance, float3 xyz_to_r, float3 xyz_to_g, float3 xyz_to_b, float4 &color)
void node_tex_sky_hosekwilkie(float3 co, float4 config_x03, float4 config_x47, float4 config_y03, float4 config_y47, float4 config_z03, float4 config_z47, float3 config_xyz8, float2 sun_angles, float3 radiance, float3 xyz_to_r, float3 xyz_to_g, float3 xyz_to_b, float4 &color)
float sky_precise_angle(float3 a, float3 b)
float3 xyY_to_xyz(float x, float y, float Y)
float3 sky_spherical_coordinates(float3 dir)
void node_tex_sky_nishita(float3 co, float, float sun_rotation, float3 xyz_to_r, float3 xyz_to_g, float3 xyz_to_b, float3 sun_pixel_bottom, float3 sun_pixel_top, float4 sun_params, sampler2DArray ima, float layer, float4 &color)
float sky_radiance_hosekwilkie(float4 config03, float4 config47, float config8, float theta, float gamma)
float sky_angle_between(float thetav, float phiv, float theta, float phi)
float sin_from_cos(float c)
color xyz_to_rgb(float x, float y, float z)