Cycles Volume Render: heterogeneous (textured) volumes support.

Volumes can now have textured colors and density. There is a Volume Sampling
panel in the Render properties with these settings:

* Step size: distance between volume shader samples when rendering the volume.
  Lower values give more accurate and detailed results but also increased render
  time.
* Max steps: maximum number of steps through the volume before giving up, to
  protect from extremely long render times with big objects or small step sizes.

This is much more compute intensive than homogeneous volume, so when you are not
using a texture you should enable the Homogeneous Volume option in the material
or world for faster rendering.

One important missing feature is that Generated texture coordinates are not yet
working in volumes, and they are the default coordinates for nearly all texture
nodes. So until that works you need to plug in object texture coordinates or a
world space position.

This is work by "storm", Stuart Broadfoot, Thomas Dinges and myself.
This commit is contained in:
Brecht Van Lommel
2013-12-29 22:19:38 +01:00
parent af128c4c96
commit 889d77e6f6
14 changed files with 296 additions and 56 deletions

View File

@@ -74,7 +74,7 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *
#ifdef __VOLUME__
/* attenuation for last line segment towards light */
if(ps.volume_stack[0].shader != SHADER_NO_ID)
kernel_volume_get_shadow_attenuation(kg, &ps, ray, &throughput);
kernel_volume_shadow(kg, &ps, ray, &throughput);
#endif
*shadow *= throughput;
@@ -89,7 +89,7 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *
if(ps.volume_stack[0].shader != SHADER_NO_ID) {
Ray segment_ray = *ray;
segment_ray.t = isect.t;
kernel_volume_get_shadow_attenuation(kg, &ps, &segment_ray, &throughput);
kernel_volume_shadow(kg, &ps, &segment_ray, &throughput);
}
#endif
@@ -120,7 +120,7 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *
#ifdef __VOLUME__
else if(!result && state->volume_stack[0].shader != SHADER_NO_ID) {
/* apply attenuation from current volume shader */
kernel_volume_get_shadow_attenuation(kg, state, ray, shadow);
kernel_volume_shadow(kg, state, ray, shadow);
}
#endif
#endif