diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2013-12-28 19:56:19 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2013-12-28 19:57:10 +0400 |
commit | e369a5c48529864118d49222dde3d530d58ebeae (patch) | |
tree | 8d803e5318c57b7bfbdd321da1393e4d71878d35 /intern/cycles/kernel/kernel_path_state.h | |
parent | 133f770ab3e7a6db49562cb73cb7aa5f75cf13f8 (diff) |
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.
Diffstat (limited to 'intern/cycles/kernel/kernel_path_state.h')
-rw-r--r-- | intern/cycles/kernel/kernel_path_state.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/intern/cycles/kernel/kernel_path_state.h b/intern/cycles/kernel/kernel_path_state.h index 0ded332b3b9..2df8f56fd45 100644 --- a/intern/cycles/kernel/kernel_path_state.h +++ b/intern/cycles/kernel/kernel_path_state.h @@ -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) |