From 192bd2605f2580ee221d2e304fe2dfea573753d5 Mon Sep 17 00:00:00 2001 From: Lukas Stockner Date: Mon, 13 Jul 2020 01:51:13 +0200 Subject: Cycles: Change precomputed Sky Texture mapping to prioritize the horizon Differential Revision: https://developer.blender.org/D8091 --- intern/sky/source/sky_nishita.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'intern/sky/source') diff --git a/intern/sky/source/sky_nishita.cpp b/intern/sky/source/sky_nishita.cpp index 27286ddecac..a31d4b39f83 100644 --- a/intern/sky/source/sky_nishita.cpp +++ b/intern/sky/source/sky_nishita.cpp @@ -287,11 +287,13 @@ void SKY_nishita_skymodel_precompute_texture(float *pixels, float latitude_step = M_PI_2_F / height; float longitude_step = M_2PI_F / width; + float half_lat_step = latitude_step / 2.0f; for (int y = start_y; y < end_y; y++) { - float latitude = latitude_step * y; + /* sample more pixels toward the horizon */ + float latitude = (M_PI_2_F + half_lat_step) * sqr((float)y / height); - float *pixel_row = pixels + (y * width) * stride; + float *pixel_row = pixels + (y * width * stride); for (int x = 0; x < half_width; x++) { float longitude = longitude_step * x - M_PI_F; -- cgit v1.2.3