Collision normal perturbation

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
colinvella
Posts: 24
Joined: Sat Feb 09, 2008 2:38 pm
Location: Malta
Contact:

Collision normal perturbation

Post by colinvella »

Here's some more food for thought... :)

In CG, techniques such as bump mapping, normal mapping, parallax mapping etc. are used to incorporate geometrical detail using texture-based data. Similar approaches have been adopted for physics, that essentially apply small random perturbations to collision normals to mimic imperfect surfaces.

As a motivation for this, consider a scenario where a perfect sphere is dropped on a perfectly level plane - the ball bounces over the same spot along a vertical axis. Even worse, additional spheres dropped exactly above the original one, will bounce above the ball and settle in perfect balance, resulting in a vertical stack of balls. While this behaviour concides with the physics model used, it is not a suitable representation of the real world. A ball with microscopical imperfections will bounce about on an similarly imperfect floor. In addition, any attempt of dropping a ball exactly on top of another ball results in the ball bouncing off sideways.

I have so far attempted the random normal perturbation approach. I define a surface perturbation coefficient as one of several material properties per body. Coefficients of two bodies in contact are added together (to accordingly increase the potential deviation) and the resulting value is used as a range for a uniform RNG. This in turn is used to alter the X, Y and Z components of the collision normal, followed by a renormalisation to retain the normal vector's unit-length.

This approach works fine for the contrived scenario above - the balls bounce off to one side or another to a degree dependent on the perturbation coefficient. I was also hoping however, that for rolling balls, it might also simulate random meandering on a plane, especially when a ball rolls slowly, but the effect of normal perturbation seems to have no or very little effect in this respect.

I am now considering a more sophisticated approach where the perturbation becomes a function of the contact point coordinates, much like perlin noise. This approach would have the advantage of allowing a simulation to be reproduced exactly as it does not involve random parameters. It might also give better results for balls rolling on a slightly bumpy surface as a result of the perturbation function.

What are your thoughts on these approaches?
ewjordan
Posts: 26
Joined: Sat Jun 30, 2007 4:34 am

Re: Collision normal perturbation

Post by ewjordan »

This could be interesting if it works, particularly when applied in conjunction with visual bump or parallax mapping.

However, there are pitfalls. First, make sure your normal vectors aren't causing collision resolutions to pump energy into the system - your normal vector field should be curl free, so that their projections onto the surface don't have any cycles in them which could speed up an object indefinitely. A good way to achieve this is to actually calculate the normal vectors from a real surface, or as the gradient of a (Perlin, if you wish) scalar field (this works since the curl of a gradient = 0). Second, I would worry about interpenetration issues, especially if your normals are normalized. Depending how your solver is set up, preventing a resting box from falling through the ground may require that the vertical component of the surface normal be 1.0; some solvers might not like it if your normals are not normalized, so this might be tricky to navigate. Or it might all work fine without much meddling, it all depends what methods you're using.

In graphics you can play all sorts of tricks with normals because any inconsistencies do not propagate; physics can be trickier because the solvers operate assuming all their inputs are valid. Normal perturbation produces inconsistent input, so you might see some weirdness. Depending on your engine's internals, though, you might have some luck, so it's at least an interesting experiment.
colinvella
Posts: 24
Joined: Sat Feb 09, 2008 2:38 pm
Location: Malta
Contact:

Re: Collision normal perturbation

Post by colinvella »

I think I see what you mean, a field of normal vectors with a curl component will tend to make an object at rest bounce around in a circular path, at least at a microscopic level. To be honest, I have not really seen any significant results when I attempted a normal vector function perturbed with a cosine, except when I esagerated the perturbation and noticed, for instance, a ball rolling from one point and back on an apparently flat surface.

I have so far settled for the random perturbation approach. This seems to have worked in cases where I wanted to avoid implausible situations such as the ball stacking scenario. It would be nice to come up with some cheap means to increase the apparent complexity of the geometry though :)
Post Reply