ODE's heightfields have some known bugs; depending how you use it you
might experience missing contacts, wrong contact normals and even
normalization errors.
Probably because the easiest workaround is to just use a trimesh for a
terrain, nobody completely fixed the heightfield issues.
--
Daniel K. O.
"The only way to succeed is to build success yourself"
Out of curiosity, could you elaborate what you mean by "academic/idealist"?
I believe he means people for whom the trade-off between time spent and
degree of result obtained does not directly impact their paycheck. If
you're working for a studio where you need to achieve results X within
time Y to get another milestone payment, then results X matter, and
anything else does not matter. Meanwhile, if you are, say, a college
student (or, for that matter, faculty) who decide to work on ODE just
because the world would be a better place if available open source
physics engines were higher quality, your view of appropriate trade-offs
will be different.
Thus, suppose someone finds a real bug, and fixes it in a way that fixes
the bug, and does not introduce side effects, but offends some
maintainer's sense of purity, then you have a conflict:
- some people prefer to reject a patch for purity reasons, rather than
get the bug fixed
- meanwhile, the people who worry about their own paycheck will not go
back and re-work a fix that already fulfills their own requirements
In my opinion, if a patch fixes a bug without introducing side effects,
then the patch should be accepted. If the patch offends someone's sense
of purity, then that someone is free to submit another patch that
corrects whatever the stylistic problem is. However, in the general open
source world, I believe I am in the minority (although among highly
successful open source projects, my opinion might be a little more
common, perhaps).
Sincerely,
jw
----- Original Message -----
From: "Jon Watte"
Sent: 3 грудня 2008 р. 05:00
Subject: [ode-users] Re: heightfield successes lately???
> Thus, suppose someone finds a real bug, and fixes it in a way that fixes
> the bug, and does not introduce side effects, but offends some
> maintainer's sense of purity, then you have a conflict:
> - some people prefer to reject a patch for purity reasons, rather than
> get the bug fixed
> - meanwhile, the people who worry about their own paycheck will not go
> back and re-work a fix that already fulfills their own requirements
>
That's a pity you can't answer my letters ;-), but just listen to the word
of wisdom:
The correct code is always beautiful.
So if the code is getting ugly/obfuscated/overweighted/etc..., this should
be a warning for you that you are doing something wrong. If you start
implementing everything in correct way and watch all the time for it to stay
in that correct way you would hardly ever need to apply a dirty patch to fix
something.
Oleh Derevenko
-- ICQ: 36361783
Actually I have. :)
Then again, I'm the one who wrote the original dHeightfield API (though not the underlying math), so
I'm probably more aware of the problems to steer clear. I haven't touched the code in a while
though, and I don't pretend to understand what currently goes on behind the API functions (lots has
changed), but I've tried to follow the reports of the problems.
I believe most problems are due to 2 bugs:
1)
Rotated heightfields may produce some strangeness. Actually I've seen this reported only once, but I
have never had the chance to test rotated heightfields. The demo seems to work fine though. David
Walters may know more about this, he added this feature. Y-up heightfields work correctly for me.
2)
Penetration on heightfield grid edges. Contacts will be generated at the lowest heightfield sample
under the objects' AABB (called 'heightfield zone' in the code) instead of on the grid edge at
proper height.
This bug was introduced with the optimization patch, which merges coplanar grid triangles to fewer
planes to speed up intersection tests.
I and Oleh have both taken an in-depth look at this bug, we thought it may be related to floating
point accuracy but that appears not the case. I don't think either of us has any ideas left as to
what causes this problem.
Unfortunately Olehs attempts at this have removed a workaround for this bug. Which was a 'margin'
constant that extended the heightfield grid triangles on the horizontal plane. It added some grid
edge overlap and thereby 'filling' the gaps caused by the bug. This isn't correct and 100%
fool-proof, but currently works well for me. Perhaps we should revert to the old code so at least
there is a workaround for the time being, right now it is broken to the point where heightfields are
practically useless.
3)
There _was_ a third problem, similar to the second, and related to the optimization patch, but that
has been fixed (I think since 0.9).
> No two components have ever given me more trouble in ODE than trimeshes
> and heightfields!
Trimesh collision detection are generally know to be a 'hard problem'. Heightfields on the other
hand should not be 'hard'. We should really fix it.
At some time in the near future I will have to add support of 'diamond' style heightfield grids
(e.g. for ROAM terrains) so I will probably have to revise large parts of code to add this.
Hopefully I will negate this bug in the process, but if it turns out to be still effective it may be
better to remove the optimization altogether or re-write it from scratch.
Any help with this will be greatly appreciated. I'm not an expert in this field, most of my
contributions so far have been superficial. But as the co-author and person who pushed for
heightfields to be included in ODE, I feel responsible for these problems.
If the author of the optimizations (Paul Cheyrou-Lagreze) reads this, please tune in if you have the
chance.
And to hell with 'academics' Teravus, send in those patches. ;) I will have a look at it.
/Martijn
----- Original Message -----
From: "Martijn Buijs"
To: <ode-...@googlegroups.com>
Sent: 3 грудня 2008 р. 15:22
Subject: [ode-users] Re: heightfield successes lately???
I just implemented a correct handling for floating point numbers that
guarraneed that no collision test falls into two triangles at once and no
one is lost in between of triangles. With this change, if everything else is
correct, adding overlap should be unnecessary. So if it does not help, that
means the overlapping is not a direct solution but just a workaround that
fixes the main bug by instroducing some side-effects.
Also, I clearly remember that you have found the reason of the problem and
it was not related to the triangle overlapping at all. You just had no idea
how to fix it then and in time everybody has forgotten about that bug. I can
look through older posts and find that letter, if necessary.
Indeed, the overlap that initially came with the optimization patch was a hack, incorrect and did
introduce noticable side effects. I mentioned it because it is only 'less broken', and works better
*in practice*.
But I know you don't like that, and honestly, I don't either. :)
> Also, I clearly remember that you have found the reason of the problem and
> it was not related to the triangle overlapping at all. You just had no idea
> how to fix it then and in time everybody has forgotten about that bug. I can
> look through older posts and find that letter, if necessary.
>
> Oleh Derevenko
> -- ICQ: 36361783
Yes, I recall the discussion. Perhaps my wording was unclear but I meant 'I know exactly what the
bug *is*' rather than 'I know exactly what *causes* the bug'. I really have no idea what *causes*
the bug.
/Martijn
>> Also, I clearly remember that you have found the reason of the problem
>> and
>> it was not related to the triangle overlapping at all. You just had no
>> idea
>> how to fix it then and in time everybody has forgotten about that bug. I
>> can
>> look through older posts and find that letter, if necessary.
> Yes, I recall the discussion. Perhaps my wording was unclear but I meant
> 'I know exactly what the
> bug *is*' rather than 'I know exactly what *causes* the bug'. I really
> have no idea what *causes*
> the bug.
Ah, sorry. I looked at the old letters and, indeed, the bug that was clear
was fixed by commenting a part of the function. And another one with loss of
contacts near the triangle edges had remained unsolved. :-(
Reduced memory usage. Only need a 2d array of values in a format of choice (byte, short, float,
double) and allows compression/paging (via GetHeight callback).
It also allows for fast deformable/animated heightfields, for example to simulate water surface or
destroyable terrain. Trimesh requires updating the acceleration structures, which is often slow.
Trimesh triangles are infinitely thin, objects may pass through depending on timestep. Heightfields
are infinitely thick below the surface and 100% guarantees that contacts will be generated at any
point under the surface.
---
I was going to add some illustrations to the dHeightfield section (
http://opende.sourceforge.net/mediawiki-1.6.10/index.php/DHeightfield ) on the ODE Wiki, but the
wiki seems to be still in limbo. Any updates on that? Maybe we should just move away from SF.net, it
has been slow and generally unavailable for the last year or so. Perhaps Google Code has a nice
solution for documentation?
/Martijn
Are you aware that there's a demo in included with ODE ("demo_heightfield")?
/Martijn