Sign in to follow this  
b3rs3rk

Bezier patches and collisions

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 :\

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this