View frustum and bounding box problems.



  • 1. opengl editor
    Hi. Do you know of any open source simple 3D modeler/editor (for linux) that exports the scene in OpenGL C code? Thanks.
  • 2. texture mapping sphere
    Hiya, I have produced a sphere based on an icosahedron which is subdivided into smaller triangles, I now with you apply a texture to this, but due to the way its draw it cant just apply the texture like I would with glutsphere() becuase its made up of many triangles. Im current half way through readding the texture mapping chapter of the redbook, but im still unclear how to achieve this, i basically want to wrap a retangular image around my sphere to form a picture of a planet, ive seen it done else where but not with a tesselated sphere. Thanks dave
  • 3. Pointing to the origin
    I have made substantial (to me, anyway) progress with OpenGL. I am stumped on what must be a common operation: forcing the camera to point to the origin from wherever it happens to be. My first thought was to calculate the cross product between the camera's directional vector and its location vector (the vector formed between the origin and the camera's location), and then rotate the camera view around that normal so the camera is looking at the origin. That was the theory, anyway. In reality, that theory is either completely wrong or I'm missing a step (or two). Here are the relevant vectors I'm using: Camera location vector: (1,0,100) Camera direction vector: (0,0,-1) Camera's rotational angle: 0 degrees Here are the values calculated by my program: Normal vector: (0,1,0) Angle between camera and origin: 179.427217 These values seem correct for the calculations I performed, but now what? I can't pass these values to glRotate when I'm positioning the camera, as the view will be all wrong. Am I missing a step or two, or am I barking up the wrong tree entirely in my approach? I found a lot of c.g.a.o archived posts on Google dealing with camera positioning, but all the promising stuff either point to URLs that no longer exist or deal with the subject on a very deep mathematical basis.
  • 4. Cylindrical Texture Co-ordinates
    I am applying a texture to a cylinder and it is looking good, but not quite correct. It seems as if I have shrunk the image and it is repeating around the cylinder. I apply my texture co-ords around the cylinder using: float SubMesh::Cylindrical(float xiValueX, int xiX, float xiValueY, int xiY) { float lX = xiValueX - mCentre[xiX]; float lY = xiValueY - mCentre[xiY]; float lRot = (float)atan(lY/lX); // answer from -pi/2 -> pi/2 float lRet = (lRot + (PI/2.0f)) / PI; return lRet; } xiValueX/Y are the cartesian co-ordinates. xiX/Y define the axis they are on (0=x, 1=y, 2=z) Does this look correct? I am applying the texture using: glTexCoord2f( Cylindrical(mPoints[i][0], 0, mPoints[mPolys[i][1], 1), Normalise0to1(mPoints[i][2], 2)); Any suggestions would be appreciated. Thanks, Allan

View frustum and bounding box problems.

Postby Antonio Santiago » Mon, 25 Dec 2006 21:47:38 GMT

Hi group,

I have a little problem with my view frustum culling.

I am working using bounding boxes for my object (they are simple
cubes). As I read on some tutorials an object is out of the camera's
frustum if all their boundingbox points are out of the frustum.

 The problem with this methos comes when the camera is near my objects
and some points are out for the right plane and some are out for the
left frustum plane. In this case, all the points are out of the frustum
camera but the object must be drawn.

Any ideas to solve this problem.
Thanks in advice.

Re: View frustum and bounding box problems.

Postby Brandon J. Van Every » Tue, 26 Dec 2006 10:15:18 GMT

Which, as you've found, is not true.

What is true, is if all the bounding box points are *in* the frustrum,
then the object is in the frustrum.  That's the "trivial accept"
condition.  "Trivial reject" occurs if all the points are completely to
one side of one of the frustrum's *planes*.  i.e. completely above,
completely below, completely left, completely right, completely in
front of, or completely behind the frustrum.

If it isn't trivial accept or trivial reject, then you've got a more
complicated clipping problem to deal with.

Well, clearly, you're gonna have to do more complicated geometry tests
for these cases.  Quite a lot of ink has been spilled on this subject.
Don't the basic Computer Graphics textbooks cover this sort of thing
nowadays?  Can't remember if mine did or not, it's been a long time
since I worried about frustrum clipping.  Most people just use the 3D
HW nowadays to take care of this, so I take it this is a homework
problem, not a practical problem.  Thus, what exactly to do is left as
an exercise to the reader.

No problemo.  I'd offer up my ancient Free3d code for your edification,
but seeing as how I haven't compiled it in a decade, I think that would
be irresponsible.  :-)  Also I don't know if the solutions I employed
are good ones.  Maybe you'd be better off poking at the source code of
the Mesa rendering library?

Brandon Van Every

Re: View frustum and bounding box problems.

Postby Antonio Santiago » Tue, 26 Dec 2006 19:45:23 GMT

Thanks Brandon for your reply in this date (happy christmas!!!).

Your reply was very helpfull for me. My problem was thinking in the
reverse, that is, if all points are out of the frustum then the
objectust be culled.

Thanks a lot.

On Dec 25, 2:15 am, "Brandon J. Van Every" < XXXX@XXXXX.COM >

Re: View frustum and bounding box problems.

Postby Brandon J. Van Every » Thu, 28 Dec 2006 05:48:03 GMT

No problemo!  Merry Xmas as well.

Similar Threads:

1.borders and bounding box in map view splot

Hi all,

I'm trying to use gnuplot to plot some arrows pointing to stars in a 
stellar image.  The pixel values are stored in a text file of x,y,z data 
and I've splot'd it using the 'with image' option.  Everything works 
nicely except the borders and the bounding box.  In the 'set view map' 
perspective, the borders on the top and right are always noticably 
thicker than those on the left and bottom.  I've had to unset the border 
and make my own with nohead arrows ... a bit hacky.  Is there something 
I've overlooked here?

Also,  Since I don't need tics and axis labels, I've used:

set size ratio 1 0.75,1

and set all the margins to 0.  However, I still have a thick white 
bounding box around the plot.  I'd prefer not to have to edit the 
postscript bounding box every time I remake the plot.  Is there any way 
to disappear this extra space?  Setting margins to 0 always does the 
trick with 'plot', but not with 'splot' apparently.

I'm using 4.1 on a linux box.  Does anyone have any ideas?


2.bounding box view

Is there a way to see which layer you are grabbing, aside from selecting 
"show bounding box" when in Move mode? I realise in an ideal world we'd 
have all our layers named, but it's not always practical, especially if 
you're creating new from selections frequently.

Also, in both PS 7 and CS, when you go Workspace-Tile, is there a way to 
make the windows tile horizonally instead of vertically?

Thanks in advance for any tips on these issues.


3.View frustum culling problem !!

4.quadtrees and view frustum culling

I have read over about 8 tutorials on quadtrees now and understand the
basics, but in implementing it I have some questions.

Am I right in thinking each node in the quadtree has a list of all objects
visible within that node? (like a list of pointers perhaps?)

If every node has a list of objects in it, shouldnt i just fill the leaf
nodes instead of duplicate entries in the parents?

if #1 is so isn't it going to be more expensive to add/remove objects from
the node as they move around the world then the culling itself?

or is the quadtree only to hold static objects (not moving) and some other
system need to be implemented for moving objects?


5.From camera view frustum and plane intersection to camera position

Imagine a video projector projecting a movie on to a wall. The projector is 
not aligned perpendicular to the wall and therefore the projection (the 
movie) is not displayed as perfect rectangle but as a trapezoid.

If we know
    i) The height and width ratio of the video projector
    ii) 3d coordinate of the projection vertices (4 corners of the movie)

How we can find the position of the video projector ? 

6. View Frustum

7. Frustum planes from view*projection matrix?

8. Testing wether a plane is in the viewing frustum

Return to graphics


Who is online

Users browsing this forum: No registered users and 0 guest