Unstable triangle mesh collision bounds #32105

Closed
opened 2012-07-14 18:36:24 +02:00 by Kjartan Tysdal · 17 comments

Category: Physics

%%%Problem is that two objects that do not intersect seems to collide when running game engine physics. The margin setting is at 0 and collision bounds is set to triangle mesh.

See file for example. When you hit "P" you can see that the two objects repel each other. They should just fall down in a straight line.%%%

**Category**: Physics %%%Problem is that two objects that do not intersect seems to collide when running game engine physics. The margin setting is at 0 and collision bounds is set to triangle mesh. See file for example. When you hit "P" you can see that the two objects repel each other. They should just fall down in a straight line.%%%
Author

Changed status to: 'Open'

Changed status to: 'Open'

%%%The initial impulse should be fixed by using bullet's "split impulse" option, not sure if it's implemented in the game engine. I could look into it.

However using dynamic triangle meshes is always problematic, especially when you stack them on top of each other.
A more stable way of dealing with concave objects it to use compound shapes consisting of convex parts.%%%

%%%The initial impulse should be fixed by using bullet's "split impulse" option, not sure if it's implemented in the game engine. I could look into it. However using dynamic triangle meshes is always problematic, especially when you stack them on top of each other. A more stable way of dealing with concave objects it to use compound shapes consisting of convex parts.%%%

%%%Moved from Blender 2.6 Bug Tracker to Game Engine%%%

%%%Moved from Blender 2.6 Bug Tracker to Game Engine%%%

%%%Sergej, would be cool if you'll look into this.

Since it's an issue with GE, moving to it's own tracker.%%%

%%%Sergej, would be cool if you'll look into this. Since it's an issue with GE, moving to it's own tracker.%%%

%%%After looking into this it seems that gimpact (the library used for dynamic mesh collision) has problems with parallel triangles and gives wrong contact point normals that cause objects to move sideways. So dynamic triangle meshes work better if the mesh doesn't have sharp edges and is more round.
There is an alternate algorithm that behaves better in this case but fails in other cases (you can enable it by uncommenting "#define BULLET_TRIANGLE_COLLISION 1" in btGimpactCollisionAlgorithm.h).
I'm not sure if this should be considered a bug or a limitation but it seems that nobody really worked on improving gimpact in the last few years and since I'm not familiar with it at all I won't be able to solve it myself in the near future either.

As I mentioned before using split impulse reduces the initial impulse so the objects don't fly apart but they're still moved because of the problem above.
I've attached a patch that adds a split impulse option for the game engine.

In the end it's best to avoid using dynamic mesh shapes (or at least make them more round) right now.%%%

%%%After looking into this it seems that gimpact (the library used for dynamic mesh collision) has problems with parallel triangles and gives wrong contact point normals that cause objects to move sideways. So dynamic triangle meshes work better if the mesh doesn't have sharp edges and is more round. There is an alternate algorithm that behaves better in this case but fails in other cases (you can enable it by uncommenting "#define BULLET_TRIANGLE_COLLISION 1" in btGimpactCollisionAlgorithm.h). I'm not sure if this should be considered a bug or a limitation but it seems that nobody really worked on improving gimpact in the last few years and since I'm not familiar with it at all I won't be able to solve it myself in the near future either. As I mentioned before using split impulse reduces the initial impulse so the objects don't fly apart but they're still moved because of the problem above. I've attached a patch that adds a split impulse option for the game engine. In the end it's best to avoid using dynamic mesh shapes (or at least make them more round) right now.%%%

%%%Attached a simpler testfile: bullet_gimpact_bug.blend%%%

%%%Attached a simpler testfile: bullet_gimpact_bug.blend%%%

Added subscriber: @alex1

Added subscriber: @alex1

In my opinion, this bug/limitation is quite annoying, because triangle mesh collision bounds is unavoidable for physics precision in some cases (while generally not recommended). Split impulse already exists in rigid body world outside of the game engine, but not inside. I haven't tried the patch, but could we give it a try?

In my opinion, this bug/limitation is quite annoying, because triangle mesh collision bounds is unavoidable for physics precision in some cases (while generally not recommended). Split impulse already exists in rigid body world outside of the game engine, but not inside. I haven't tried the patch, but could we give it a try?

Unfortunately this is a complicated problem.

One good way to work around it would be to use convex decomposition to break concave meshes into convex parts and make compound shapes out of them. This can also be automated.
I've experimented with this and had mixed results. I'll definitely come back to it though, so we should have convex decomposition in some form in future releases.

Also see this bullet bug for more details: http://code.google.com/p/bullet/issues/detail?id=662&colspec=Modified%20ID%20Type%20Stars%20Status%20Owner%20Summary

Unfortunately this is a complicated problem. One good way to work around it would be to use convex decomposition to break concave meshes into convex parts and make compound shapes out of them. This can also be automated. I've experimented with this and had mixed results. I'll definitely come back to it though, so we should have convex decomposition in some form in future releases. Also see this bullet bug for more details: http://code.google.com/p/bullet/issues/detail?id=662&colspec=Modified%20ID%20Type%20Stars%20Status%20Owner%20Summary
Member

Added subscriber: @brita

Added subscriber: @brita
Member

taking a look at the patch..
@sreich shouldn't "(lowers stacking stability slightly)" be increases stability?
Reading the linked bullet bug report, it seems that Erwin added a btConvexHullComputer that blender is not using.
Is it possible to use this for all triangles mesh shapes? Would it be a good idea? @sreich would this be the way of automatically building a 'compound capsule' shape that I have been emailing you about?

taking a look at the patch.. @sreich shouldn't "(lowers stacking stability slightly)" be increases stability? Reading the linked bullet bug report, it seems that Erwin added a btConvexHullComputer that blender is not using. Is it possible to use this for all triangles mesh shapes? Would it be a good idea? @sreich would this be the way of automatically building a 'compound capsule' shape that I have been emailing you about?

No, it does lower stacking stability. If you use it you'll need more solver iterations/simulation steps.
The thing is that in this case split impulse might only marginally help and only sometimes.

As for the bullet bug report, what Erwin added is a utility to create compound shapes from Gimpact collision shapes. We tried using it in the GE but it caused problems (was much slower and had bugs when doing raycasts).

As for btConvexHullComputer, we do use it in blender, but not in the GE, which still uses the older hull computer. Not sure if it's needed.

No, it does lower stacking stability. If you use it you'll need more solver iterations/simulation steps. The thing is that in this case split impulse might only marginally help and only sometimes. As for the bullet bug report, what Erwin added is a utility to create compound shapes from Gimpact collision shapes. We tried using it in the GE but it caused problems (was much slower and had bugs when doing raycasts). As for btConvexHullComputer, we do use it in blender, but not in the GE, which still uses the older hull computer. Not sure if it's needed.
Member

blender already uses btConvexHullComputer? Can you point me to where?
So using this new one would possibly not have the previous bugs/ problems? it's worth a try?

blender already uses btConvexHullComputer? Can you point me to where? So using this new one would possibly not have the previous bugs/ problems? it's worth a try?

@brita
Look in intern/rigidbody/rb_bullet_api.cpp, also the convex hull mesh operator in edit mode uses it.
As for whether the GE should use it or not, I didn't make quality comparisons but the new hull computer should be much faster with bigger meshes.
So for games this shouldn't be that important since you generally don't use big meshes and we didn't get any complaints about convex hull generation afaik.

@brita Look in intern/rigidbody/rb_bullet_api.cpp, also the convex hull mesh operator in edit mode uses it. As for whether the GE should use it or not, I didn't make quality comparisons but the new hull computer should be much faster with bigger meshes. So for games this shouldn't be that important since you generally don't use big meshes and we didn't get any complaints about convex hull generation afaik.
Member

Added subscriber: @Blendify

Added subscriber: @Blendify
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Aaron Carlisle self-assigned this 2019-06-29 02:20:37 +02:00
Member

This task is being closed because the BGE has been removed in Blender 2.8.

This task is being closed because the BGE has been removed in Blender 2.8.
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
6 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#32105
No description provided.