Cycles Volume Render: support for rendering of homogeneous volume with absorption.

This is the simplest possible volume rendering case, constant density inside
the volume and no scattering or emission. My plan is to tweak, verify and commit
more volume rendering effects one by one, doing it all at once makes it
difficult to verify correctness and track down bugs.

Documentation is here:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Materials/Volume

Currently this hooks into path tracing in 3 ways, which should get us pretty
far until we add more advanced light sampling. These 3 hooks are repeated in
the path tracing, branched path tracing and transparent shadow code:

* Determine active volume shader at start of the path
* Change active volume shader on transmission through a surface
* Light attenuation over line segments between camera, surfaces and background

This is work by "storm", Stuart Broadfoot, Thomas Dinges and myself.
This commit is contained in:
Brecht Van Lommel
2013-12-28 16:56:19 +01:00
parent 133f770ab3
commit e369a5c485
15 changed files with 532 additions and 134 deletions

View File

@@ -24,9 +24,13 @@ typedef struct PathState {
int glossy_bounce;
int transmission_bounce;
int transparent_bounce;
#ifdef __VOLUME__
int volume_shader;
#endif
} PathState;
ccl_device_inline void path_state_init(PathState *state)
ccl_device_inline void path_state_init(KernelGlobals *kg, PathState *state)
{
state->flag = PATH_RAY_CAMERA|PATH_RAY_SINGULAR|PATH_RAY_MIS_SKIP;
state->bounce = 0;
@@ -34,6 +38,11 @@ ccl_device_inline void path_state_init(PathState *state)
state->glossy_bounce = 0;
state->transmission_bounce = 0;
state->transparent_bounce = 0;
#ifdef __VOLUME__
/* todo: this assumes camera is always in air, need to detect when it isn't */
state->volume_shader = kernel_data.background.volume_shader;
#endif
}
ccl_device_inline void path_state_next(KernelGlobals *kg, PathState *state, int label)