View Full Version : height field terrain
04-13-2003, 07:46 PM
i am using a height field to create a terrain. i want the camera to follow the different y values of the x,y,z's so that it appears that u r running along the terrain. i thought if i just took my x and zs and looked them up in the array of points i would have the height but it didnt work does anyone have any ideas about how i can do this
04-13-2003, 08:55 PM
http://www.vterrain.org/ has lots of code.
Your question has nothing to do with OpenGL; it's a simple computational geometry problem.
04-13-2003, 09:38 PM
yeah i know it doesnt have much to do with opengl but i didnt know where else to go i checked out that site but couldnt find any programs that would help me out. anymore help is appreciated incus
04-14-2003, 02:58 AM
1) found the 4 points in the heighmap that are arount the camera (the camera posdition will rarely be exatcty on a pixel of the heighmap).
04-14-2003, 04:04 AM
look into the heightmap tutorials...when you run their program, the camera adjusts to the height of the terrain (which is what i understood you wanted to happen... http://www.opengl.org/discussion_boards/ubb/smile.gif )
04-14-2003, 08:12 AM
If you allow steep hills, your camera near plane may still intersect hill sides.
Thus, what you REALLY want is a function to sink a sphere of some radius onto a height field, until it collides with the field (which doesn't have to be straight under the sphere center). This is a collision detection problem; sphere-triangle intersections will do this but there are possible optimizations.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.