Commit: 0552d61a1216de5455a024b6ba6a2c618293a16c Author: Geraldine Chua Date: Thu Aug 2 23:55:50 2018 +0800 Branches: soc-2018-cycles-volumes https://developer.blender.org/rB0552d61a1216de5455a024b6ba6a2c618293a16c
Several minor fixes and variable name changes. Notable changes: * P_v moved to correct location in ShaderData struct and shader init. * Volume motion blur now also checks if the Deformation Blur box in the Object panel is checked. * Changed OpenVDB variable names to refer to generic volumes. =================================================================== M intern/cycles/blender/addon/properties.py M intern/cycles/blender/blender_mesh.cpp M intern/cycles/kernel/geom/geom_volume.h M intern/cycles/kernel/kernel_shader.h M intern/cycles/kernel/kernel_types.h M intern/cycles/render/image.cpp M intern/cycles/render/image.h M intern/cycles/render/mesh.cpp M release/scripts/startup/bl_ui/properties_physics_smoke.py M source/blender/blenkernel/intern/pointcache.c M source/blender/editors/io/io_openvdb.c M source/blender/editors/space_file/filelist.c M source/blender/editors/space_file/filesel.c M source/blender/makesdna/DNA_smoke_types.h M source/blender/makesdna/DNA_space_types.h M source/blender/makesrna/intern/rna_smoke.c M source/blender/windowmanager/intern/wm_operator_props.c =================================================================== diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 8dbd80f3747..1141973efd3 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -1083,7 +1083,7 @@ class CyclesObjectSettings(bpy.types.PropertyGroup): cls.use_deform_motion = BoolProperty( name="Use Deformation Motion", - description="Use deformation motion blur for this object", + description="Use deformation motion blur for this object. If object is a volume, use volume motion blur", default=True, ) diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index 77a82ae4a19..7486eba2d48 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -378,15 +378,18 @@ static void create_mesh_volume_attributes(Scene *scene, string filename; void *builtin_data; - if(b_domain.is_openvdb()) { - if(!scene->params.intialized_openvdb) { + if(b_domain.use_volume_file()) { + BL::ID b_id = b_ob.data(); + filename = blender_absolute_path(b_data, b_id, + b_domain.volume_filepath()); + + if(string_endswith(filename, ".vdb") && + !scene->params.intialized_openvdb) + { openvdb_initialize(); scene->params.intialized_openvdb = true; } - BL::ID b_id = b_ob.data(); - filename = blender_absolute_path(b_data, b_id, - b_domain.openvdb_filepath()); builtin_data = NULL; } else { diff --git a/intern/cycles/kernel/geom/geom_volume.h b/intern/cycles/kernel/geom/geom_volume.h index 51a7efc1457..dd093a881cc 100644 --- a/intern/cycles/kernel/geom/geom_volume.h +++ b/intern/cycles/kernel/geom/geom_volume.h @@ -55,6 +55,7 @@ ccl_device_inline float3 volume_get_position(KernelGlobals *kg, { float3 P = volume_normalized_position(kg, sd, sd->P); +#ifdef __OBJECT_MOTION__ /* Eulerian motion blur. */ if(kernel_data.cam.shuttertime != -1.0f) { AttributeDescriptor v_desc = find_attribute(kg, sd, ATTR_STD_VOLUME_VELOCITY); @@ -73,6 +74,7 @@ ccl_device_inline float3 volume_get_position(KernelGlobals *kg, P = volume_normalized_position(kg, sd, sd->P + velocity * sd->time); } } +#endif return P; } diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index 64b1e070982..4c4598accce 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -1211,10 +1211,10 @@ ccl_device_inline void shader_eval_volume(KernelGlobals *kg, /* todo: this is inefficient for motion blur, we should be * caching matrices instead of recomputing them each step */ shader_setup_object_transforms(kg, sd, sd->time); +#endif /* Cache volume P. */ sd->P_v = volume_get_position(kg, sd); -#endif } /* evaluate shader */ diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 63ff8f3ba6f..7f869eb51c2 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -1037,6 +1037,12 @@ typedef ccl_addr_space struct ShaderData { float3 ray_P; differential3 ray_dP; +#ifdef __VOLUME__ + /* Normalized volume position, only set for volumes. + * May be advected for motion blur. */ + float3 P_v; +#endif + #ifdef __OSL__ struct KernelGlobals *osl_globals; struct PathState *osl_path_state; @@ -1058,11 +1064,6 @@ typedef ccl_addr_space struct ShaderData { /* At the end so we can adjust size in ShaderDataTinyStorage. */ struct ShaderClosure closure[MAX_CLOSURE]; - -#ifdef __VOLUME__ - /* Normalized volume position. May be advected for motion blur. */ - float3 P_v; -#endif } ShaderData; typedef ccl_addr_space struct ShaderDataTinyStorage { diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index 6bba328145e..2656da877f4 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -275,14 +275,14 @@ string ImageManager::name_from_type(int type) return "byte4"; } -string ImageManager::name_from_grid_type(int type) +static string name_from_grid_type(int type) { if(type == IMAGE_GRID_TYPE_SPARSE) return "sparse"; else if(type == IMAGE_GRID_TYPE_OPENVDB) return "OpenVDB"; else - return "default"; + return "dense"; } static bool image_equals(ImageManager::Image *image, diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index e36876da434..5106f302228 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -181,7 +181,6 @@ private: int type_index_to_flattened_slot(int slot, ImageDataType type); int flattened_slot_to_type_index(int flat_slot, ImageDataType *type); string name_from_type(int type); - string name_from_grid_type(int type); void device_load_image(Device *device, Scene *scene, diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index 1cfbb085e45..570dbf083ff 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -1545,7 +1545,8 @@ void MeshManager::device_update_attributes(Device *device, DeviceScene *dscene, } /* motion blur for volumes */ - if(scene->need_motion() == Scene::MOTION_BLUR && mesh->has_volume) { + if(mesh->use_motion_blur && mesh->motion_steps > 1 && mesh->has_volume) + { mesh_attributes[i].add(ATTR_STD_VOLUME_VELOCITY); } } diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py index 42ff60da6f1..541d24f2794 100644 --- a/release/scripts/startup/bl_ui/properties_physics_smoke.py +++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py @@ -52,6 +52,21 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel): md = context.smoke ob = context.object + if bpy.app.build_options.openvdb and md.domain_settings.use_volume_file: + domain = md.domain_settings + layout.prop(domain, "use_volume_file", text="Volume Import") + split = layout.split(percentage=0.25) + col = split.column() + col.label(text="File Path:") + col = split.column() + col.prop(domain, "volume_filepath", text="") + split = layout.split(percentage=0.5) + col = split.column() + col.label(text="Empty Space:") + col = split.column() + col.prop(domain, "clipping") + return + layout.row().prop(md, "smoke_type", expand=True) if md.smoke_type == 'DOMAIN': @@ -82,16 +97,6 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel): sub.prop(domain, "dissolve_speed", text="Time") sub.prop(domain, "use_dissolve_smoke_log", text="Slow") - if(bpy.app.build_options.openvdb): - layout.prop(domain, "is_openvdb", text="OpenVDB Import") - - if(domain.is_openvdb): - split = layout.split(percentage=0.35) - col = split.column() - col.label(text="File Path:") - col = split.column() - col.prop(domain, "openvdb_filepath", text="") - elif md.smoke_type == 'FLOW': flow = md.flow_settings @@ -188,7 +193,7 @@ class PHYSICS_PT_smoke_fire(PhysicButtonsPanel, Panel): @classmethod def poll(cls, context): md = context.smoke - return md and (md.smoke_type == 'DOMAIN') and (not md.domain_settings.is_openvdb) + return md and (md.smoke_type == 'DOMAIN') and (not md.domain_settings.use_volume_file) def draw(self, context): layout = self.layout @@ -218,7 +223,7 @@ class PHYSICS_PT_smoke_adaptive_domain(PhysicButtonsPanel, Panel): @classmethod def poll(cls, context): md = context.smoke - return md and (md.smoke_type == 'DOMAIN') and (not md.domain_settings.is_openvdb) + return md and (md.smoke_type == 'DOMAIN') and (not md.domain_settings.use_volume_file) def draw_header(self, context): md = context.smoke.domain_settings @@ -253,7 +258,7 @@ class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, Panel): def poll(cls, context): md = context.smoke rd = context.scene.render - return md and (md.smoke_type == 'DOMAIN') and (rd.engine in cls.COMPAT_ENGINES) and (not md.domain_settings.is_openvdb) + return md and (md.smoke_type == 'DOMAIN') and (rd.engine in cls.COMPAT_ENGINES) and (not md.domain_settings.use_volume_file) def draw_header(self, context): md = context.smoke.domain_settings @@ -293,7 +298,7 @@ class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, Panel): def poll(cls, context): md = context.smoke rd = context.scene.render - return md and (md.smoke_type == 'DOMAIN') and (rd.engine in cls.COMPAT_ENGINES) and (not md.domain_settings.is_openvdb) + return md and (md.smoke_type == 'DOMAIN') and (rd.engine in cls.COMPAT_ENGINES) and (not md.domain_settings.use_volume_file) def draw(self, context): layout = self.layout @@ -322,7 +327,7 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, Panel): def poll(cls, context): md = context.smoke rd = context.scene.render - return md and (md.smoke_type == 'DOMAIN') and (rd.engine in cls.COMPAT_ENGINES) and (not md.domain_settings.is_openvdb) + return md and (md.smoke_type == 'DOMAIN') and (rd.engine in cls.COMPAT_ENGINES) and (not md.domain_settings.use_volume_file) def draw(self, context): layout = self.layout @@ -359,7 +364,7 @@ class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, Panel): def poll(cls, context): md = context.smoke rd = context.scene.render - return md and (md.smoke_type == 'DOMAIN') and (rd.engine in cls.COMPAT_ENGINES) and (not md.domain_settings.is_openvdb) + return md and (md.smoke_type == 'DOMAIN') and (rd.engine in cls.COMPAT_ENGINES) and (not md.domain_settings.use_volume_file) def draw(self, context): domain = context.smoke.domain_settings @@ @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs