commit 92bbf9ae66bdc1c165263a2623946396528238b3
parent b388fd6822edd4712e9a14f4b678e65100d38c0d
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 7 Feb 2018 20:51:02 +0100
Merge branch 'release_0.7.2'
Diffstat:
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
@@ -26,6 +26,10 @@ variable the install directories of its dependencies.
## Release notes
+### Version 0.7.2
+
+- Fix the gaussian sunshape.
+
### Version 0.7.1
- Fix the creation of a glossy BSDF that uses a pillbox microfacet
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -51,7 +51,7 @@ rcmake_append_runtime_dirs(_runtime_dirs RSys Star3D Star3DUT StarCPR StarSF Sta
################################################################################
set(VERSION_MAJOR 0)
set(VERSION_MINOR 7)
-set(VERSION_PATCH 1)
+set(VERSION_PATCH 2)
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
set(SSOL_FILES_SRC
diff --git a/src/ssol_ranst_sun_dir.c b/src/ssol_ranst_sun_dir.c
@@ -275,16 +275,20 @@ ran_gaussian_get
double dir[3])
{
double pt[3];
- double phi, theta, sin_theta;
+ double phi, cos_theta, sin_theta;
+ /* The following is not truly a gaussian sunshape,
+ * but an accurate enough approximation for small angles */
ASSERT(ran && 0 <= ran->state.gaussian.std_dev);
- theta = ssp_ran_gaussian(rng, 0, ran->state.gaussian.std_dev);
- sin_theta = sin(theta);
+ sin_theta
+ = ran->state.gaussian.std_dev * sqrt(-2 * log(ssp_rng_canonical(rng)));
+ sin_theta = MMIN(1, sin_theta); /* macro: don't merge with previous line! */
+ cos_theta = sin2cos(sin_theta);
phi = ssp_rng_uniform_double(rng, 0, 2 * PI);
pt[0] = cos(phi) * sin_theta;
pt[1] = sin(phi) * sin_theta;
- pt[2] = cos(theta);
- d33_muld3(dir, ran->state.pillbox.basis, pt);
+ pt[2] = cos_theta;
+ d33_muld3(dir, ran->state.gaussian.basis, pt);
d3_normalize(dir, dir);
return dir;
}