🔒 Locked
QuadTree Object Occlusion
Advertisement
Original Post
Hi All,
I am currently writing a quick method of calculating and rendering visible objects only, using QuadTrees.
It is built around the EntityList stuff in lslib.h, and is really only usefull for static objects, but will try and sort out some methods for Moving objects as well.
Currently It works like this.
Call
BuildQuadTree(maxLevels);
during setup, after entitys are created to create quadtree, and populate with entitys.
then during game, call
ProcessQuadTree();
which will create a list of visible entity IDs
Then in your render loop, you can
for (t=0; t
How expensive is it to use 4 planes to define the left,right, top, and bottom viewing volume to determine whether something is in or out of the volume? The idea is to use the x,y,z location a normal vector for the plane, then just check to see if the normal points outside the box, or inside the box. A normal of length zero would mean that the object should be drawn as it is on the line.
Look at the portal example for finding if a quad is visible.
You could also do it by transforming the points yourself, as in example 17. Check the flags of the vdata structure. If flags are 0, the vertex wasn''t clipped and is visible.
I really don''t want to use a static quadtree structure for the objects. I want everything to move around and possibly be destroyed.
For example if a regular grid was used, an object that moves would quickly be able to figure out what square it was in.
Big objects that cross many squares could have a flag and just use the regular bounding box check.
Chris
You could also do it by transforming the points yourself, as in example 17. Check the flags of the vdata structure. If flags are 0, the vertex wasn''t clipped and is visible.
I really don''t want to use a static quadtree structure for the objects. I want everything to move around and possibly be destroyed.
For example if a regular grid was used, an object that moves would quickly be able to figure out what square it was in.
Big objects that cross many squares could have a flag and just use the regular bounding box check.
Chris
Hi,
The way it works at the moment, works nicely for static objects. I think I can write it so that it accounts for moving objects, if I predefine the minimum Quad Node size as 1 grid, and store the Nodes neghbours within the node.
I was more writing it to cope with large numbers of trees, rocks etc, that won''t move, and if they are destroyed, remain in the same position.
FYI Chris, the sim I am currently working on has destroyable objects, works like this.
Create pro original object, blah.PRO.
Create Polytope object, blah.HIT.
Create Explosion animation for object, blah.EXP. (Quite good, can use dynamics within 3DStudio to get some nice object exploding anim)
Then within the sim, I can change the Object pointer from the .PRO to the .EXP when the object is destroyed, and play the animation of the EXP until the last frame.
I also made allowances for sub objects, ie a boat, where the hull is the main object, and there are 3 different areas on deck that you can destroy, which are linked to the hull.
May post some shots if anyone is interested.
Cheers
Darrin
The way it works at the moment, works nicely for static objects. I think I can write it so that it accounts for moving objects, if I predefine the minimum Quad Node size as 1 grid, and store the Nodes neghbours within the node.
I was more writing it to cope with large numbers of trees, rocks etc, that won''t move, and if they are destroyed, remain in the same position.
FYI Chris, the sim I am currently working on has destroyable objects, works like this.
Create pro original object, blah.PRO.
Create Polytope object, blah.HIT.
Create Explosion animation for object, blah.EXP. (Quite good, can use dynamics within 3DStudio to get some nice object exploding anim)
Then within the sim, I can change the Object pointer from the .PRO to the .EXP when the object is destroyed, and play the animation of the EXP until the last frame.
I also made allowances for sub objects, ie a boat, where the hull is the main object, and there are 3 different areas on deck that you can destroy, which are linked to the hull.
May post some shots if anyone is interested.
Cheers
Darrin
Sorry the engine doesn''t work that way. Each section of the quadtree has a bounding box that is tested against the viewport for visibility. There is no easy way to check if part of the landscape is behind a hill, especially with deformable terrain.
With hardware T&L there is no problem with how much terrain is drawn. The slow parts right now are the hundreds of trees and other objects that I want to draw. I just added LOD switching which helps a bit, however I think I need to add in triangle stripping to get the speed I want.
With hardware T&L there is no problem with how much terrain is drawn. The slow parts right now are the hundreds of trees and other objects that I want to draw. I just added LOD switching which helps a bit, however I think I need to add in triangle stripping to get the speed I want.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement