View Full Version : HELP !! Terrain Level Detection
05-06-2001, 12:42 AM
I've stuck on this for a year! How can I move my camera on my terrain that have hills,stairs,rocks etc.What I mean is the terrain is not flat!
I create my terrain using 3D Studio and convert it into display list using 3D Exploration.So does anybody can help please??
05-06-2001, 07:55 AM
This is not an OpenGL question, nor is it an advanced question. If you're stuck for a year on something as simple as figuring out translation and finding the height of the heightfield at an arbitrary location, then maybe you're trying to bite off too much in one go, and should try something simpler first.
There's also tutorials all over the net that might help you, such as found at www.gamedev.net (http://www.gamedev.net) and www.flipcode.com (http://www.flipcode.com) and other similar sites.
Yes, extracting the height at any given point when using a heightmap is indeed easy. Problem is, if you would have read his message, that he is using an abritary object exported from 3D Studio.
Binqay, if your terrain has one height at each point (doesn't have levels - you can't walk under the stairs, for example), then it would probably be most convenient to convert it into a height map. You may be able to do this by extracting Z values after rendering, or by calculating this yourself (which is what I found to work best - but maybe others go the Z buffer method to work).
If you have more than one several height levels, then things get more complicated, and you should probably think of another representation for your geometry. In any case, there is no efficient way to get the heights from a bulk of geometry. You must do some pre-processing.
to obtain the height of a point, u need to find out what polygon the object is above.
each polygon has a plane (Ax + By + Cz +D = 0)
plug the point into the planes equation and u can easily see where it is in relation to the polygon
That may be true, zed, but it doesn't solve the real time consuming problem, which is finding which polygon you're over. That's why a different representation (terrain in the simplest case, and some space subdivision if you need several levels) needs to be pre-computed.
05-07-2001, 06:10 PM
Plug "BSP tree" or "portal engine" into any search engine or 3d graphics web site, and watch a zillion of helpful tutorials stream at you.
Now back to our regularly scheduled OpenGL feature requests :-)
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.