tags:

views:

70

answers:

1

Hi

I'm diving into 3d programming a bit and am currently learning by writing a procedural terrain generator that generates terrain based on a heightmap. I would also want to implement some physics and my first attempt at terrain collision was by simply checking the current position vs the heightmap. This however wont work well against small objects as you'd have to calculate the height by taking the heightdifference of the nearest vertices of the object and doing this every colision check is pretty slow.

Beleive me I tried googling for it but there's simply so much crap and millions of blogs posting ripped-of newbie tutorials everywhere with basically no real information on the subject, I can't find anything that explains it or even names any generally used techniques.

I'm not asking for code or a complete solution, but if anyone knows a particular technique good for calculating a high-res heightmap out of the already generated and smoothed terrain I would be very happy as I could look into it further when I know what I'm looking for.

Thanks

+2  A: 

What if you made your terrain a group of quads based on those height positions combined with their x/y positions. Now, store the normals for those quads. Now, you are doing a simple, is this point on this side of the polygon check which is very quick to calculate - the sign of a dot product between the surface normal and the point you are checking against. It's like back face culling and most 3D systems will have routines to handle this for you.

Michael Dorgan
Not a bad idea, I'm going to look into it, gave me some ideas thanks :) I'll get back to it tomorrow when I've tested it.
Jonas B
Your suggetions surely led me in the right direction, thanks a bunch :)
Jonas B