diff options
Diffstat (limited to 'intern/cycles/kernel/shaders/node_environment_texture.osl')
-rw-r--r-- | intern/cycles/kernel/shaders/node_environment_texture.osl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/intern/cycles/kernel/shaders/node_environment_texture.osl b/intern/cycles/kernel/shaders/node_environment_texture.osl index 90c7ce475ae..4367f7f4994 100644 --- a/intern/cycles/kernel/shaders/node_environment_texture.osl +++ b/intern/cycles/kernel/shaders/node_environment_texture.osl @@ -19,14 +19,16 @@ #include "stdosl.h" #include "node_color.h" -vector environment_texture_direction_to_equirectangular(vector dir) { +vector environment_texture_direction_to_equirectangular(vector dir) +{ float u = -atan2(dir[1], dir[0])/(2.0*M_PI) + 0.5; float v = atan2(dir[2], hypot(dir[0], dir[1]))/M_PI + 0.5; return vector(u, v, 0.0); } -vector environment_texture_direction_to_mirrorball(vector dir) { +vector environment_texture_direction_to_mirrorball(vector dir) +{ dir[1] -= 1.0; float div = 2.0*sqrt(max(-0.5*dir[1], 0.0)); |