Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/osl/shaders/node_sky_texture.osl
| Show First 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | color sky_radiance_nishita(vector dir, float nishita_data[10], string filename) | ||||
| /* render above the horizon */ | /* render above the horizon */ | ||||
| if (dir[2] >= 0.0) { | if (dir[2] >= 0.0) { | ||||
| /* definitions */ | /* definitions */ | ||||
| vector sun_dir = geographical_to_direction(sun_elevation, sun_rotation + M_PI_2); | vector sun_dir = geographical_to_direction(sun_elevation, sun_rotation + M_PI_2); | ||||
| float sun_dir_angle = precise_angle(dir, sun_dir); | float sun_dir_angle = precise_angle(dir, sun_dir); | ||||
| float half_angular = angular_diameter / 2.0; | float half_angular = angular_diameter / 2.0; | ||||
| float dir_elevation = M_PI_2 - direction[0]; | float dir_elevation = M_PI_2 - direction[0]; | ||||
| /* if ray inside sun disc render it, otherwise render sky */ | /* if ray inside sun disc render it, otherwise render sky. | ||||
| if (sun_dir_angle < half_angular && sun_disc == 1) { | * alternatively, ignore the sun if we're evaluating the background texture. */ | ||||
| if (sun_dir_angle < half_angular && sun_disc == 1 && raytype("importance_bake") != 1) { | |||||
| /* get 2 pixels data */ | /* get 2 pixels data */ | ||||
| color pixel_bottom = color(nishita_data[0], nishita_data[1], nishita_data[2]); | color pixel_bottom = color(nishita_data[0], nishita_data[1], nishita_data[2]); | ||||
| color pixel_top = color(nishita_data[3], nishita_data[4], nishita_data[5]); | color pixel_top = color(nishita_data[3], nishita_data[4], nishita_data[5]); | ||||
| float y; | float y; | ||||
| /* sun interpolation */ | /* sun interpolation */ | ||||
| if (sun_elevation - half_angular > 0.0) { | if (sun_elevation - half_angular > 0.0) { | ||||
| if ((sun_elevation + half_angular) > 0.0) { | if ((sun_elevation + half_angular) > 0.0) { | ||||
| ▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines | |||||