-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Heightmap triangulation pattern differs between ODE and OGRE #2838
Comments
This adds a python script to the media/materials/textures folder that can be used to generate a png file with a square grayscale gradient that corresponds to a pyramid heightmap. Due to gazebosim#2838, the triangulation pattern differs between OGRE and ODE, so some contact behavior can look wrong in the places where this visualization differs. Signed-off-by: Steve Peters <[email protected]>
To help visualize this, I made a script for generating a png image with square gradients for use as a pyramid heightmap in scpeters@9fd36f8. I've also added a demo world with a few spheres and some CPU LIDAR sensors, since they use the physics engine for collision detection. Since ODE always uses the same diagonal direction for its triangulation, the lines where each pyramid face meet will have different triangulation. The following image shows how the 8 triangles at the top of the pyramid are constructed for ODE: When the triangulation diagonal is parallel to line where faces meet, it models the pyramid shape quite well. In the following screenshot, you can see from the LIDAR scan that ODE treats that edge like a smooth line, in contrast to the wireframe rendered by OGRE, which is quite bumpy. When the triangulation diagonal is perpendicular to the line where faces meet, ODE models the surface with a stair-step pattern, which differs from the OGRE surface model. |
This shows the behavior of some spheres added near the top of the pyramid. The spheres on the left are above the jagged edge of the heightmap, one of which falls and rests on one of the stair-steps and the other bounces down the steps. The spheres on the right are above the smooth edge, each one offset to x or y, and they roll smoothly down the side to which they are offset. |
I've noticed some strange behavior with spheres falling into a heightmap and disappearing when they fall directly on a sharp ridge. The following animation shows the |
I've been able to reproduce this in upstream ODE and will file an issue there. https://bitbucket.org/scpeters/ode/commits/db31aaa63c5b52f9ebbab7aeef11493ef76987b9 https://bitbucket.org/scpeters/ode/commits/199c8e8b67c410f8877077a5b0f24a9eb4a04574 |
bug about spheres falling through heightmap reported upstream at https://bitbucket.org/odedevs/ode/issues/71/small-spheres-fall-through-convex-edges-of |
Heightmaps are a 2.5D surface defined by a Cartesian grid of points in 2 axes (X and Y for SDFormat / Gazebo) with heights specified for the 3rd axis (Z for SDFormat / Gazebo). To create a surface from these points, each square formed by 4 nearby points is divided into triangles along one of the diagonals. It turns out that the triangulation pattern is different between OGRE (rendering) and ODE (default physics engine). This may not be very noticeable for heightmaps with fine resolution, but it may be a confounding issue when trying to debug heightmap contact behavior.
OGRE uses a zig-zag pattern with the diagonals alternating direction (see OgreTerrain.cpp):
ODE, by contrast, uses the same direction for diagonals everywhere (see heightfield.cpp).
Bullet uses the ODE approach by default but actually has a flag to match the OGRE approach (see setUseZigzagSubdivision in btHeightfieldTerrainShape.h and its use in btHeightfieldTerrainShape.cpp and bullet issue 625).
Update: it looks like when DART uses bullet for collision detection, the zig-zag flag is enabled, so that it will match OGRE:
The text was updated successfully, but these errors were encountered: