Commit: cfba75a21afae499a2794cb21fe8c7b016bc4380
Author: Clément Foucault
Date:   Wed Mar 7 01:36:09 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBcfba75a21afae499a2794cb21fe8c7b016bc4380

Eevee: Fix volume rendering glitches.

The bug was due to the Halton function returning uninitialized value for 0 
iteration.

===================================================================

M       source/blender/blenlib/intern/rand.c

===================================================================

diff --git a/source/blender/blenlib/intern/rand.c 
b/source/blender/blenlib/intern/rand.c
index 1a178db1413..700524965f0 100644
--- a/source/blender/blenlib/intern/rand.c
+++ b/source/blender/blenlib/intern/rand.c
@@ -386,6 +386,8 @@ void BLI_halton_1D(unsigned int prime, double offset, int 
n, double *r)
 {
        const double invprime = 1.0 / (double)prime;
 
+       *r = 0.0;
+
        for (int s = 0; s < n; s++) {
                *r = halton_ex(invprime, &offset);
        }
@@ -395,6 +397,8 @@ void BLI_halton_2D(unsigned int prime[2], double offset[2], 
int n, double *r)
 {
        const double invprimes[2] = {1.0 / (double)prime[0], 1.0 / 
(double)prime[1]};
 
+       r[0] = r[1] = 0.0;
+
        for (int s = 0; s < n; s++) {
                for (int i = 0; i < 2; i++) {
                        r[i] = halton_ex(invprimes[i], &offset[i]);
@@ -406,6 +410,8 @@ void BLI_halton_3D(unsigned int prime[3], double offset[3], 
int n, double *r)
 {
        const double invprimes[3] = {1.0 / (double)prime[0], 1.0 / 
(double)prime[1], 1.0 / (double)prime[2]};
 
+       r[0] = r[1] = r[2] = 0.0;
+
        for (int s = 0; s < n; s++) {
                for (int i = 0; i < 3; i++) {
                        r[i] = halton_ex(invprimes[i], &offset[i]);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to