Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/svm/svm_sky.h
| Show All 31 Lines | |||||
| { | { | ||||
| float ctheta = cosf(theta); | float ctheta = cosf(theta); | ||||
| float cgamma = cosf(gamma); | float cgamma = cosf(gamma); | ||||
| return (1.0f + lam[0] * expf(lam[1] / ctheta)) * | return (1.0f + lam[0] * expf(lam[1] / ctheta)) * | ||||
| (1.0f + lam[2] * expf(lam[3] * gamma) + lam[4] * cgamma * cgamma); | (1.0f + lam[2] * expf(lam[3] * gamma) + lam[4] * cgamma * cgamma); | ||||
| } | } | ||||
| ccl_device float3 sky_radiance_preetham(ccl_global const KernelGlobals *kg, | ccl_device float3 sky_radiance_preetham(KernelGlobals kg, | ||||
| float3 dir, | float3 dir, | ||||
| float sunphi, | float sunphi, | ||||
| float suntheta, | float suntheta, | ||||
| float radiance_x, | float radiance_x, | ||||
| float radiance_y, | float radiance_y, | ||||
| float radiance_z, | float radiance_z, | ||||
| ccl_private float *config_x, | ccl_private float *config_x, | ||||
| ccl_private float *config_y, | ccl_private float *config_y, | ||||
| Show All 36 Lines | float mieM = (1.0f + rayM) / powf((1.0f + configuration[8] * configuration[8] - | ||||
| 1.5f); | 1.5f); | ||||
| float zenith = sqrtf(ctheta); | float zenith = sqrtf(ctheta); | ||||
| return (1.0f + configuration[0] * expf(configuration[1] / (ctheta + 0.01f))) * | return (1.0f + configuration[0] * expf(configuration[1] / (ctheta + 0.01f))) * | ||||
| (configuration[2] + configuration[3] * expM + configuration[5] * rayM + | (configuration[2] + configuration[3] * expM + configuration[5] * rayM + | ||||
| configuration[6] * mieM + configuration[7] * zenith); | configuration[6] * mieM + configuration[7] * zenith); | ||||
| } | } | ||||
| ccl_device float3 sky_radiance_hosek(ccl_global const KernelGlobals *kg, | ccl_device float3 sky_radiance_hosek(KernelGlobals kg, | ||||
| float3 dir, | float3 dir, | ||||
| float sunphi, | float sunphi, | ||||
| float suntheta, | float suntheta, | ||||
| float radiance_x, | float radiance_x, | ||||
| float radiance_y, | float radiance_y, | ||||
| float radiance_z, | float radiance_z, | ||||
| ccl_private float *config_x, | ccl_private float *config_x, | ||||
| ccl_private float *config_y, | ccl_private float *config_y, | ||||
| Show All 20 Lines | |||||
| } | } | ||||
| /* Nishita improved sky model */ | /* Nishita improved sky model */ | ||||
| ccl_device float3 geographical_to_direction(float lat, float lon) | ccl_device float3 geographical_to_direction(float lat, float lon) | ||||
| { | { | ||||
| return make_float3(cos(lat) * cos(lon), cos(lat) * sin(lon), sin(lat)); | return make_float3(cos(lat) * cos(lon), cos(lat) * sin(lon), sin(lat)); | ||||
| } | } | ||||
| ccl_device float3 sky_radiance_nishita(ccl_global const KernelGlobals *kg, | ccl_device float3 sky_radiance_nishita(KernelGlobals kg, | ||||
| float3 dir, | float3 dir, | ||||
| ccl_private float *nishita_data, | ccl_private float *nishita_data, | ||||
| uint texture_id) | uint texture_id) | ||||
| { | { | ||||
| /* definitions */ | /* definitions */ | ||||
| float sun_elevation = nishita_data[6]; | float sun_elevation = nishita_data[6]; | ||||
| float sun_rotation = nishita_data[7]; | float sun_rotation = nishita_data[7]; | ||||
| float angular_diameter = nishita_data[8]; | float angular_diameter = nishita_data[8]; | ||||
| ▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | else { | ||||
| xyz = float4_to_float3(kernel_tex_image_interp(kg, texture_id, x, -0.5)) * fade; | xyz = float4_to_float3(kernel_tex_image_interp(kg, texture_id, x, -0.5)) * fade; | ||||
| } | } | ||||
| } | } | ||||
| /* convert to RGB */ | /* convert to RGB */ | ||||
| return xyz_to_rgb(kg, xyz); | return xyz_to_rgb(kg, xyz); | ||||
| } | } | ||||
| ccl_device_noinline int svm_node_tex_sky(ccl_global const KernelGlobals *kg, | ccl_device_noinline int svm_node_tex_sky( | ||||
| ccl_private ShaderData *sd, | KernelGlobals kg, ccl_private ShaderData *sd, ccl_private float *stack, uint4 node, int offset) | ||||
| ccl_private float *stack, | |||||
| uint4 node, | |||||
| int offset) | |||||
| { | { | ||||
| /* Load data */ | /* Load data */ | ||||
| uint dir_offset = node.y; | uint dir_offset = node.y; | ||||
| uint out_offset = node.z; | uint out_offset = node.z; | ||||
| int sky_model = node.w; | int sky_model = node.w; | ||||
| float3 dir = stack_load_float3(stack, dir_offset); | float3 dir = stack_load_float3(stack, dir_offset); | ||||
| float3 f; | float3 f; | ||||
| ▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines | |||||