Lattice Modifier Slowdown even when hidden or unassigned #105268

Closed
opened 2023-02-27 20:16:31 +01:00 by Gabriel Moro · 11 comments

System Information
Operating system: Windows-10-10.0.22621-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 4090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 528.24

Blender Version
Broken: version: 3.4.1, branch: blender-v3.4-release, commit date: 2022-12-19 17:00, hash: rB55485cb379f7
Worked: (newest version of Blender that worked as expected)

Short description of error
Lattice Modifier slows down the object even when there's no lattice object attached to it. And disabling it from the list doesn't change this.

Exact steps for others to reproduce the error
Move the object in the file, disable Lattice, move, delete Lattice, move and see the difference.

*********** ISSUE ABOVE RESOLVED, NEW ISSUE BELOW ********
*********** ISSUE ABOVE RESOLVED, NEW ISSUE BELOW ********
*********** ISSUE ABOVE RESOLVED, NEW ISSUE BELOW ********

These are 2 other issues related to the Lattice Modifer that are the following:

  • When objects have lattice modifiers that are Disabled from the Viewport they still get calculated and slow down animation.
  • Another problem is: Having static Lattice Modifiers (either by disabling or deleting animation) also brings down the FPS in the same amount. In this case, from 24 fps to 6. Problem might be related.

I'm only reporting the second problem because I don't know how a modifier that is just supposed to deform the mesh has so much impact on the animation, so it feels like a bug.

I made the file very small so you can see the issue by disabling / enabling the Modifiers on the head.
To clean all disabled modifiers I used the script:

import bpy

Get a list of all selected objects

selected_objects = bpy.context.selected_objects

Iterate over the selected objects

for obj in selected_objects:

Check if the object has any modifiers

if len(obj.modifiers) > 0:
# Iterate over the object's modifiers
for modifier in obj.modifiers:
# If the modifier is disabled, delete it
if not modifier.show_viewport:
obj.modifiers.remove(modifier)

**System Information** Operating system: Windows-10-10.0.22621-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 4090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 528.24 **Blender Version** Broken: version: 3.4.1, branch: blender-v3.4-release, commit date: 2022-12-19 17:00, hash: `rB55485cb379f7` Worked: (newest version of Blender that worked as expected) **Short description of error** Lattice Modifier slows down the object even when there's no lattice object attached to it. And disabling it from the list doesn't change this. **Exact steps for others to reproduce the error** Move the object in the file, disable Lattice, move, delete Lattice, move and see the difference. *********** ISSUE ABOVE RESOLVED, NEW ISSUE BELOW ******** *********** ISSUE ABOVE RESOLVED, NEW ISSUE BELOW ******** *********** ISSUE ABOVE RESOLVED, NEW ISSUE BELOW ******** These are 2 other issues related to the Lattice Modifer that are the following: - When objects have lattice modifiers that are Disabled from the Viewport they still get calculated and slow down animation. - Another problem is: Having static Lattice Modifiers (either by disabling or deleting animation) also brings down the FPS in the same amount. In this case, from 24 fps to 6. Problem might be related. I'm only reporting the second problem because I don't know how a modifier that is just supposed to deform the mesh has so much impact on the animation, so it feels like a bug. I made the file very small so you can see the issue by disabling / enabling the Modifiers on the head. To clean all disabled modifiers I used the script: import bpy # Get a list of all selected objects selected_objects = bpy.context.selected_objects # Iterate over the selected objects for obj in selected_objects: # Check if the object has any modifiers if len(obj.modifiers) > 0: # Iterate over the object's modifiers for modifier in obj.modifiers: # If the modifier is disabled, delete it if not modifier.show_viewport: obj.modifiers.remove(modifier)
Gabriel Moro added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-02-27 20:16:32 +01:00

Hello @Sergey
This is a really old thing ... : 21db9fff12
I'm not sure what the function of the DEG_add_object_relation(node, object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier"); line?

Hello @Sergey This is a really old thing ... : https://projects.blender.org/blender/blender/commit/21db9fff125410d05f17a6663c0e8be583b5f98f I'm not sure what the function of the `DEG_add_object_relation(node, object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier");` line?

That call makes it so that there is dependency from the object's transform to the modifier.
If a modifier needs transformation of that object it needs to inform the dependnecy graph about it. This will ensure that the transformation on that object is evaluated prior to the evaluation of the modifier.

That call makes it so that there is dependency from the `object`'s transform to the modifier. If a modifier needs transformation of that object it needs to inform the dependnecy graph about it. This will ensure that the transformation on that object is evaluated prior to the evaluation of the modifier.

I mean, if lattice is null, should the dependency on transform still be there?
Even the modifier itself is considered not active
(It was worth asking a little more correctly: is this line really supposed to always be there, is its function needed in any case)

I mean, if lattice is null, should the dependency on transform still be there? Even the modifier itself is considered not active (It was worth asking a little more correctly: is this line really supposed to always be there, is its function needed in any case)

Think I've misread the code (it is quite different in the newer code base, and is more explicit).

So scratch the previous reply, the line you're referring to is about dependency of the evaluated geometry from the object's transformation (of the same object).

You can do something like this:

static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
  LatticeModifierData *lmd = (LatticeModifierData *)md;
  if (!lmd->object || lmd->object->type != OB_LATTICE) {
    return;
  }
  DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_GEOMETRY, "Lattice Modifier");
  DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier");
  DEG_add_depends_on_transform_relation(ctx->node, "Lattice Modifier");
}

This will avoid creating dependencies in the graph until they are actually needed.

P.S. There should be an easy way to de-duplicate the condition in the snippet and in the isDisabled().

Think I've misread the code (it is quite different in the newer code base, and is more explicit). So scratch the previous reply, the line you're referring to is about dependency of the evaluated geometry from the object's transformation (of the same object). You can do something like this: ``` static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx) { LatticeModifierData *lmd = (LatticeModifierData *)md; if (!lmd->object || lmd->object->type != OB_LATTICE) { return; } DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_GEOMETRY, "Lattice Modifier"); DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier"); DEG_add_depends_on_transform_relation(ctx->node, "Lattice Modifier"); } ``` This will avoid creating dependencies in the graph until they are actually needed. P.S. There should be an easy way to de-duplicate the condition in the snippet and in the `isDisabled()`.

That is, can say this:
That commit was correct, but somewhere in history this code began to work differently and the causer was someone else?
(Looking for the causer to confirm this. But given this history, it would be easier to just fix it right away :) )

That is, can say this: That commit was correct, but somewhere in history this code began to work differently and the causer was someone else? (Looking for the causer to confirm this. But given this history, it would be easier to just fix it right away :) )
Iliya Katushenock self-assigned this 2023-02-28 10:46:30 +01:00
Blender Bot added
Status
Resolved
and removed
Status
Needs Info from Developers
labels 2023-04-04 09:26:07 +02:00
Author

Is this fixed in the latest 3.6 beta? I have a scene with some lattice objects. Even when they are hidden they drop the animation from 24fps to 5. You can see on the video when I deactivate (with alt to work on all objects). And the fps returns to normal only after I completely delete the modifier.

I'm reopening but I'm not sure if I should, but I also don't know if you'll see if I don't.

Is this fixed in the latest 3.6 beta? I have a scene with some lattice objects. Even when they are hidden they drop the animation from 24fps to 5. You can see on the video when I deactivate (with alt to work on all objects). And the fps returns to normal only after I completely delete the modifier. I'm reopening but I'm not sure if I should, but I also don't know if you'll see if I don't.
Blender Bot added
Status
Needs Triage
and removed
Status
Resolved
labels 2023-06-08 02:59:22 +02:00

The issue which was initially described (lattice modifier without lattice specified in it) should be fixed in 3.6.

The updated video seems to show a bit different aspect though: you'd expect disabling modifiers will bring FPS up.
Unfortunately, this is a tricky aspect to unentangle, and it was not yet addressed in any version of Blender. There is some related work (like D15625) which optimizes out evaluated of unneeded dependencies, but not the visible object itself.

Do you mind updating the description a little bit, to make it explicit which aspect of the problem still needs to be addressed?

The issue which was initially described (lattice modifier without lattice specified in it) should be fixed in 3.6. The updated video seems to show a bit different aspect though: you'd expect disabling modifiers will bring FPS up. Unfortunately, this is a tricky aspect to unentangle, and it was not yet addressed in any version of Blender. There is some related work (like [D15625](https://archive.blender.org/developer/D15625)) which optimizes out evaluated of unneeded dependencies, but not the visible object itself. Do you mind updating the description a little bit, to make it explicit which aspect of the problem still needs to be addressed?
Author

Thanks a lot Sergey! I've updated the task with a better description of the new issue + the files. Let me know if you need anything else. :)

Thanks a lot Sergey! I've updated the task with a better description of the new issue + the files. Let me know if you need anything else. :)
Iliya Katushenock removed their assignment 2023-06-09 11:40:11 +02:00
Member

Newer problem looks related to existing dependency graph reports: #95198, #73199
@GabrielMoro , can you confirm?

Newer problem looks related to existing dependency graph reports: #95198, #73199 @GabrielMoro , can you confirm?
Pratik Borhade added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2023-06-21 06:42:23 +02:00
Author

It seems to me like it’s the same issue, yes! Thanks for tracking it @PratikPB2123 - (don’t know if I need to close or if you’ll merge)

It seems to me like it’s the same issue, yes! Thanks for tracking it @PratikPB2123 - (don’t know if I need to close or if you’ll merge)
Member

Thanks. Will close the report.
Please subscribe above report(s) for further updates :)

Thanks. Will close the report. Please subscribe above report(s) for further updates :)
Blender Bot added
Status
Archived
and removed
Status
Needs Information from User
labels 2023-06-21 06:47:19 +02:00
Pratik Borhade added
Status
Duplicate
and removed
Status
Archived
labels 2023-06-21 06:47:34 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#105268
No description provided.