diff options
author | Matt Ebb <matt@mke3.net> | 2008-11-13 13:43:02 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2008-11-13 13:43:02 +0300 |
commit | a2da0911a6da23dc420f7a25fc258ae048913b7a (patch) | |
tree | 9b1998b9d1ba5e910ed825be4ef3b16efb948f4a | |
parent | bf747a30af000c024ecb9e98a295a54dd286d0b3 (diff) |
* Fixed a float -> int conversion rounding error in volume rendering,
which was manifesting in little dark dots
-rw-r--r-- | source/blender/render/intern/source/volumetric.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index 52d23de45ff..1c0828d868c 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -335,7 +335,7 @@ void vol_get_attenuation(ShadeInput *shi, float *tau, float *co, float *endco, f vol_get_absorption(shi, absorb_col, co); dist = VecLenf(co, endco); - nsteps = (int)ceil(dist / stepsize); + nsteps = (int)((dist / stepsize) + 0.5); /* trigger for recalculating density */ if (density < -0.001f) density = vol_get_density(shi, co); @@ -491,7 +491,7 @@ static void volumeintegrate(struct ShadeInput *shi, float *col, float *co, float tr[0] = tr[1] = tr[2] = 1.0f; /* ray marching */ - nsteps = (int)ceil(VecLenf(co, endco) / stepsize); + nsteps = (int)((VecLenf(co, endco) / stepsize) + 0.5); VecSubf(vec, endco, co); VECCOPY(stepvec, vec); |