• Advertisement

Archived

This topic is now archived and is closed to further replies.

Terrain stuff

This topic is 6003 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Lets say i have a complete terrain engine using ROAM. But how do i place my objects on the world? and how do i determine which object is to be rendered and which should not thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Well, I suppose all objects have a set of coordinates, which you could weigh against the player''s current coordinates, and render them when they are in your frustrum.

-----------------------------
Jappie
BabJap Productions

"There''s no such things as bugs; they''re just unintentional extra features"

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
What if.. lets say; i have 500 objects in the world. Does this means i have to check if 500 objects? if the number of objects is a lot more than this figure, will that be slow?

Share this post


Link to post
Share on other sites
Well, the more objects you have, the slower your prog is gonna be, can''t help you there. Maybe you could make some kind of sorting algo based on the position of the frustrum, ie objects closest to the player first, then you could rule out a lot of objects as soon as the coords get out of the frustrum. Dunno if it''s fast, just off the top of my head

-----------------------------
Jappie
BabJap Productions

"There''s no such things as bugs; they''re just unintentional extra features"

Share this post


Link to post
Share on other sites
Its much easier in fact to test spheres than actualy objects, for instance an object could be represented by a vector and a radius from that vector. The vector is the approximate geometrical center of an object and the radius would be just long enough to encompass the entire object.

Then you simply have to find the normal of each of the 6 planes of the frustrum and make sure that the object does not intersect any of them, and does not fall between them.

Finding if the object might intersect a plane is as simple as making sure that the object is farther away from the plane than the radius of the sphere in the direction of the planes normal ( the direction that the plane faces ) Since the normals of all the planes should be facing inward it shouldnt be very difficult.

I do happen to forget at this very moment how to calculate if the sphere lies within all 6 planes though.

~Vendayan

Share this post


Link to post
Share on other sites

If your terrain doesn''t have ''sections'' you should probably discard objects on a simple distance check first. If the distance to the object is greater than the distance to the farthest corner of your frustum - it''s not visible.

If you want to optimize further, just check the distance in
two dimensions first - if the distance is greater there, it
will be even greater in three dimensions.

--Michael

Share this post


Link to post
Share on other sites

  • Advertisement