1
\$\begingroup\$

watching Ken Joy's Computer Graphics lectures on youtube. One thing I'm confused about is after he gets the cube from the camera space to clip space, from my calculations the cube doesn't look like that. I expected the cube to look like that pink parallelogram in my picture, if we assume the Z of the front-face of the cube to be -4/3 and the back-face to be -2 then the Ws come out to be 4/3 and 2 respectively. So can someone explain how after multiplying by the viewing matrix, the cube comes out to look like how Ken has it.

Ken's view matrix:

enter image description here

After view matrix has been applied:

After view matrix has been applied

What I think the side of the cube should look like(the pink parallelogram) after view matrix has been applied: enter image description here

my reasoning is, after the perspective divide by W, the blue and green vectors should get truncated to create that pink parallelogram. So I'm struggling to understand this. Thanks in advance.

\$\endgroup\$
  • \$\begingroup\$ Did you factor it in, that the (x, y, z) coordinates will change as well? \$\endgroup\$ – Bálint Sep 26 '19 at 5:34
  • \$\begingroup\$ @Bálint yes, they'll essentially be squished into that cuboid of range {(x, y, z) | -1 =<x,y,z <= 1}. I just don't understand, how the divide by W creates that shape he has. \$\endgroup\$ – user132696 Sep 26 '19 at 16:21
  • \$\begingroup\$ OOOOH OK, so I think it's because of where I have the cube relative to my camera. So my picture would emphasize the bottom of the cube, as the cube is above the camera. But in his picture the cube is dead center to the camera so he'll see a square. If the cube was below the camera then the top would be emphasized. I think that's it. \$\endgroup\$ – user132696 Sep 26 '19 at 16:34
0
\$\begingroup\$

So I found that it was because of where I have the cube relative to my camera. So my picture would emphasize the bottom of the cube, as the cube is above the camera. But in his picture the cube is dead center to the camera so he'll see a square. If the cube was below the camera then the top would be emphasized. Same thing with the sides. I found 2 pictures that perfectly illustrate this transformation.

Before view transformation:

enter image description here

After view transformation:

enter image description here

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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