Homogenous space

Started by
16 comments, last by Paradigm Shifter 10 years, 10 months ago

What I tried to say was if there is at least one perspective projection matrix in your transformation matrix, the w-division is needed. (Edit : because w is no more 0 or 1 !)

With projective spaces,the transformation is not only multiplying matrices. It's dividing the homogeneous vector by w at the end to get the equivalent 3D cartesian vector(x,y,z).

Advertisement

If w is is not 0 then it represents the point (x/w, y/w, z/w). So it is a point.

It's like how 1/2 and 2/4 both represent the same number, 0.5.

Don't worry about projecting onto a plane, that's just a way of visualising projective space in 2d using 3d homogeneous coordinates. You can't visualise the projection in 3d with 4d homogeneous coordinates because the projection is onto the entirety of 3d space instead of a plane.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
The 2 only needed things to know about homogeneous coordinates :
  • w=0 for direction 4D vectors (i.e. normals)
  • w=1 for position 4D vectors (i.e. vertices)
[...]

w=0 for directions, but normals are not directions. Normals are co-vectors, which means that the way to transform them by an affine transformation is to apply to them the transpose of the inverse of the endomorphism (a.k.a., the 3x3 sub-matrix that doesn't involve the extra coordinate), and you may want to renormalize after that. If you are only dealing with orientation-preserving isometries (rotations and translations), you are lucky and both computations agree; but if you allow for non-uniform scalings or other non-isometric transforms, you'll see that your normals get messed up.

A proper vector (e.g., a translation, or the difference between two positions) is not strictly speaking a projective point either, but at least the arithmetic of using w=0 does work out.

A directional light, for example, does have a direction which is a projective point with w=0.

I do not have need to scale something that is using normals so far, as i do that in modeling program, and i read somewhere else on this forum that is not necessary to transform normal with inverse & transpose if i don't use scale. Is it necessary to do renormalization after this, or normals preserve "unit-ness"?

I do not have need to scale something that is using normals so far, as i do that in modeling program, and i read somewhere else on this forum that is not necessary to transform normal with inverse & transpose if i don't use scale. Is it necessary to do renormalization after this, or normals preserve "unit-ness"?

No, no need to renormalize: If you stick to rotations and translations you should be fine.

If there is no scale involved you don't need to renormalise the normals.

You only need to renormalise if your upper 3x3 part of the transform matrix has a determinant that is not +1. EDIT: All 3x3 rotation matrices have determinant +1.

You may want to renormalise if 2 or more normals get interpolated though (e.g. in a pixel shader where the vertex normals are interpolated across the triangle).

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley


You only need to renormalise if your upper 3x3 part of the transform matrix has a determinant that is not +1.

The norm of a non-uniformly scaled unit vector is not necessarily a unit vector even if the matrix has unit determinant. You may still have to normalize.


You only need to renormalise if your upper 3x3 part of the transform matrix has a determinant that is not +1.

The norm of a non-uniformly scaled unit vector is not necessarily a unit vector even if the matrix has unit determinant. You may still have to normalize.

Good point, the +1 determinant is a necessary but not sufficient criterion ;) I wasn't thinking about non-uniform scaling. EDIT: Or a shear transformation matrix.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

This topic is closed to new replies.

Advertisement