View Full Version : 4D clipping

Mungo

05-05-2004, 01:57 PM

I'm having problems implementing 4D clipping. I was just wondering if anyone knew of any websites that could help me. I'm using the c language.

If not could someone tell me if all vertices of an object are between -1 and 1 in world co-ords and at no time does that object move would this mean that none of its triangles would need clipping???

My brains completely fried i can no longer think straight grr.

thanks for any help

-NiCo-

05-05-2004, 02:17 PM

Have a look at section 2.11 of the OpenGL 1.5 specification, it explains coordinate transformations.

First a modelmatrix is applied to the world coordinates , resulting in eye coordinates.

Next, the projection matrix applied to the eye coordinates resulting in the clip space coordinates .

Next a homogeneous normalization is performed resulting in normalized device coordinates.

These normalized device coordinates must be in the range [-1.0,1.0] to lie inside the clipping volume as you can deduct from the beginning of section 2.12 of the specification.

N.

Mungo

05-06-2004, 05:43 AM

I understand the transformation pipeline, but it must be going wrong along the way.

After my perspective transformation i end up with a lot of negative w values, which i think is causing the problem. Would negative w values cause problems when 4d clipping?? or will my clipping function be to blame??

Im so far only clipping against the RHS of the frustrum until i know what the problem is.

thanks for any help that can be given.

-NiCo-

05-06-2004, 05:58 AM

As you can see from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc02_0oj1.asp

The w coordinate is taken as the negative of the eye space z-coordinate. Because the x-axis is pointed to the right and the y-axis up, the z-axis is negative in the viewvolume. So visible vertices should have negative z-values in the viewvolume, resulting in positive w coordinates after perspective transformation.

Maybe you're also implicitly performing a rotation in your projection matrix.

And make sure you load the identity matrix before calling glfrustum.

N.

Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.