Page MenuHome

Deformation checkbox should be visible but isn't
Open, NormalPublic


I discovered this in 2.76, I upgraded to the official 2.78c release and it's still there. Happens on both of my computers. This is a simple settings related bug.

The deforming checkbox in rigid collisions should be visible for "Final" as well as "Deform".

In depth description
In the rigid body collisions panel, there's a selection menu for "source". The options are in the following order:

  1. Final
  2. Deform
  3. Base

at this point, set the shape dropdown to "Mesh" <

If you set the source to "Deform", a checkbox appears called "deforming". However this checkbox disappears for "Final", even though changing it's state inside "Deform" has an impact.

Steps to reproduce
0. Open blender >.>

  1. Make the starting cube a rigid body
  2. Check the "animated" box (so it doesn't fall away).
  3. Set the shape to "Mesh" inside "Rigid body collisions"

note that a "deforming" checkbox has appeared just below. Leave it unchecked.

  1. Add two shape keys to the cube
  2. In "key 1", pull two adjacent top vertices of the cube down to make it into a slope.
  3. Keyframe the shape key so at frame 20 it's at 0, and at frame 30 it's at 1 (so it goes from being flat to sloped).
  4. Add a second cube, and make it a rigid body too.
  5. Place that cube above the first one.
  1. If you run the simulation now, it will ignore the cube below changing shape. As expected.
  2. Go back into the first cube, and check that "deforming" box.
  3. Running the simulation again, the cube will slide off when the shape key changes.
  4. Disable "deforming" again, and change the source to "Final"
  5. Note that the checkbox disappears
  6. Running the simulation now, the cube will not fall.
  7. Change the source to "deform", check the "deforming" box and swap the source back to "final"
  8. Running the simulation will show the cube now falls.

That checkbox should not disappear between final and deform, as it has an impact on the situation.



Event Timeline

Aaron Carlisle (Blendify) lowered the priority of this task from Needs Triage by Developer to Needs Information from User.Apr 16 2017, 7:56 PM

Thanks for the report but it would be helpful if you add a blend-file to the report that demonstrates the issue at hand.

It's probably easier to just recreate it from my steps, but here you go

Aaron Carlisle (Blendify) raised the priority of this task from Needs Information from User to Needs Triage by Developer.Apr 17 2017, 1:22 AM
Aaron Carlisle (Blendify) lowered the priority of this task from Needs Triage by Developer to Normal.Apr 17 2017, 5:32 PM

I see why this is happing, in

if rbo.collision_shape == 'MESH' and rbo.mesh_source == 'DEFORM':
    layout.prop(rbo, "use_deform", text="Deforming")

However, I am not completely familiar with the rigid body system so I would like to discuss exactly how the UI should behave before making a patch.

According to your described wanted behavior this patch should work

1diff --git a/release/scripts/startup/bl_ui/ b/release/scripts/startup/bl_ui/
2index eeb21c0..b29576b 100644
3--- a/release/scripts/startup/bl_ui/
4+++ b/release/scripts/startup/bl_ui/
5@@ -75,7 +75,7 @@ class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
6 if rbo.collision_shape in {'MESH', 'CONVEX_HULL'}:
7 layout.prop(rbo, "mesh_source", text="Source")
9- if rbo.collision_shape == 'MESH' and rbo.mesh_source == 'DEFORM':
10+ if rbo.collision_shape == 'MESH' and rbo.mesh_source != 'BASE':
11 layout.prop(rbo, "use_deform", text="Deforming")
13 split = layout.split()

So I guess this patch would be fine as long as you do not also need the Deform checkbox for Base. @Philip Barto (Pobnobs) can you confirm this as being desired behavior?

Yes, I believe that is the desired behaviour, based on the tooltips:
Base - "Base mesh"
Deform - "Deformations, shape keys, deform modifiers"
Final - "All modifiers"

I'm not actually sure what "Final" includes that deform doesn't have already, as the tool tip doesn't really say. However, I've just noticed that "deforming"s state also has an impact in "Base" mode (which I don't think should happen either).

If I had to suggest the behaviour:
Rather than have the checkbox disappear, make it persistent but grayed out when in "Base" mode. It also needs to be treated as false in base mode (but still display whatever the user has put in for convenience).

But after writing all this out, I wonder what's actually going on under the hood for these modes, and whether a dropdown is even necessary. If it's literally just shapekeys and deforming modifiers, surely an enable/disable checkbox for each would be more logical.

And I'm not sure if it's relevant to this bug or even a bug in the first place, but when set to "convex hull", shape keys don't impact the physics world either.
The tooltip for "convex hull" describes itself as "shrink wrap", which implies that it should be affected so long as it's not concave?

The "convex hull" option also still retains the deformation options dropdown, which suggests it's also intended to have this property.

Potential fix for this problem in form of allowing to have the "Final deforming" as valid combination too for Mesh. This enables the checkbox and rebuilds the collision mesh in case the vertex count changed between current rigidbody shape and current final Derivedmesh.

Patch again as paste... for easier review :)

1diff --git a/intern/rigidbody/RBI_api.h b/intern/rigidbody/RBI_api.h
2index 688ca91..2fe8ea9 100644
3--- a/intern/rigidbody/RBI_api.h
4+++ b/intern/rigidbody/RBI_api.h
5@@ -237,6 +237,8 @@ rbCollisionShape *RB_shape_new_trimesh(rbMeshData *mesh);
6 /* 2b - GImpact Meshes */
7 rbCollisionShape *RB_shape_new_gimpact_mesh(rbMeshData *mesh);
9+/* for final deforming, to determine whether vertex count might have changed */
10+int RB_shape_get_num_verts(rbCollisionShape *shape);
12 /* Cleanup --------------------------- */
14diff --git a/intern/rigidbody/rb_bullet_api.cpp b/intern/rigidbody/rb_bullet_api.cpp
15index 17bb381..cf78dbe 100644
16--- a/intern/rigidbody/rb_bullet_api.cpp
17+++ b/intern/rigidbody/rb_bullet_api.cpp
18@@ -803,6 +803,17 @@ rbCollisionShape *RB_shape_new_gimpact_mesh(rbMeshData *mesh)
19 return shape;
20 }
22+/* needed to rebuild mesh on demand */
23+int RB_shape_get_num_verts(rbCollisionShape *shape)
25+ if (shape->mesh)
26+ {
27+ return shape->mesh->num_vertices;
28+ }
30+ return 0;
33 /* Cleanup --------------------------- */
35 void RB_shape_delete(rbCollisionShape *shape)
36diff --git a/release/scripts/startup/bl_ui/ b/release/scripts/startup/bl_ui/
37index 6afdd80..2164f37 100644
38--- a/release/scripts/startup/bl_ui/
39+++ b/release/scripts/startup/bl_ui/
40@@ -75,7 +75,7 @@ class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
41 if rbo.collision_shape in {'MESH', 'CONVEX_HULL'}:
42 layout.prop(rbo, "mesh_source", text="Source")
44- if rbo.collision_shape == 'MESH' and rbo.mesh_source == 'DEFORM':
45+ if rbo.collision_shape == 'MESH' and rbo.mesh_source in {'DEFORM', 'FINAL'}:
46 layout.prop(rbo, "use_deform", text="Deforming")
48 split = layout.split()
49diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
50index 5353cc2..fc0ec54 100644
51--- a/source/blender/blenkernel/intern/rigidbody.c
52+++ b/source/blender/blenkernel/intern/rigidbody.c
53@@ -1238,13 +1238,28 @@ static void rigidbody_update_sim_ob(Scene *scene, RigidBodyWorld *rbw, Object *o
54 return;
56 if (rbo->shape == RB_SHAPE_TRIMESH && rbo->flag & RBO_FLAG_USE_DEFORM) {
57- DerivedMesh *dm = ob->derivedDeform;
58+ DerivedMesh *dm = NULL;
59+ if (rbo->mesh_source == RBO_MESH_DEFORM) {
60+ dm = ob->derivedDeform;
61+ }
62+ else if (rbo->mesh_source == RBO_MESH_FINAL) {
63+ dm = ob->derivedFinal;
64+ }
66 if (dm) {
67 MVert *mvert = dm->getVertArray(dm);
68 int totvert = dm->getNumVerts(dm);
69 BoundBox *bb = BKE_object_boundbox_get(ob);
71- RB_shape_trimesh_update(rbo->physics_shape, (float *)mvert, totvert, sizeof(MVert), bb->vec[0], bb->vec[6]);
72+ if (RB_shape_get_num_verts(rbo->physics_shape) != totvert)
73+ {
74+ rigidbody_validate_sim_shape(ob, true);
75+ RB_body_set_collision_shape(rbo->physics_object, rbo->physics_shape);
76+ }
77+ else
78+ {
79+ RB_shape_trimesh_update(rbo->physics_shape, (float *)mvert, totvert, sizeof(MVert), bb->vec[0], bb->vec[6]);
80+ }
81 }
82 }

Out of curiosity, when will this be included to an official downloadable build? It seems manually patching is rather complicated. Sorry for incompetence

Wait I removed someone? What...?

Sorry about that, I was being curious with the settings. I must have accidentally enabled one with my post.

This is intentional behaviour. "Final" includes generative modifiers which don't just deform the mesh but generate a new one.
Now we could do shenanigans like rebuilding the collision shapes every frame, but that would be extremely slow and unstable.

As for convex hulls, they don't support deformations so everything is fine there too. Again, we could rebuild the shapes during simulation, but as already said, it's a bad idea.

Making the checkbox greyed out is possible, but I'm not sure if it's a good idea, maybe a question for the UI team?