From 499bec2a85f892f170ab46c97a0f268ee5acdc0a Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Fri, 30 Aug 2013 18:04:23 +0000 Subject: [PATCH] Fix for [#36610] The new sky model produces strange results * Clamp theta sky coordinates, to prevent a negative solarElevation. Note: This means that you cannot get absolute night with the new model, but this is not supported anyway. So when you reach the maximum sunset, use the World Strength to further decrease the light. --- intern/cycles/render/nodes.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 676b628f458..a9c17c8bcd5 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -464,6 +464,9 @@ static void sky_texture_precompute_new(SunSky *sunsky, float3 dir, float turbidi float2 spherical = sky_spherical_coordinates(dir); float theta = spherical.x; float phi = spherical.y; + + /* Clamp to Horizon */ + theta = clamp(theta, 0.0f, M_PI_2_F); sunsky->theta = theta; sunsky->phi = phi;