diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-04-30 16:49:26 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-04-30 16:49:26 +0400 |
commit | 1d8c79818870b92df46c443d7778438aa67d019c (patch) | |
tree | ba3fc305671261e40851d8a230a33ebe19396e95 /intern/cycles/kernel/kernel_types.h | |
parent | 796dd8a321108df26757fb9df5c2aa6eb42c9633 (diff) |
Cycles: support for motion vector and UV passes.
Most of the changes are related to adding support for motion data throughout
the code. There's some code for actual camera/object motion blur raytracing
but it's unfinished (it badly slows down the raytracing kernel even when the
option is turned off), so that code it disabled still.
Motion vector export from Blender tries to avoid computing derived meshes
when the mesh does not have a deforming modifier, and it also won't store
motion vectors for every vertex if only the object or camera is moving.
Diffstat (limited to 'intern/cycles/kernel/kernel_types.h')
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 65 |
1 files changed, 56 insertions, 9 deletions
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 102a2bb036d..e9103087025 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -20,9 +20,12 @@ #define __KERNEL_TYPES_H__ #include "kernel_math.h" - #include "svm/svm_types.h" +#ifndef __KERNEL_GPU__ +#define __KERNEL_CPU__ +#endif + CCL_NAMESPACE_BEGIN /* constants */ @@ -30,6 +33,7 @@ CCL_NAMESPACE_BEGIN #define LIGHT_SIZE 4 #define FILTER_TABLE_SIZE 256 #define RAMP_TABLE_SIZE 256 +#define TIME_INVALID FLT_MAX /* device capabilities */ #ifdef __KERNEL_CPU__ @@ -75,6 +79,7 @@ CCL_NAMESPACE_BEGIN #define __PASSES__ #define __BACKGROUND_MIS__ #define __AO__ +//#define __MOTION__ #endif //#define __MULTI_LIGHT__ @@ -90,14 +95,21 @@ enum ShaderEvalType { SHADER_EVAL_BACKGROUND }; -/* Path Tracing */ +/* Path Tracing + * note we need to keep the u/v pairs at even values */ enum PathTraceDimension { PRNG_FILTER_U = 0, PRNG_FILTER_V = 1, PRNG_LENS_U = 2, PRNG_LENS_V = 3, +#ifdef __MOTION__ + PRNG_TIME = 4, + PRNG_UNUSED = 5, + PRNG_BASE_NUM = 6, +#else PRNG_BASE_NUM = 4, +#endif PRNG_BSDF_U = 0, PRNG_BSDF_V = 1, @@ -177,7 +189,9 @@ typedef enum PassType { PASS_EMISSION = 65536, PASS_BACKGROUND = 131072, PASS_AO = 262144, - PASS_SHADOW = 524288 + PASS_SHADOW = 524288, + PASS_MOTION = 1048576, + PASS_MOTION_WEIGHT = 2097152 } PassType; #define PASS_ALL (~0) @@ -275,6 +289,7 @@ typedef struct Ray { float3 P; float3 D; float t; + float time; #ifdef __RAY_DIFFERENTIALS__ differential3 dP; @@ -300,6 +315,21 @@ typedef enum AttributeElement { ATTR_ELEMENT_NONE } AttributeElement; +typedef enum AttributeStandard { + ATTR_STD_NONE = 0, + ATTR_STD_VERTEX_NORMAL, + ATTR_STD_FACE_NORMAL, + ATTR_STD_UV, + ATTR_STD_GENERATED, + ATTR_STD_POSITION_UNDEFORMED, + ATTR_STD_POSITION_UNDISPLACED, + ATTR_STD_MOTION_PRE, + ATTR_STD_MOTION_POST, + ATTR_STD_NUM, + + ATTR_STD_NOT_FOUND = ~0 +} AttributeStandard; + /* Closure data */ #define MAX_CLOSURE 8 @@ -365,6 +395,16 @@ typedef struct ShaderData { /* object id if there is one, ~0 otherwise */ int object; + /* motion blur sample time */ + float time; + +#ifdef __MOTION__ + /* object <-> world space transformations, cached to avoid + * re-interpolating them constantly for shading */ + Transform ob_tfm; + Transform ob_itfm; +#endif + #ifdef __RAY_DIFFERENTIALS__ /* differential of P. these are orthogonal to Ng, not N */ differential3 dP; @@ -422,8 +462,8 @@ typedef struct KernelCamera { float focaldistance; /* motion blur */ - float shutteropen; - float shutterclose; + float shuttertime; + float pad; /* clipping */ float nearclip; @@ -437,6 +477,8 @@ typedef struct KernelCamera { Transform worldtoraster; Transform worldtondc; Transform worldtocamera; + + MotionTransform motion; } KernelCamera; typedef struct KernelFilm { @@ -448,27 +490,32 @@ typedef struct KernelFilm { int pass_combined; int pass_depth; int pass_normal; - int pass_pad; + int pass_motion; + int pass_motion_weight; int pass_uv; int pass_object_id; int pass_material_id; - int pass_diffuse_color; + int pass_diffuse_color; int pass_glossy_color; int pass_transmission_color; int pass_diffuse_indirect; - int pass_glossy_indirect; + int pass_glossy_indirect; int pass_transmission_indirect; int pass_diffuse_direct; int pass_glossy_direct; - int pass_transmission_direct; + int pass_transmission_direct; int pass_emission; int pass_background; int pass_ao; + int pass_shadow; + int pass_pad1; + int pass_pad2; + int pass_pad3; } KernelFilm; typedef struct KernelBackground { |