diff options
author | Matt Ebb <matt@mke3.net> | 2008-10-01 11:13:28 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2008-10-01 11:13:28 +0400 |
commit | 25236b56a6c8c5619a3a8d35841be7e413df1e5e (patch) | |
tree | 104cc3879260e701926400f4183fb0169445ce08 /source/blender/render/intern/source/pointdensity.c | |
parent | 8622cbca359d77eb980250b42d0635c0dddfa48b (diff) |
* Fix for volumetric rendering. It previously wasn't multiplying
the emission component by the density at the current point, which
made the volume too bright in less dense areas. This made it look
too rough, as opposed to smooth as it should be. This makes the
particle rendering look *much* better, thanks a bunch to ZanQdo for
complaining and kicking my butt to make me realise the error.
Here's an example of how smooth it looks now:
http://mke3.net/blender/devel/rendering/volumetrics/smoke_test03.mov
http://mke3.net/blender/devel/rendering/volumetrics/smoke_test03.blend
Settings in existing files will have to be tweaked a bit, since
what they were set up for before, was incorrect.
* Added two new interpolation types to Point Density: Constant and
Root. These work similarly to in proportional edit for example,
just gives a bit more choice over how hard-edged the particles
should look.
Diffstat (limited to 'source/blender/render/intern/source/pointdensity.c')
-rw-r--r-- | source/blender/render/intern/source/pointdensity.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 4422b9fbbdd..c4124fba8bb 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -224,7 +224,6 @@ void free_pointdensities(Render *re) } } - void accum_density_std(void *userdata, int index, float squared_dist, float squared_radius) { float *density = userdata; @@ -249,6 +248,22 @@ void accum_density_sharp(void *userdata, int index, float squared_dist, float sq *density+= dist*dist; } +void accum_density_constant(void *userdata, int index, float squared_dist, float squared_radius) +{ + float *density = userdata; + + *density+= squared_radius; +} + +void accum_density_root(void *userdata, int index, float squared_dist, float squared_radius) +{ + float *density = userdata; + const float dist = squared_radius - squared_dist; + + *density+= sqrt(dist); +} + + #define MAX_POINTS_NEAREST 25 int pointdensitytex(Tex *tex, float *texvec, TexResult *texres) { @@ -267,7 +282,11 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres) BLI_bvhtree_range_query(pd->point_tree, texvec, pd->radius, accum_density_smooth, &density); else if (pd->falloff_type == TEX_PD_FALLOFF_SHARP) BLI_bvhtree_range_query(pd->point_tree, texvec, pd->radius, accum_density_sharp, &density); - + else if (pd->falloff_type == TEX_PD_FALLOFF_CONSTANT) + BLI_bvhtree_range_query(pd->point_tree, texvec, pd->radius, accum_density_constant, &density); + else if (pd->falloff_type == TEX_PD_FALLOFF_ROOT) + BLI_bvhtree_range_query(pd->point_tree, texvec, pd->radius, accum_density_root, &density); + texres->tin = density; /* |