Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

The way I understand 3D rendering, polygons are transformed using several matrices, and they are then clipped if they are not inside a certain box, before projecting the box onto the screen. Before transformation, the visible area is typically a frustum, and after transformation, I am guessing it's a cube. This cube makes the clipping math easier than a frustum would.

My question is, what's the 'standard' location/size for this clipping box? I can think of 3 possibilities: (0,0,0)-(1,1,1), (-0.5,-0.5,-0.5)-(0.5,0.5,0.5), (-1,-1,-1)-(1,1,1)

Or is there no standard?

share|improve this question

1 Answer 1

Or is there no standard?

There isn't. OpenGL and D3D define clipping to happen in post-projective space, which is a 4D homogeneous coordinate system. So not a cube. But they use different post-projective spaces; the difference being the direction and range of the Z coordinate.

After the perspective divide (when you turn the 4D homogeneous space into a 3D space again), what you have in OpenGL is called normalized-device coordinates. This ranges from [-1, 1] in X, Y, and Z. In D3D, the equivalent space ranges from [-1, 1] in X and Y, but goes from [0, 1] in Z. Note that in both cases, clipping happened before then.

You can write a renderer that does clipping in whatever space you want. It's all just math in the end.

share|improve this answer
    
Am I right in understanding how it works though? I think that everything outside the final 3D box is clipped, though I see now that it is actually clipped before the 3D coordinates are used. The result is basically the same, no? –  Kendall Frey Sep 29 '12 at 19:24
    
@KendallFrey here's a good paper on clipping in homogenous space if you're interested research.microsoft.com/pubs/73937/p245-blinn.pdf –  dreta Sep 29 '12 at 19:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.