[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16714] branches/sim_physics/source/ blender/render/intern/source/volumetric.c: * Moved the sample location for shading to the middle of the volumetric step .
Matt Ebb
matt at mke3.net
Wed Sep 24 09:49:25 CEST 2008
Revision: 16714
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16714
Author: broken
Date: 2008-09-24 09:49:24 +0200 (Wed, 24 Sep 2008)
Log Message:
-----------
* Moved the sample location for shading to the middle of the volumetric step. This fixes a nagging bug that would cause noise/odd moire-ish patterns, due to raytrace numerical errors:
http://mke3.net/blender/devel/rendering/volumetrics/vol_clouds_moire.jpg
Modified Paths:
--------------
branches/sim_physics/source/blender/render/intern/source/volumetric.c
Modified: branches/sim_physics/source/blender/render/intern/source/volumetric.c
===================================================================
--- branches/sim_physics/source/blender/render/intern/source/volumetric.c 2008-09-24 07:38:12 UTC (rev 16713)
+++ branches/sim_physics/source/blender/render/intern/source/volumetric.c 2008-09-24 07:49:24 UTC (rev 16714)
@@ -401,7 +401,7 @@
float vec[3], stepvec[3] = {0.0, 0.0, 0.0};
float tau[3], step_emit[3], step_scatter[3] = {0.0, 0.0, 0.0};
int s;
- float step_sta[3], step_end[3];
+ float step_sta[3], step_end[3], step_mid[3];
float col_behind[3];
float total_density = 0.f;
@@ -433,6 +433,9 @@
/* there's only any point shading here
* if there's actually some density to shade! */
if (density > 0.01f) {
+ step_mid[0] = step_sta[0] + (stepvec[0] * 0.5);
+ step_mid[1] = step_sta[1] + (stepvec[1] * 0.5);
+ step_mid[2] = step_sta[2] + (stepvec[2] * 0.5);
/* transmittance component (alpha) */
vol_get_attenuation(shi, tau, step_sta, step_end, density, stepsize);
@@ -444,8 +447,8 @@
//if (rgb_to_luminance(tr[0], tr[1], tr[2]) < 1e-3) break;
/* incoming light via emission or scattering (additive) */
- vol_get_emission(shi, step_emit, step_sta, density);
- vol_get_scattering(shi, step_scatter, step_end, stepsize, density);
+ vol_get_emission(shi, step_emit, step_mid, density);
+ vol_get_scattering(shi, step_scatter, step_mid, stepsize, density);
VecAddf(d_radiance, step_emit, step_scatter);
More information about the Bf-blender-cvs
mailing list