22 float ctheta =
cosf(theta);
23 float cgamma =
cosf(gamma);
25 return (1.0f + lam[0] *
expf(lam[1] / ctheta)) *
26 (1.0f + lam[2] *
expf(lam[3] * gamma) + lam[4] * cgamma * cgamma);
42 float theta = spherical.
x;
43 float phi = spherical.
y;
67 float ctheta =
cosf(theta);
68 float cgamma =
cosf(gamma);
70 float expM =
expf(configuration[4] * gamma);
71 float rayM = cgamma * cgamma;
72 float mieM = (1.0f + rayM) /
powf((1.0f + configuration[8] * configuration[8] -
73 2.0f * configuration[8] * cgamma),
75 float zenith =
sqrtf(ctheta);
77 return (1.0f + configuration[0] *
expf(configuration[1] / (ctheta + 0.01f))) *
78 (configuration[2] + configuration[3] * expM + configuration[5] * rayM +
79 configuration[6] * mieM + configuration[7] * zenith);
95 float theta = spherical.
x;
96 float phi = spherical.
y;
127 float sun_elevation = nishita_data[0];
128 float sun_rotation = nishita_data[1];
129 float angular_diameter = nishita_data[2];
130 float sun_intensity = nishita_data[3];
131 bool sun_disc = (angular_diameter >= 0.0f);
140 float half_angular = angular_diameter / 2.0f;
141 float dir_elevation =
M_PI_2_F - direction.
x;
144 if (sun_disc && sun_dir_angle < half_angular) {
149 if (sun_elevation - half_angular > 0.0f) {
150 if (sun_elevation + half_angular > 0.0f) {
151 y = ((dir_elevation - sun_elevation) / angular_diameter) + 0.5f;
152 xyz =
interp(pixel_bottom, pixel_top,
y) * sun_intensity;
156 if (sun_elevation + half_angular > 0.0f) {
157 y = dir_elevation / (sun_elevation + half_angular);
158 xyz =
interp(pixel_bottom, pixel_top,
y) * sun_intensity;
162 float limb_darkening = (1.0f -
163 0.6f * (1.0f -
sqrtf(1.0f -
sqr(sun_dir_angle / half_angular))));
164 xyz *= limb_darkening;
185 float fade = 1.0f + dir.
z * 2.5f;
206 int sky_model =
node.w;
212 if (sky_model == 0 || sky_model == 1) {
214 float sunphi, suntheta, radiance_x, radiance_y, radiance_z;
215 float config_x[9], config_y[9], config_z[9];
225 config_x[0] =
data.y;
226 config_x[1] =
data.z;
227 config_x[2] =
data.w;
230 config_x[3] =
data.x;
231 config_x[4] =
data.y;
232 config_x[5] =
data.z;
233 config_x[6] =
data.w;
236 config_x[7] =
data.x;
237 config_x[8] =
data.y;
238 config_y[0] =
data.z;
239 config_y[1] =
data.w;
242 config_y[2] =
data.x;
243 config_y[3] =
data.y;
244 config_y[4] =
data.z;
245 config_y[5] =
data.w;
248 config_y[6] =
data.x;
249 config_y[7] =
data.y;
250 config_y[8] =
data.z;
251 config_z[0] =
data.w;
254 config_z[1] =
data.x;
255 config_z[2] =
data.y;
256 config_z[3] =
data.z;
257 config_z[4] =
data.w;
260 config_z[5] =
data.x;
261 config_z[6] =
data.y;
262 config_z[7] =
data.z;
263 config_z[8] =
data.w;
266 if (sky_model == 0) {
294 float nishita_data[4];
299 pixel_top.
x =
data.w;
302 pixel_top.
y =
data.x;
303 pixel_top.
z =
data.y;
304 nishita_data[0] =
data.z;
305 nishita_data[1] =
data.w;
308 nishita_data[2] =
data.x;
309 nishita_data[3] =
data.y;
MINLINE float safe_sqrtf(float a)
MINLINE float safe_acosf(float a)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its Y
#define ccl_device_noinline
#define CCL_NAMESPACE_END
CCL_NAMESPACE_BEGIN ccl_device float2 direction_to_spherical(float3 dir)
const KernelGlobalsCPU *ccl_restrict KernelGlobals
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
ccl_device_inline float4 read_node_float(KernelGlobals kg, ccl_private int *offset)
ccl_device_inline void stack_store_float3(ccl_private float *stack, uint a, float3 f)
CCL_NAMESPACE_BEGIN ccl_device_inline float3 stack_load_float3(ccl_private float *stack, uint a)
ccl_device float3 xyz_to_rgb_clamped(KernelGlobals kg, float3 xyz)
ccl_device_inline float2 interp(const float2 &a, const float2 &b, float t)
ccl_device float4 kernel_tex_image_interp(KernelGlobals kg, int id, float x, float y)
color xyY_to_xyz(float x, float y, float Y)
CCL_NAMESPACE_BEGIN ccl_device float fade(float t)
ccl_device float3 sky_radiance_hosek(KernelGlobals kg, float3 dir, float sunphi, float suntheta, float radiance_x, float radiance_y, float radiance_z, ccl_private float *config_x, ccl_private float *config_y, ccl_private float *config_z)
ccl_device_noinline int svm_node_tex_sky(KernelGlobals kg, ccl_private ShaderData *sd, ccl_private float *stack, uint4 node, int offset)
ccl_device float3 geographical_to_direction(float lat, float lon)
ccl_device float3 sky_radiance_preetham(KernelGlobals kg, float3 dir, float sunphi, float suntheta, float radiance_x, float radiance_y, float radiance_z, ccl_private float *config_x, ccl_private float *config_y, ccl_private float *config_z)
CCL_NAMESPACE_BEGIN ccl_device float sky_angle_between(float thetav, float phiv, float theta, float phi)
ccl_device float sky_perez_function(ccl_private float *lam, float theta, float gamma)
ccl_device float sky_radiance_internal(ccl_private float *configuration, float theta, float gamma)
ccl_device float3 sky_radiance_nishita(KernelGlobals kg, float3 dir, float3 pixel_bottom, float3 pixel_top, ccl_private float *nishita_data, uint texture_id)
ccl_device_inline uint __float_as_uint(float f)
ccl_device_inline float sqr(float a)
ccl_device_inline float precise_angle(float3 a, float3 b)
ccl_device_inline float3 float4_to_float3(const float4 a)