[Bf-blender-cvs] [9f4e5581d18] soc-2018-cycles-volumes: OpenVDB import to padded sparse grids.
Commit: 9f4e5581d18899d665d61e93ae7c6933c5a3e770 Author: Geraldine Chua Date: Sun Aug 12 23:33:52 2018 +0800 Branches: soc-2018-cycles-volumes https://developer.blender.org/rB9f4e5581d18899d665d61e93ae7c6933c5a3e770 OpenVDB import to padded sparse grids. === M intern/cycles/render/image.cpp M intern/cycles/render/openvdb.cpp M intern/cycles/render/openvdb.h === diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index 4c987957bb4..97302095e33 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -702,19 +702,28 @@ void ImageManager::file_load_extern_vdb(Device *device, return; } + const bool use_pad = (device->info.type == DEVICE_CUDA); int sparse_size = -1; vector sparse_offsets; openvdb_load_preprocess(img->filename, img->grid_name, img->isovalue, - &sparse_offsets, sparse_size); + use_pad, &sparse_offsets, sparse_size); /* Allocate space for image. */ float *pixels; { thread_scoped_lock device_lock(device_mutex); - if(sparse_size > -1) { + if(use_pad && sparse_size > -1) { + tex_img->grid_type = IMAGE_GRID_TYPE_SPARSE_PAD; + int width = sparse_size / (PADDED_TILE * PADDED_TILE * + (type == IMAGE_DATA_TYPE_FLOAT4 ? 4 : 1)); + pixels = (float*)tex_img->alloc(width, PADDED_TILE, PADDED_TILE); + } + else if(sparse_size > -1) { + tex_img->grid_type = IMAGE_GRID_TYPE_SPARSE; pixels = (float*)tex_img->alloc(sparse_size); } else { + tex_img->grid_type = IMAGE_GRID_TYPE_DEFAULT; pixels = (float*)tex_img->alloc(img->metadata.width, img->metadata.height, img->metadata.depth); @@ -728,21 +737,17 @@ void ImageManager::file_load_extern_vdb(Device *device, } /* Load image. */ - openvdb_load_image(img->filename, img->grid_name, pixels, &sparse_offsets); + openvdb_load_image(img->filename, img->grid_name, &sparse_offsets, + sparse_size, use_pad, pixels); /* Allocate space for sparse_index if it exists. */ if(sparse_size > -1) { - tex_img->grid_type = IMAGE_GRID_TYPE_SPARSE; - if(!allocate_grid_info(device, (device_memory*)tex_img, &sparse_offsets)) { /* Could be that we've run out of memory. */ file_load_failed(img, type, tex_img); return; } } - else { - tex_img->grid_type = IMAGE_GRID_TYPE_DEFAULT; - } /* Set metadata and copy. */ tex_img->dense_width = img->metadata.width; diff --git a/intern/cycles/render/openvdb.cpp b/intern/cycles/render/openvdb.cpp index a3dba94c6b3..a3b6330a891 100644 --- a/intern/cycles/render/openvdb.cpp +++ b/intern/cycles/render/openvdb.cpp @@ -244,7 +244,7 @@ bool validate_and_process_grid(typename GridType::Ptr &grid, return true; } -/* Load OpenVDB grid to texture. */ +/* Load OpenVDB grid to texture. Based on util/util_sparse_grid.h */ template void image_load_preprocess(openvdb::GridBase::Ptr grid_base, @@ -252,6 +252,7 @@ void image_load_preprocess(openvdb::GridBase::Ptr grid_base, const openvdb::math::Coord min_bound, const int channels, const float threshold, + const bool use_pad, vector *sparse_indexes, int &sparse_size) { @@ -269,6 +270,8 @@ void image_load_preprocess(openvdb::GridBase::Ptr grid_base, } const int tile_count = coord_product(tiled_res); + + /* Initial prepass to find active tiles. */ sparse_indexes->resize(tile_count, -1); /* 0 if active, -1 if inactive. */ int voxel_count = 0; @@ -280,21 +283,51 @@ void image_load_preprocess(openvdb::GridBase::Ptr grid_base, if(gte_any(data[i], threshold)) { const math::Coord tile_start = leaf->getNodeBoundingBox().getStart(); sparse_indexes->at(get_tile_index(tile_start, tiled_res)) = voxel_count; - /* Calculate how many voxels are in this tile. */ - voxel_count += coord_product(get_tile_dim(tile_start, resolution, remainder)); +
[Bf-blender-cvs] [d846f810b2b] fracture_modifier: added autohide filtering based on filter object vertex positions
Commit: d846f810b2b76987ebd2044c3482e7de8a534ee2 Author: Martin Felke Date: Sun Aug 12 14:54:57 2018 +0200 Branches: fracture_modifier https://developer.blender.org/rBd846f810b2b76987ebd2044c3482e7de8a534ee2 added autohide filtering based on filter object vertex positions mesh objects now use their verts and a distance, while empties (or other non-mesh objects) still use the maximum of the object size as radius === M release/scripts/startup/bl_operators/presets.py M release/scripts/startup/bl_ui/properties_physics_fracture.py M source/blender/makesdna/DNA_modifier_types.h M source/blender/makesrna/intern/rna_fracture.c M source/blender/modifiers/intern/MOD_fracture.c === diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index 24f956b773c..baa33e85f5f 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -715,6 +715,7 @@ class AddPresetFracture(AddPresetBase, Operator): "fracture.grid_offset", "fracture.grid_spacing", "fracture.use_constraint_group", +"fracture.autohide_filter_dist", ] preset_subdir = "fracture" diff --git a/release/scripts/startup/bl_ui/properties_physics_fracture.py b/release/scripts/startup/bl_ui/properties_physics_fracture.py index 20efd1f0557..933ae296e4b 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fracture.py +++ b/release/scripts/startup/bl_ui/properties_physics_fracture.py @@ -303,7 +303,10 @@ class PHYSICS_PT_fracture_utilities(PhysicButtonsPanel, Panel): def draw(self, context): layout = self.layout md = context.fracture -layout.prop(md, "autohide_filter_group", text = "Filter Group") +col = layout.column() +col.prop(md, "autohide_filter_group", text = "Filter Group") +if md.autohide_filter_group: +col.prop(md, "autohide_filter_dist") col = layout.column(align=True) col.prop(md, "autohide_dist") col.prop(md, "automerge_dist") diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index cd70132c254..4fd719af672 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -1824,6 +1824,7 @@ typedef struct FractureModifierData { float anim_bind_limit; float grid_offset[3]; float grid_spacing[3]; + float autohide_filter_dist; /* flags */ int refresh; @@ -1885,7 +1886,7 @@ typedef struct FractureModifierData { short mat_ofs_intersect; short mat_ofs_difference; - char pad[4]; + //char pad[4]; } FractureModifierData; typedef struct DataTransferModifierData { diff --git a/source/blender/makesrna/intern/rna_fracture.c b/source/blender/makesrna/intern/rna_fracture.c index 9a16ecd7755..a4f1ff67e5a 100644 --- a/source/blender/makesrna/intern/rna_fracture.c +++ b/source/blender/makesrna/intern/rna_fracture.c @@ -1584,5 +1584,13 @@ void RNA_def_fracture(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "autohide_filter_dist", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "autohide_filter_dist"); + RNA_def_property_range(prop, 0, FLT_MAX); + RNA_def_property_ui_text(prop, "Filter Distance", "Distance between verts of filter objects and face centers of object"); + RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 0.1f, 3); + //RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + RNA_api_fracture(brna, srna); } diff --git a/source/blender/modifiers/intern/MOD_fracture.c b/source/blender/modifiers/intern/MOD_fracture.c index 6dbf8e80ff0..2734622c557 100644 --- a/source/blender/modifiers/intern/MOD_fracture.c +++ b/source/blender/modifiers/intern/MOD_fracture.c @@ -273,6 +273,7 @@ static void initData(ModifierData *md) zero_v3(fmd->grid_spacing); fmd->use_constraint_group = false; fmd->activate_broken = false; + fmd->autohide_filter_dist = 0.1f; } //XXX TODO, freeing functionality should be in BKE too @@ -1929,6 +1930,8 @@ static void copyData(ModifierData *md, ModifierData *target) trmd->use_constraint_group = rmd->use_constraint_group; trmd->activate_broken = rmd->activate_broken; + + trmd->autohide_filter_dist = rmd->autohide_filter_dist; } // TODO, is BB really useds still ? aint there exact volume calc now ? @@ -3389,22 +3392,71 @@ static void find_other_face(FractureModifierData *fmd, int i, BMesh* bm, Object* /*if
[Bf-blender-cvs] [e69b046825c] hair_object: Remove the hair modifier.
Commit: e69b046825c9886a66aeca4afda7ca30a8c36d85 Author: Lukas Tönne Date: Sun Aug 12 13:48:01 2018 +0100 Branches: hair_object https://developer.blender.org/rBe69b046825c9886a66aeca4afda7ca30a8c36d85 Remove the hair modifier. A new object type for hair will be used instead. === M intern/cycles/blender/blender_curves.cpp M release/scripts/startup/bl_ui/properties_data_modifier.py M release/scripts/startup/bl_ui/space_view3d_toolbar.py M source/blender/blenloader/intern/readfile.c M source/blender/blenloader/intern/writefile.c M source/blender/draw/engines/eevee/eevee_materials.c M source/blender/editors/object/object_intern.h M source/blender/editors/object/object_modifier.c M source/blender/editors/object/object_ops.c M source/blender/editors/space_outliner/outliner_draw.c M source/blender/makesdna/DNA_modifier_types.h M source/blender/makesrna/RNA_access.h M source/blender/makesrna/intern/rna_modifier.c M source/blender/modifiers/CMakeLists.txt M source/blender/modifiers/MOD_modifiertypes.h D source/blender/modifiers/intern/MOD_hair.c M source/blender/modifiers/intern/MOD_util.c === diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp index 9e0921a8f6c..840e90670b5 100644 --- a/intern/cycles/blender/blender_curves.cpp +++ b/intern/cycles/blender/blender_curves.cpp @@ -429,24 +429,6 @@ static bool ObtainCacheDataFromObject(Mesh *mesh, &curvenum, &keyno); } - if((b_mod->type() == b_mod->type_HAIR)) { - BL::HairModifier b_hmd((const PointerRNA)b_mod->ptr); - BL::HairSystem b_hsys = b_hmd.hair_system(); - - const int material_index = 1; /* TODO */ - int shader = clamp(material_index - 1, 0, mesh->used_shaders.size()-1); - - BL::Mesh b_scalp(b_ob->data()); - - ObtainCacheDataFromHairSystem(b_ob, - &b_hsys, - &b_scalp, - shader, - background, - CData, - &curvenum, - &keyno); - } } } diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index e2a537acadd..93e789bbd19 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -20,7 +20,7 @@ import bpy from bpy.types import Panel from bpy.app.translations import pgettext_iface as iface_ -from .properties_hair_common import draw_hair_display_settings + class ModifierButtonsPanel: bl_space_type = 'PROPERTIES' @@ -1577,27 +1577,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): if md.rest_source == 'BIND': layout.operator("object.correctivesmooth_bind", text="Unbind" if is_bind else "Bind") -def HAIR(self, layout, ob, md): -hsys = md.hair_system - -split = layout.split() - -col = split.column() -col.label("Follicles:") -col.prop(md, "follicle_seed") -col.prop(md, "follicle_count") -col.operator("object.hair_generate_follicles", text="Generate") - -col = split.column() - -col.separator() - -col.prop(hsys, "material_slot", text="") - -col = layout.column() -col.label("Display Settings:") -draw_hair_display_settings(col, md.draw_settings) - def WEIGHTED_NORMAL(self, layout, ob, md): layout.label("Weighting Mode:") split = layout.split(align=True) diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index febe95c5522..66f15f6a8ce 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -78,6 +78,7 @@ def is_not_gpencil_edit_mode(context): ) return not is_gpmode + # ** default tools for editmode_mesh diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenload
[Bf-blender-cvs] [b8ab411185c] hair_guides_grooming: Merge branch 'hair_guides' into hair_guides_grooming
Commit: b8ab411185c11ce98e7e791b0d30a9d9b1ce6d69 Author: Lukas Tönne Date: Sun Aug 12 12:59:39 2018 +0100 Branches: hair_guides_grooming https://developer.blender.org/rBb8ab411185c11ce98e7e791b0d30a9d9b1ce6d69 Merge branch 'hair_guides' into hair_guides_grooming === === diff --cc release/scripts/startup/bl_ui/__init__.py index 1ef6566ed8e,3b0cc2527a8..76adb544b49 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@@ -34,7 -34,7 +34,8 @@@ _modules = "properties_data_camera", "properties_data_curve", "properties_data_empty", + "properties_data_gpencil", +"properties_data_groom", "properties_data_light", "properties_data_lattice", "properties_data_mesh", diff --cc release/scripts/startup/bl_ui/space_view3d.py index a508790c046,a26d99e9ae9..e8350a9642f --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@@ -1457,8 -1480,8 +1496,9 @@@ class INFO_MT_add(Menu) # layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE') layout.menu("INFO_MT_surface_add", icon='OUTLINER_OB_SURFACE') layout.menu("INFO_MT_metaball_add", text="Metaball", icon='OUTLINER_OB_META') +layout.menu("INFO_MT_groom_add", text="Groom", icon='OUTLINER_OB_GROOM') layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT') + layout.operator_menu_enum("object.gpencil_add", "type", text="Grease Pencil", icon='OUTLINER_OB_GREASEPENCIL') layout.separator() layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE') diff --cc source/blender/CMakeLists.txt index b88e5e88cfe,f46283aced5..5a1abb5d7a6 --- a/source/blender/CMakeLists.txt +++ b/source/blender/CMakeLists.txt @@@ -44,9 -44,10 +44,11 @@@ set(SRC_DNA_IN ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_fileglobal_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_freestyle_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_genfile.h + ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpencil_modifier_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpencil_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_shader_fx_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpu_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_groom_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_group_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_hair_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_image_types.h diff --cc source/blender/blenkernel/CMakeLists.txt index 300c52f51c3,2640abab15b..7159165eb39 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@@ -115,7 -117,7 +117,8 @@@ set(SR intern/font.c intern/freestyle.c intern/gpencil.c + intern/gpencil_modifier.c + intern/groom.c intern/hair.c intern/hair_draw.c intern/icons.c @@@ -257,7 -266,7 +267,8 @@@ BKE_freestyle.h BKE_global.h BKE_gpencil.h + BKE_gpencil_modifier.h + BKE_groom.h BKE_hair.h BKE_icons.h BKE_idcode.h diff --cc source/blender/blenkernel/intern/library_query.c index 656d3cff307,0626e051e83..b2f63f246ba --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@@ -1094,8 -1106,8 +1117,10 @@@ bool BKE_library_id_can_use_idtype(ID * return (ELEM(id_type_used, ID_TE, ID_OB)); case ID_LP: return ELEM(id_type_used, ID_IM); + case ID_GD: + return ELEM(id_type_used, ID_MA); + case ID_GM: + return true; case ID_WS: return ELEM(id_type_used, ID_SCR, ID_SCE); case ID_IM: diff --cc source/blender/blenkernel/intern/material.c index 4bdb59b1374,5edf9b9048f..0b27e472f4a --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@@ -232,10 -273,10 +274,14 @@@ Material ***give_matarar(Object *ob mb = ob->data; return &(mb->mat); } + else if (ob->type == OB_GPENCIL) { + gpd = ob->data; + return &(gpd->mat); + } + else if (ob->type == OB_GROOM) { + Groom *groom = ob->data; + return &(groom->mat); + } return NULL; } @@@ -257,10 -299,10 +304,14 @@@ short *give_totcolp(Object *ob mb = ob->data; return &(mb->totcol); } + else if (ob->type == OB_GPENCIL) { + gpd = ob->data; + return &(gpd->totcol); + } + else if (ob->type == OB_GROOM)
[Bf-blender-cvs] [dc2d841b7c5] hair_guides hair_guides_grooming: Merge branch 'blender2.8' into hair_guides
Commit: dc2d841b7c50565302af2986d62ddbd29c332acd Author: Lukas Tönne Date: Sun Aug 12 12:52:49 2018 +0100 Branches: hair_guides hair_guides_grooming https://developer.blender.org/rBdc2d841b7c50565302af2986d62ddbd29c332acd Merge branch 'blender2.8' into hair_guides === === diff --cc intern/cycles/blender/blender_mesh.cpp index c7e8fb6f72f,8a6480a9a42..1d0e8fc6ace --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@@ -1205,16 -1188,10 +1188,12 @@@ Mesh *BlenderSync::sync_mesh(BL::Depsgr create_mesh_volume_attributes(scene, b_ob, mesh, b_scene.frame_current()); } + } - if(view_layer.use_hair && mesh->subdivision_type == Mesh::SUBDIVISION_NONE) - sync_curves(mesh, b_mesh, b_ob, false); + if(view_layer.use_hair && mesh->subdivision_type == Mesh::SUBDIVISION_NONE) + sync_curves(mesh, b_mesh, b_ob, false); - if(can_free_caches) { - b_ob.cache_release(); - } - + if(b_mesh) { /* free derived mesh */ b_data.meshes.remove(b_mesh, false, true, false); } diff --cc release/scripts/startup/bl_ui/__init__.py index e91f3727f20,89aed37f055..3b0cc2527a8 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@@ -42,9 -44,9 +44,10 @@@ _modules = "properties_data_lightprobe", "properties_data_speaker", "properties_data_workspace", +"properties_hair_common", "properties_mask_common", "properties_material", + "properties_material_gpencil", "properties_object", "properties_paint_common", "properties_grease_pencil_common", diff --cc release/scripts/startup/bl_ui/properties_data_modifier.py index cd0617d8f26,93e789bbd19..e2a537acadd --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@@ -1562,27 -1577,464 +1577,485 @@@ class DATA_PT_modifiers(ModifierButtons if md.rest_source == 'BIND': layout.operator("object.correctivesmooth_bind", text="Unbind" if is_bind else "Bind") +def HAIR(self, layout, ob, md): +hsys = md.hair_system + +split = layout.split() + +col = split.column() +col.label("Follicles:") +col.prop(md, "follicle_seed") +col.prop(md, "follicle_count") +col.operator("object.hair_generate_follicles", text="Generate") + +col = split.column() + +col.separator() + +col.prop(hsys, "material_slot", text="") + +col = layout.column() +col.label("Display Settings:") +draw_hair_display_settings(col, md.draw_settings) + + def WEIGHTED_NORMAL(self, layout, ob, md): + layout.label("Weighting Mode:") + split = layout.split(align=True) + col = split.column(align=True) + col.prop(md, "mode", text="") + col.prop(md, "weight", text="Weight") + col.prop(md, "keep_sharp") + + col = split.column(align=True) + row = col.row(align=True) + row.prop_search(md, "vertex_group", ob, "vertex_groups", text="") + row.active = bool(md.vertex_group) + row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT') + col.prop(md, "thresh", text="Threshold") + col.prop(md, "face_influence") + + + class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel): + bl_label = "Modifiers" + + @classmethod + def poll(cls, context): + ob = context.object + return ob and ob.type == 'GPENCIL' + + def draw(self, context): + layout = self.layout + + ob = context.object + + layout.operator_menu_enum("object.gpencil_modifier_add", "type") + + for md in ob.grease_pencil_modifiers: + box = layout.template_greasepencil_modifier(md) + if box: + # match enum type to our functions, avoids a lookup table. + getattr(self, md.type)(box, ob, md) + + # the mt.type enum is (ab)used for a lookup on function names + # ...to avoid lengthy if statements + # so each type must have a function here. + + def GP_NOISE(self, layout, ob, md): + gpd = ob.data + split = layout.split() + + col = split.column() + row = col.row(align=True) + row.prop(md, "factor") + row.prop(md, "random", text="", icon="TIME", toggle=True) + row = col.row() + row.enabled = md.random + row.prop(md, "step") + col.prop(md, "full_stroke") + col.prop(md, "move_extreme") + + col
[Bf-blender-cvs] [8d399eef67b] gsoc-2018-many-light-sampling: Merge branch 'master' into gsoc-2018-many-light-sampling
Commit: 8d399eef67b68d663b93f33aa36fde24564ba81e Author: Erik Englesson Date: Sun Aug 12 12:30:42 2018 +0200 Branches: gsoc-2018-many-light-sampling https://developer.blender.org/rB8d399eef67b68d663b93f33aa36fde24564ba81e Merge branch 'master' into gsoc-2018-many-light-sampling === === diff --cc intern/cycles/blender/addon/properties.py index a5b535eb685,c97d942af9d..7c0283f0d72 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@@ -155,302 -156,289 +156,302 @@@ class CyclesRenderSettings(bpy.types.Pr @classmethod def register(cls): bpy.types.Scene.cycles = PointerProperty( - name="Cycles Render Settings", - description="Cycles render settings", - type=cls, - ) + name="Cycles Render Settings", + description="Cycles render settings", + type=cls, + ) cls.device = EnumProperty( - name="Device", - description="Device to use for rendering", - items=enum_devices, - default='CPU', - ) + name="Device", + description="Device to use for rendering", + items=enum_devices, + default='CPU', + ) cls.feature_set = EnumProperty( - name="Feature Set", - description="Feature set to use for rendering", - items=enum_feature_set, - default='SUPPORTED', - ) + name="Feature Set", + description="Feature set to use for rendering", + items=enum_feature_set, + default='SUPPORTED', + ) cls.shading_system = BoolProperty( - name="Open Shading Language", - description="Use Open Shading Language (CPU rendering only)", - ) + name="Open Shading Language", + description="Use Open Shading Language (CPU rendering only)", + ) cls.progressive = EnumProperty( - name="Integrator", - description="Method to sample lights and materials", - items=enum_integrator, - default='PATH', - ) + name="Integrator", + description="Method to sample lights and materials", + items=enum_integrator, + default='PATH', + ) cls.use_square_samples = BoolProperty( - name="Square Samples", - description="Square sampling values for easier artist control", - default=False, - ) + name="Square Samples", + description="Square sampling values for easier artist control", + default=False, + ) +cls.use_light_tree = BoolProperty( +name="Light Tree", +description="Samples many lights more efficiently", +default=False, +) + +cls.splitting_threshold = FloatProperty( +name="Splitting", +description="Amount of lights to sample at a time, from one light at 0.0, to adaptively more lights as needed, to all lights at 1.0", +min=0.0, max=1.0, +default=0.0, +) + cls.samples = IntProperty( - name="Samples", - description="Number of samples to render for each pixel", - min=1, max=2147483647, - default=128, - ) + name="Samples", + description="Number of samples to render for each pixel", + min=1, max=2147483647, + default=128, + ) cls.preview_samples = IntProperty( - name="Preview Samples", - description="Number of samples to render in the viewport, unlimited if 0", - min=0, max=2147483647, - default=32, - ) + name="Preview Samples", + description="Number of samples to render in the viewport, unlimited if 0", + min=0, max=2147483647, + default=32, + ) cls.preview_pause = BoolProperty( - name="Pause Preview", - description="Pause all viewport preview renders", - default=False, - ) + name="Pause Preview", + description="Pause all viewport preview renders", + default=False, + ) cls.preview_active_layer = BoolProperty( - name="Preview Active Layer", - description="Preview active render layer in viewport", - default=Fals
[Bf-blender-cvs] [209686f1c81] hair_guides_grooming: Merge branch 'hair_guides' into hair_guides_grooming
Commit: 209686f1c8189bc01f91d14a922651844df8b201 Author: Lukas Tönne Date: Sun Aug 12 11:17:33 2018 +0100 Branches: hair_guides_grooming https://developer.blender.org/rB209686f1c8189bc01f91d14a922651844df8b201 Merge branch 'hair_guides' into hair_guides_grooming === === diff --cc source/blender/blenkernel/BKE_hair.h index adea3696893,e24effd9227..3f35e151ada --- a/source/blender/blenkernel/BKE_hair.h +++ b/source/blender/blenkernel/BKE_hair.h @@@ -53,32 -53,26 +53,32 @@@ struct HairSystem* BKE_hair_copy(struc /* Delete a hair system */ void BKE_hair_free(struct HairSystem *hsys); - /* === Guide Strands === */ + /* === Fiber curves === */ - /* Allocate buffers for defining guide curves - * \param totcurves Number of guide curves to allocate + /* Allocate buffers for defining fiber curves + * \param totcurves Number of fiber curves to allocate + * \param totverts Number of guide curve vertices to allocate + */ +void BKE_hair_guide_curves_alloc(struct HairSystem *hsys, int totcurves, int totverts); + +/* Allocate buffers for defining guide curves + * \param totcurves Number of guide curves to allocate */ - void BKE_hair_guide_curves_begin(struct HairSystem *hsys, int totcurves); + void BKE_hair_fiber_curves_begin(struct HairSystem *hsys, int totcurves); - /* Set properties of a guide curve - * \param index Index of the guide guide curve - * \param mesh_sample Origin of the guide curve on the scalp mesh. - * \param numverts Number of vertices in this guide curve + /* Set properties of a fiber curve + * \param index Index of the fiber curve + * \param mesh_sample Origin of the fiber curve on the scalp mesh. + * \param numverts Number of vertices in this fiber curve */ - void BKE_hair_set_guide_curve(struct HairSystem *hsys, int index, const struct MeshSample *mesh_sample, int numverts, + void BKE_hair_set_fiber_curve(struct HairSystem *hsys, int index, int numverts, float taper_length, float taper_thickness); - /* Finalize guide curve update */ - void BKE_hair_guide_curves_end(struct HairSystem *hsys); + /* Finalize fiber curve update */ + void BKE_hair_fiber_curves_end(struct HairSystem *hsys); - /* Set properties of a guide curve vertex - * \param index Index of the guide curve vertex. + /* Set properties of a fiber curve vertex + * \param index Index of the fiber curve vertex. * \param flag Flags to set on the vertex. * \param co Location of the vertex in object space. */ diff --cc source/blender/draw/intern/draw_cache.h index 8678f9b1f5c,aef32291215..2702303e06a --- a/source/blender/draw/intern/draw_cache.h +++ b/source/blender/draw/intern/draw_cache.h @@@ -31,10 -31,8 +31,9 @@@ struct GPUMaterial struct ModifierData; struct Object; struct PTCacheEdit; +struct Groom; struct HairSystem; struct HairExportCache; - struct DRWHairFiberTextureBuffer; void DRW_shape_cache_free(void); void DRW_shape_cache_reset(void); diff --cc source/blender/draw/intern/draw_cache_impl.h index d6c117321a7,caef4979ee3..9cd114c1454 --- a/source/blender/draw/intern/draw_cache_impl.h +++ b/source/blender/draw/intern/draw_cache_impl.h @@@ -36,10 -36,8 +36,9 @@@ struct ListBase struct ModifierData; struct ParticleSystem; struct PTCacheEdit; +struct Groom; struct HairSystem; struct HairExportCache; - struct DRWHairFiberTextureBuffer; struct Curve; struct Lattice; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [27b28e437d9] hair_guides hair_guides_grooming: Merge branch 'tmp_hair_curves' into hair_guides
Commit: 27b28e437d974ebbafa234205941c07aa0ab546c Author: Lukas Tönne Date: Sun Aug 12 11:05:36 2018 +0100 Branches: hair_guides hair_guides_grooming https://developer.blender.org/rB27b28e437d974ebbafa234205941c07aa0ab546c Merge branch 'tmp_hair_curves' into hair_guides === === diff --cc source/blender/draw/engines/workbench/workbench_forward.c index af5ba3dc357,2e3e9341f1b..3cc04d7936a --- a/source/blender/draw/engines/workbench/workbench_forward.c +++ b/source/blender/draw/engines/workbench/workbench_forward.c @@@ -271,10 -262,10 +262,9 @@@ void workbench_forward_engine_init(WORK memset(e_data.composite_sh_cache, 0x00, sizeof(struct GPUShader *) * MAX_SHADERS); memset(e_data.transparent_accum_sh_cache, 0x00, sizeof(struct GPUShader *) * MAX_SHADERS); - char *defines = workbench_material_build_defines(wpd, false, DRW_SHADER_HAIR_NONE); - char *defines_texture = workbench_material_build_defines(wpd, true, DRW_SHADER_HAIR_NONE); - char *defines_hair = workbench_material_build_defines(wpd, false, DRW_SHADER_HAIR_PARTICLES); - char *defines_hair_fibers = workbench_material_build_defines(wpd, false, DRW_SHADER_HAIR_FIBERS); + char *defines = workbench_material_build_defines(wpd, false, false); + char *defines_texture = workbench_material_build_defines(wpd, true, false); + char *defines_hair = workbench_material_build_defines(wpd, false, true); - char *defines_hair_fibers = workbench_material_build_defines(wpd, false, true); char *forward_vert = workbench_build_forward_vert(); e_data.object_outline_sh = DRW_shader_create( forward_vert, NULL, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4608e5ac269] gsoc-2018-many-light-sampling: Cycles: light_tree_pdf() now accounts for splitting
Commit: 4608e5ac269758df5c37e57b77afadd27fcf6de2 Author: Erik Englesson Date: Fri Aug 10 22:40:17 2018 +0200 Branches: gsoc-2018-many-light-sampling https://developer.blender.org/rB4608e5ac269758df5c37e57b77afadd27fcf6de2 Cycles: light_tree_pdf() now accounts for splitting For the MIS calculations we need to be able to calculate the probability to sample a light using the light tree. This did not account for splitting so if splitting was used the probability would be wrong. This has now been fixed. Also, if we are in PATH mode then the splitting threshold is set to zero. === M intern/cycles/blender/blender_sync.cpp M intern/cycles/kernel/kernel_light.h M intern/cycles/kernel/kernel_path_surface.h === diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index bb67099a0c2..73ddfccd91b 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -282,7 +282,12 @@ void BlenderSync::sync_integrator() Integrator::PATH); integrator->use_light_tree = get_boolean(cscene, "use_light_tree"); - integrator->splitting_threshold = get_float(cscene, "splitting_threshold"); + if(get_enum(cscene, "progressive") == 0) { + integrator->splitting_threshold = get_float(cscene, "splitting_threshold"); + } + else { // Not using branched path tracing + integrator->splitting_threshold = 0.0f; + } integrator->sample_all_lights_direct = get_boolean(cscene, "sample_all_lights_direct"); integrator->sample_all_lights_indirect = get_boolean(cscene, "sample_all_lights_indirect"); integrator->light_sampling_threshold = get_float(cscene, "light_sampling_threshold"); diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h index 1c6ca7a3c98..44aacf7b06a 100644 --- a/intern/cycles/kernel/kernel_light.h +++ b/intern/cycles/kernel/kernel_light.h @@ -1439,9 +1439,83 @@ ccl_device int triangle_to_distribution(KernelGlobals *kg, int triangle_id, return kernel_tex_fetch(__triangle_to_distribution, first*3+2); } +/* Decides whether to go down both childen or only one in the tree traversal. + * The split heuristic is based on the variance of the lighting within the node. + * There are two types of variances that are considered: variance in energy and + * in the distance term 1/d^2. The variance in energy is pre-computed on the + * host but the distance term is calculated here. These variances are then + * combined and normalized to get the final splitting heuristic. High variance + * leads to a lower splitting heuristic which leads to more splits during the + * traversal. */ +ccl_device bool split(KernelGlobals *kg, float3 P, int node_offset) +{ + /* early exists if never/always splitting */ + const float threshold = kernel_data.integrator.splitting_threshold; + if(threshold == 0.0f){ + return false; + } else if(threshold == 1.0f){ + return true; + } + + /* extract bounding box of cluster */ + const float4 node1 = kernel_tex_fetch(__light_tree_nodes, node_offset + 1); + const float4 node2 = kernel_tex_fetch(__light_tree_nodes, node_offset + 2); + const float3 bboxMin = make_float3(node1.x, node1.y, node1.z); + const float3 bboxMax = make_float3(node1.w, node2.x, node2.y); + + /* if P is inside bounding sphere then split */ + const float3 centroid = 0.5f * (bboxMax + bboxMin); + const float radius_squared = len_squared(bboxMax - centroid); + const float dist_squared = len_squared(centroid - P); + + if(dist_squared <= radius_squared){ + return true; + } + + /* eq. 8 & 9 */ + + /* the integral in eq. 8 requires us to know the interval the distance can +* be in: [a,b]. This is found by considering a bounding sphere around the +* bounding box of the node and "a" then becomes the smallest distance to +* this sphere and "b" becomes the largest. */ + const float radius = sqrt(radius_squared); + const float dist = sqrt(dist_squared); + const float a = dist - radius; + const float b = dist + radius; + + const float g_mean = 1.0f / (a * b); + const float g_mean_squared = g_mean * g_mean; + const float a3 = a * a * a; + const float b3 = b * b * b; + const float g_variance = (b3 - a3) / (3.0f * (b - a) * a3 * b3) - + g_mean_squared; + + /* eq. 10 */ + const float4 node0 = kernel_tex_fetch(__light_tree_nodes, node_offset ); + const float4 node3 = kernel_tex_fetch(__light_tree_nodes, node_offse
[Bf-blender-cvs] [2d839a08e49] gsoc-2018-many-light-sampling: Cycles: Removed unused code
Commit: 2d839a08e4939d7c5a113f675cebf5cb8cd7d2bc Author: Erik Englesson Date: Fri Aug 10 19:39:57 2018 +0200 Branches: gsoc-2018-many-light-sampling https://developer.blender.org/rB2d839a08e4939d7c5a113f675cebf5cb8cd7d2bc Cycles: Removed unused code The simplified GGX code is no longer needed with the new splitting heuristic and has now been removed. === M intern/cycles/kernel/closure/bsdf_microfacet.h === diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h index 369beee1d2c..2dd59354058 100644 --- a/intern/cycles/kernel/closure/bsdf_microfacet.h +++ b/intern/cycles/kernel/closure/bsdf_microfacet.h @@ -391,81 +391,6 @@ ccl_device void bsdf_microfacet_ggx_blur(ShaderClosure *sc, float roughness) bsdf->alpha_y = fmaxf(roughness, bsdf->alpha_y); } -/* TODO: Use this in the tree traversal splitting */ -ccl_device float3 bsdf_microfacet_ggx_eval_reflect_simple(const ShaderClosure *sc, const float3 I, const float3 omega_in) -{ - const MicrofacetBsdf *bsdf = (const MicrofacetBsdf*)sc; - float alpha_x = bsdf->alpha_x; - float alpha_y = bsdf->alpha_y; - bool m_refractive = bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID; - float3 N = bsdf->N; - - if(m_refractive || alpha_x*alpha_y <= 1e-7f) - return make_float3(0.0f, 0.0f, 0.0f); - - float cosNO = dot(N, I); - float cosNI = dot(N, omega_in); // pass in our conservative cosine instead of this one? - // fresnel calcs some kind of cosine with I too. - - if(cosNI > 0 && cosNO > 0) { - /* get half vector */ - float3 m = normalize(omega_in + I); - float alpha2 = alpha_x * alpha_y; - float D, G1o, G1i; - - /* assume isotropic */ - - /* isotropic -* eq. 20: (F*G*D)/(4*in*on) -* eq. 33: first we calculate D(m) */ - float cosThetaM = dot(N, m); - float cosThetaM2 = cosThetaM * cosThetaM; - float cosThetaM4 = cosThetaM2 * cosThetaM2; - float tanThetaM2 = (1 - cosThetaM2) / cosThetaM2; - - /* use GTR2 */ - D = alpha2 / (M_PI_F * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2)); - - /* eq. 34: now calculate G1(i,m) and G1(o,m) */ - //G1o = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO))); - //G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); - - /* Let a2=alpha2 and cos=cosNO/cosNI then the above is equivalent to: -* 2/ (1 + sqrt( 1 + a2 * (1 - cos^2) / cos^2 ) ) = /common denom/ = -* 2/ (1 + sqrt( (cos^2 + a2 * (1 - cos^2)) / cos^2 ) ) = /factor out 1/cos^2/ = -* 2/ (1 + sqrt( cos^2 + a2 * (1 - cos^2) ) / cos ) = /common denom/ = -* 2/ ( (cos + sqrt( cos^2 + a2 * (1 - cos^2) ) ) / cos = /move cos to num/= -* 2cos / ( cos + sqrt( cos^2 + a2 * (1 - cos^2) ) ) = /rewrite sqrt/ = -* 2cos / ( cos + sqrt( cos^2 * (1 - a2) + a2 ) ) -* => removes one of the divisions -* -* - Glo should contain a cosNO in its numerator but this cancels with -*cosNO in the denomenator in eq. 20.(removes another division) -* - There should be a cosNI in the denomenator of eq. 20 but I think -*this has been canceled out already since there is no cosNI in -*path_radiance_bsdf_bounce() ? -* - Both Glo and Gli should contain a 2.0 in their numerators but they -*cancel with 1/4 in eq. 20. -* -* => This code does three less divisions in total -* This could potentially be used in the real GGX evaluation too. -*/ - G1o = 1.0f / (cosNO + safe_sqrtf(cosNO * cosNO * (1.0f - alpha2) + alpha2)); - G1i = cosNI / (cosNI + safe_sqrtf(cosNI * cosNI * (1.0f - alpha2) + alpha2)); - - float G = G1o * G1i; - - /* eq. 20 */ - float3 F = reflection_color(bsdf, omega_in, m); - - float3 out = F * G * D; - - return out; - } - - return make_float3(0.0f, 0.0f, 0.0f); -} - ccl_device float3 bsdf_microfacet_ggx_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf) { const MicrofacetBsdf *bsdf = (const MicrofacetBsdf*)sc;
[Bf-blender-cvs] [f854fefa179] tmp_hair_curves: Separate buffer texture for hair index for each vertex.
Commit: f854fefa1796429907c2574ba414335eb5519714 Author: Lukas Tönne Date: Sun Aug 12 10:33:21 2018 +0100 Branches: tmp_hair_curves https://developer.blender.org/rBf854fefa1796429907c2574ba414335eb5519714 Separate buffer texture for hair index for each vertex. This is needed for allowing variable length hair strands, where the hair index can not simply be calculated from the vertex index based on a fixed-length strand. === M source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl M source/blender/draw/intern/draw_cache_impl_particles.c M source/blender/draw/intern/draw_hair.c M source/blender/draw/intern/draw_hair_private.h M source/blender/draw/modes/shaders/common_hair_lib.glsl === diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl index 66b529fcf5e..dfc45c8d04c 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl @@ -23,6 +23,8 @@ out vec3 normal_viewport; out vec2 uv_interp; #endif +out int DEBUG; + /* From http://libnoise.sourceforge.net/noisegen/index.html */ float integer_noise(int n) { @@ -34,6 +36,7 @@ float integer_noise(int n) void main() { #ifdef HAIR_SHADER + DEBUG = hair_get_strand_id(); # ifdef V3D_SHADING_TEXTURE_COLOR vec2 uv = hair_get_customdata_vec2(u); # endif diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c index 0d29debfae1..da360f89051 100644 --- a/source/blender/draw/intern/draw_cache_impl_particles.c +++ b/source/blender/draw/intern/draw_cache_impl_particles.c @@ -743,13 +743,23 @@ static void ensure_seg_pt_final_count( final_cache->elems_len = (points_per_curve * thickness_res + 1) * final_cache->strands_len; } +#define USE_POSITION_HAIR_INDEX + static void particle_batch_cache_ensure_procedural_final_points( +const ParticleSystem *psys, ParticleHairCache *cache, int subdiv) { + /* Same format as point_tex. */ +#ifdef USE_POSITION_HAIR_INDEX + static Gwn_VertFormat format = { 0 }; + GWN_vertformat_clear(&format); + uint pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); +#else Gwn_VertFormat format = { 0 }; GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 4, GWN_FETCH_FLOAT); +#endif cache->final[subdiv].proc_point_buf = GWN_vertbuf_create_with_format(&format); @@ -757,12 +767,53 @@ static void particle_batch_cache_ensure_procedural_final_points( /* Thoses are points! not line segments. */ GWN_vertbuf_data_alloc(cache->final[subdiv].proc_point_buf, cache->final[subdiv].point_len); +#ifdef USE_POSITION_HAIR_INDEX + Gwn_VertBufRaw data_step; + GWN_vertbuf_attr_get_raw_data(cache->final[subdiv].proc_point_buf, pos_id, &data_step); + const int points_per_curve = (1 << (psys->part->draw_step + subdiv)) + 1; + for (int i = 0; i < cache->final[subdiv].strands_len; i++) { + for (int j = 0; j < points_per_curve; ++j) { + uint *data = (uint *)GWN_vertbuf_raw_step(&data_step); + *data = (uint)i; + } + } +#endif + /* Create vbo immediatly to bind to texture buffer. */ GWN_vertbuf_use(cache->final[subdiv].proc_point_buf); cache->final[subdiv].proc_tex = GPU_texture_create_from_vertbuf(cache->final[subdiv].proc_point_buf); } +static void particle_batch_cache_ensure_procedural_final_hair_index( +const ParticleSystem *psys, +ParticleHairCache *cache, +int subdiv) +{ + /* Same format as point_tex. */ + Gwn_VertFormat format = { 0 }; + uint hair_index_id = GWN_vertformat_attr_add(&format, "hair_index", GWN_COMP_U32, 1, GWN_FETCH_INT); + + cache->final[subdiv].proc_hair_index_buf = GWN_vertbuf_create_with_format(&format); + + GWN_vertbuf_data_alloc(cache->final[subdiv].proc_hair_index_buf, cache->final[subdiv].point_len); + + Gwn_VertBufRaw data_step; + GWN_vertbuf_attr_get_raw_data(cache->final[subdiv].proc_hair_index_buf, hair_index_id, &data_step); + const int points_per_curve = (1 << (psys->part->draw_step + subdiv)) + 1; + for (int i = 0; i < cache->final[subdiv].strands_len; i++) { + for (int j = 0; j < points_per_curve; ++j) { + uint *data = (uint *)GWN_vertbuf_raw_step(&data_step); + *data = (uint)i; + } + } + + /* Create vbo immediatly to bind to texture buffer. */ + GWN_vertbuf_use(cache->final[subdiv].proc_hair_index_buf); +
[Bf-blender-cvs] [57beb92ccec] soc-2018-cycles-volumes: Minor bug-fixes and optimizations.
Commit: 57beb92ccec7d4952636231fc54b106aacb17d55 Author: Geraldine Chua Date: Sun Aug 12 17:14:29 2018 +0800 Branches: soc-2018-cycles-volumes https://developer.blender.org/rB57beb92ccec7d4952636231fc54b106aacb17d55 Minor bug-fixes and optimizations. * Change most instances of division and modulo with TILE_SIZE to bit shifting. Much more efficient since TILE_SIZE should be a power of 2. * Added intialization for some Mesh members. Previously had motion blur randomly toggle on and off otherwise. * Fixed issue where voxel to tile correspondence is different between external VDBs and internal sparse grids. The fix requires generating a new VDB grid which may be too memory intensive. Better method would be translating grids in place. * Fixed misc OpenVDB to grid conversion issues. === M intern/cycles/blender/blender_object.cpp M intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h M intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h M intern/cycles/kernel/kernels/opencl/kernel_opencl_image.h M intern/cycles/render/mesh.cpp M intern/cycles/render/openvdb.cpp M intern/cycles/util/util_sparse_grid.h M intern/cycles/util/util_texture.h === diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index 99f233524a4..6374c18d6fb 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -437,10 +437,6 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph, Scene::MotionType need_motion = scene->need_motion(); if(need_motion != Scene::MOTION_NONE && object->mesh) { Mesh *mesh = object->mesh; - mesh->motion_steps = 0; - mesh->use_motion_blur = false; - mesh->use_volume_motion_blur = false; - uint motion_steps; if(scene->need_motion() == Scene::MOTION_BLUR) { diff --git a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h index bd5594b60f9..82f04300127 100644 --- a/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h +++ b/intern/cycles/kernel/kernels/cpu/kernel_cpu_image.h @@ -92,18 +92,18 @@ struct TextureInterpolator { const int *offsets, int x, int y, int z) { - int tix = x / TILE_SIZE, itix = x % TILE_SIZE, - tiy = y / TILE_SIZE, itiy = y % TILE_SIZE, - tiz = z / TILE_SIZE, itiz = z % TILE_SIZE; - int tile_index = tix + s_info.tiled_w * (tiy + tiz * s_info.tiled_h); - int sparse_index = offsets[tile_index]; - if(sparse_index < 0) { + int tile_start = offsets[(x >> TILE_INDEX_SHIFT) ++ s_info.tiled_w +* ((y >> TILE_INDEX_SHIFT) + + (z >> TILE_INDEX_SHIFT) + * s_info.tiled_h)]; + if(tile_start < 0) { return make_float4(0.0f); } - int itiw = (x > s_info.div_w) ? s_info.remain_w : TILE_SIZE; - int itih = (y > s_info.div_h) ? s_info.remain_h : TILE_SIZE; - int in_tile_index = itix + itiw * (itiy + itiz * itih); - return read(data[sparse_index + in_tile_index]); + return read(data[tile_start + (x & TILE_INDEX_MASK) + + ((x > s_info.div_w) ? s_info.remain_w : TILE_SIZE) + * ((y & TILE_INDEX_MASK) + (z & TILE_INDEX_MASK) + * ((y > s_info.div_h) ? s_info.remain_h : TILE_SIZE))]); } static ccl_always_inline float4 read_data(const T *data, diff --git a/intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h b/intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h index c1c302de598..097c984d63f 100644 --- a/intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h +++ b/intern/cycles/kernel/kernels/cuda/kernel_cuda_image.h @@ -67,22 +67,21 @@ ccl_device bool sparse_coordinates(const SparseTextureInfo *s_info, float &fx, f modff(fy, &iy); modff(fz, &iz); int x = int(ix), y = int(iy), z = int(iz); - int tix = x / TILE_SIZE, sx = (x % TILE_SIZE) + SPARSE_PAD, - tiy = y / TILE_SIZE, sy = (y % TILE_SIZE) + SPARSE_PAD, - tiz = z / TILE_SIZE, sz = (z % TILE_SIZE) + SPARSE_PAD; - int tile = tix + s_info->tiled_w * (tiy + tiz * s_info->tiled_h); + int tile = (x >> TILE_INDEX_SHIFT) + s_info->tiled_w + * ((y >> TILE_INDEX_SHIFT) + (z >> TILE_INDEX_SHIFT) * s_info->tiled_h); int start_x = offsets[tile];