Bezier patches and collisions
i'm writing a small landscape engine and i use bezier patches for rendering the terrain. Basically i generate the patches with an editor starting from an heightmap. Everything works fine (also ppl), i have a very detailed scene without spiked edges and all the other artifacts i would get if i use heightmaps.
The problem is with collisions. I have thought to approximate the collisions with the patch computing them with the heightmap i used before. in theory this should work, but the problem is that when i render, the heightmap's vertexes don't lay on the patch (they are in different positions).
how can i do to make them coincide?
First of all: don't try to make a collision test between the (mathematically) Bezier-Patch and other objects. You have to subdivide the Bezier Patch in triangles and then test these triangles with other objects. Because this take quite a lot of performance you you do a bounding volumn test before the subdivision and triangle-object test.
--------------------------------------------------------There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.There is another theory which states that this has already happened...
but if i start subdividing the patch in triangles i'll waste too rendering time... instead, if i translate the heightmap to the coords of the patch (but without rendering it) i can manage collisions with ~3 lines of code :\
Collision using the heightmap will rarely be correct. Don't you tesselate and triangulate the bezier patches before sending the data to OpenGL? You can store these triangles and use them for collision detection. If the level of detail for one patch changes, update it's list of triangles.
This might not be very efficient, but I'm just tossing ideas around here...
This might not be very efficient, but I'm just tossing ideas around here...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement