diff options
author | Matt Ebb <matt@mke3.net> | 2010-07-28 12:06:46 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-07-28 12:06:46 +0400 |
commit | 4ddcb653996d2a3934ef8787510f234087c4e462 (patch) | |
tree | 76860b8a3bdfdd498463db3266af12983e65057d /source | |
parent | 79dd2cc8e9073039d3518c41d90adb006d344201 (diff) |
Assorted small volume render related fixes.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/render/intern/source/rayshade.c | 14 | ||||
-rw-r--r-- | source/blender/render/intern/source/shadeinput.c | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/shadeoutput.c | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/volumetric.c | 9 |
4 files changed, 10 insertions, 17 deletions
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index ed52f37fcfa..b4a43373ef4 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -558,19 +558,9 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr) shi->mat= vlr->mat; /* shi->mat is being set in nodetree */ } else { - int tempdepth; - /* XXX dodgy business here, set ray depth to -1 - * to ignore raytrace in shade_material_loop() - * this could really use a refactor --Matt */ - if (shi->volume_depth == 0) { - tempdepth = shi->depth; - shi->depth = -1; - shade_material_loop(shi, shr); - shi->depth = tempdepth; - } else { - shade_material_loop(shi, shr); - } + shade_material_loop(shi, shr); } + /* raytrace likes to separate the spec color */ VECSUB(shr->diff, shr->combined, shr->spec); } diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index 2f0f5c72070..fc9aba20870 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -130,7 +130,7 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr) } /* depth >= 1 when ray-shading */ - if(shi->depth==0) { + if(shi->depth==0 || shi->volume_depth > 0) { if(R.r.mode & R_RAYTRACE) { if(shi->ray_mirror!=0.0f || ((shi->mat->mode & MA_TRANSP) && (shi->mat->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) { /* ray trace works on combined, but gives pass info */ diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 806cafaf89b..81de553b209 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1644,7 +1644,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) if(((passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) || (passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) { /* AO was calculated for scanline already */ - if(shi->depth) + if(shi->depth || shi->volume_depth) ambient_occlusion(shi); VECCOPY(shr->ao, shi->ao); VECCOPY(shr->env, shi->env); // XXX multiply diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index 21a0ab1d2a8..4ddbc079e91 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -193,7 +193,7 @@ static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, float *co, float *co isect.labda = FLT_MAX; isect.mode= RE_RAY_MIRROR; - isect.skip = RE_SKIP_VLR_NEIGHBOUR | RE_SKIP_VLR_RENDER_CHECK; + isect.skip = RE_SKIP_VLR_NEIGHBOUR; isect.orig.ob = (void*) shi->obi; isect.orig.face = (void*)vlr; isect.last_hit = NULL; @@ -446,7 +446,7 @@ static void vol_get_transmittance(ShadeInput *shi, float *tr, float *co, float * const float stepd = (t0 - pt0) * d; float sigma_t[3]; - vol_get_sigma_t(shi, sigma_t, co); + vol_get_sigma_t(shi, sigma_t, p); tau[0] += stepd * sigma_t[0]; tau[1] += stepd * sigma_t[1]; @@ -609,7 +609,10 @@ static void volumeintegrate(struct ShadeInput *shi, float *col, float *co, float /* transmittance component (alpha) */ vol_get_transmittance_seg(shi, tr, stepsize, co, density); - if (luminance(tr) < shi->mat->vol.depth_cutoff) break; + if (t0 > t1 * 0.25) { + /* only use depth cutoff after we've traced a little way into the volume */ + if (luminance(tr) < shi->mat->vol.depth_cutoff) break; + } vol_get_emission(shi, emit_col, p); |