diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/app/cycles_test.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/app/cycles_xml.cpp | 1 | ||||
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 24 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.cpp | 5 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_path.h | 7 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 13 | ||||
-rw-r--r-- | intern/cycles/render/integrator.cpp | 8 | ||||
-rw-r--r-- | intern/cycles/render/integrator.h | 2 |
9 files changed, 37 insertions, 29 deletions
diff --git a/intern/cycles/app/cycles_test.cpp b/intern/cycles/app/cycles_test.cpp index 83816727404..d162dbf12a9 100644 --- a/intern/cycles/app/cycles_test.cpp +++ b/intern/cycles/app/cycles_test.cpp @@ -82,9 +82,9 @@ static void session_print_status() session_print(status); } -static BufferParams session_buffer_params() +static BufferParams& session_buffer_params() { - BufferParams buffer_params; + static BufferParams buffer_params; buffer_params.width = options.width; buffer_params.height = options.height; buffer_params.full_width = options.width; diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp index f5cc01cd062..21b03b56b7a 100644 --- a/intern/cycles/app/cycles_xml.cpp +++ b/intern/cycles/app/cycles_xml.cpp @@ -258,7 +258,6 @@ static void xml_read_integrator(const XMLReadState& state, pugi::xml_node node) xml_read_int(&integrator->min_bounce, node, "min_bounce"); xml_read_int(&integrator->max_bounce, node, "max_bounce"); xml_read_bool(&integrator->no_caustics, node, "no_caustics"); - xml_read_float(&integrator->blur_caustics, node, "blur_caustics"); } /* Camera */ diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index ec22d3db6f7..db8ea5fbf1e 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -154,7 +154,7 @@ void BlenderSync::sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, /* Object */ -void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm, uint visibility) +void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm, uint layer_flag) { /* light is handled separately */ if(object_is_light(b_ob)) { @@ -181,11 +181,19 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob, if(object_updated || (object->mesh && object->mesh->need_update)) { object->name = b_ob.name().c_str(); object->tfm = tfm; - - object->visibility = object_ray_visibility(b_ob) & visibility; + + /* visibility flags for both parent */ + object->visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL; if(b_parent.ptr.data != b_ob.ptr.data) object->visibility &= object_ray_visibility(b_parent); + /* camera flag is not actually used, instead is tested + against render layer flags */ + if(object->visibility & PATH_RAY_CAMERA) { + object->visibility |= layer_flag << PATH_RAY_LAYER_SHIFT; + object->visibility &= ~PATH_RAY_CAMERA; + } + object->tag_update(scene); } } @@ -196,7 +204,6 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d) { /* layer data */ uint scene_layer = render_layer.scene_layer; - uint layer = render_layer.layer; /* prepare for sync */ light_map.pre_sync(); @@ -212,11 +219,6 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d) uint ob_layer = get_layer(b_ob->layers()); if(!hide && (ob_layer & scene_layer)) { - uint visibility = PATH_RAY_ALL; - - if(!(ob_layer & layer)) - visibility &= ~PATH_RAY_CAMERA; - if(b_ob->is_duplicator()) { /* dupli objects */ object_create_duplilist(*b_ob, b_scene); @@ -226,7 +228,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d) for(b_ob->dupli_list.begin(b_dup); b_dup != b_ob->dupli_list.end(); ++b_dup) { Transform tfm = get_transform(b_dup->matrix()); - sync_object(*b_ob, b_index, b_dup->object(), tfm, visibility); + sync_object(*b_ob, b_index, b_dup->object(), tfm, ob_layer); b_index++; } @@ -244,7 +246,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d) if(!hide) { /* object itself */ Transform tfm = get_transform(b_ob->matrix_world()); - sync_object(*b_ob, 0, *b_ob, tfm, visibility); + sync_object(*b_ob, 0, *b_ob, tfm, ob_layer); } } } diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 4c8fe350b88..52555fadefb 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -122,9 +122,9 @@ bool BlenderSync::sync_recalc() void BlenderSync::sync_data(BL::SpaceView3D b_v3d) { + sync_render_layer(b_v3d); sync_integrator(); sync_film(); - sync_render_layer(b_v3d); sync_shaders(); sync_objects(b_v3d); } @@ -152,9 +152,8 @@ void BlenderSync::sync_integrator() integrator->transparent_shadows = get_boolean(cscene, "use_transparent_shadows"); integrator->no_caustics = get_boolean(cscene, "no_caustics"); - integrator->blur_caustics = get_float(cscene, "blur_caustics"); - integrator->seed = get_int(cscene, "seed"); + integrator->layer_flag = render_layer.layer; if(integrator->modified(previntegrator)) integrator->tag_update(scene); diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h index 824904cd81d..cd667205854 100644 --- a/intern/cycles/blender/blender_sync.h +++ b/intern/cycles/blender/blender_sync.h @@ -78,7 +78,7 @@ private: void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree); Mesh *sync_mesh(BL::Object b_ob, bool object_updated); - void sync_object(BL::Object b_parent, int b_index, BL::Object b_object, Transform& tfm, uint visibility); + void sync_object(BL::Object b_parent, int b_index, BL::Object b_object, Transform& tfm, uint layer_flag); void sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm); /* util */ diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index 05707f31352..d27ad861c6a 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -130,13 +130,16 @@ __device_inline void path_state_next(KernelGlobals *kg, PathState *state, int la } } -__device_inline uint path_state_ray_visibility(PathState *state) +__device_inline uint path_state_ray_visibility(KernelGlobals *kg, PathState *state) { uint flag = state->flag; /* for visibility, diffuse/glossy are for reflection only */ if(flag & PATH_RAY_TRANSMIT) flag &= ~(PATH_RAY_DIFFUSE|PATH_RAY_GLOSSY); + /* for camera visibility, use render layer flags */ + if(flag & PATH_RAY_CAMERA) + flag |= kernel_data.integrator.layer_flag; return flag; } @@ -249,7 +252,7 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R for(;; rng_offset += PRNG_BOUNCE_NUM) { /* intersect scene */ Intersection isect; - uint visibility = path_state_ray_visibility(&state); + uint visibility = path_state_ray_visibility(kg, &state); if(!scene_intersect(kg, &ray, visibility, &isect)) { /* eval background shader if nothing hit */ diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index ea73f87a8a5..56db4d2b78a 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -100,7 +100,10 @@ enum PathTraceDimension { /* these flag values correspond exactly to OSL defaults, so be careful not to * change this, or if you do, set the "raytypes" shading system attribute with - * your own new ray types and bitflag values */ + * your own new ray types and bitflag values. + * + * for ray visibility tests in BVH traversal, the upper 20 bits are used for + * layer visibility tests. */ enum PathRayFlag { PATH_RAY_CAMERA = 1, @@ -117,7 +120,9 @@ enum PathRayFlag { PATH_RAY_MIS_SKIP = 512, - PATH_RAY_ALL = (1|2|4|8|16|32|64|128|256|512) + PATH_RAY_ALL = (1|2|4|8|16|32|64|128|256|512), + + PATH_RAY_LAYER_SHIFT = (32-20) }; /* Closure Label */ @@ -383,10 +388,12 @@ typedef struct KernelIntegrator { /* caustics */ int no_caustics; - float blur_caustics; /* seed */ int seed; + + /* render layer */ + int layer_flag; } KernelIntegrator; typedef struct KernelBVH { diff --git a/intern/cycles/render/integrator.cpp b/intern/cycles/render/integrator.cpp index 9d129d8e8db..47059a0a009 100644 --- a/intern/cycles/render/integrator.cpp +++ b/intern/cycles/render/integrator.cpp @@ -41,9 +41,8 @@ Integrator::Integrator() transparent_shadows = false; no_caustics = false; - blur_caustics = 0.0f; - seed = 0; + layer_flag = ~0; need_update = true; } @@ -81,9 +80,8 @@ void Integrator::device_update(Device *device, DeviceScene *dscene) kintegrator->transparent_shadows = transparent_shadows; kintegrator->no_caustics = no_caustics; - kintegrator->blur_caustics = blur_caustics; - kintegrator->seed = hash_int(seed); + kintegrator->layer_flag = layer_flag << PATH_RAY_LAYER_SHIFT; /* sobol directions table */ int dimensions = PRNG_BASE_NUM + (max_bounce + transparent_max_bounce + 2)*PRNG_BOUNCE_NUM; @@ -115,7 +113,7 @@ bool Integrator::modified(const Integrator& integrator) transparent_probalistic == integrator.transparent_probalistic && transparent_shadows == integrator.transparent_shadows && no_caustics == integrator.no_caustics && - blur_caustics == integrator.blur_caustics && + layer_flag == integrator.layer_flag && seed == integrator.seed); } diff --git a/intern/cycles/render/integrator.h b/intern/cycles/render/integrator.h index 52032fa1a26..e610d670142 100644 --- a/intern/cycles/render/integrator.h +++ b/intern/cycles/render/integrator.h @@ -41,9 +41,9 @@ public: bool transparent_shadows; bool no_caustics; - float blur_caustics; int seed; + int layer_flag; bool need_update; |