Hi,
I would like to start a discussion about 3D Viewport performance issues in Blender 2.8 (or newer version). I found some issues - mainly in scene with a lot of particles with dupli-objects. I have some ideas, but I need help how to fix it.
3D Viewport performance issues:
1) Cycles renderer: scene->camera resolution is changed for each sample (in Session::update_scene()) – BlenderCamera rewrites width and height in blender_camera_sync(…)
2) Cycles renderer: “Updating Camera Volume” issue for none volume scene when lot of objects/particles is used (in Scene::device_update()) – there is for loop over all objects (include dupliobjects) in Camera::device_update_volume() for each movement in 3D Viewport
3) Cycles renderer: extreme calling of BlenderSync::sync_data() for each movement in 3D Viewport – If some shader in the scene uses object_dependency then 3D viewport is very slow
4) Cycles, Eevee, Workbench: depsgraph iterator removes and recreates all dupliobjects/particles – object_dupli/make_duplis is called everytime for each movement in 3D Viewport
3D Viewport performance issues – how to fix it?:
Add 1) blender_camera.cpp -> void blender_camera_sync(…):
cam->width = width; // bcam->full_width;
cam->height = height; //bcam->full_height;
Add 2) camera.cpp -> void Camera::device_update_volume(…):
// Add checking of use_volumes in the scene
KernelIntegrator* kintegrator = &dscene->data.integrator;
if (!kintegrator->use_volumes) return;
// Add openmp
# pragma omp parallel for
for (size_t i = 0; i < scene->objects.size(); ++i) {...}
Add 3) blender_session.cpp -> BlenderSession::synchronize(…):
// Add checking of user settings in 3D viewport panel
If (GUI_3D_VIEWPORT_PANEL->CHECKBOX_SKIP_SYNC_DATA) sync->sync_data(…)
Add 4) object_dupli.c -> ListBase *object_duplilist(…):
// Add cache of duplilist for object
ListBase* duplilist = BKE_object_cache_duplilist_get(ob);
if (duplilist == NULL) {
duplilist = MEM_callocN(sizeof(ListBase), "duplilist");
...
}
return duplilist;
Thanks.
Milan