Reciprocal of homogenous w

Started by
5 comments, last by Muhammad Haggag 18 years, 11 months ago
Could anybody explain what "Reciprocal of homogenous w" means? It appears in my directx book without much explaination, and I can't seem to find a clear answer on google... thanks
Advertisement
sorry to bump this, but somebody must know...
Or did I post this in the wrong forum?
Quote:Original post by spythebeast
Could anybody explain what "Reciprocal of homogenous w" means?
It appears in my directx book without much explaination, and I can't seem to find a clear answer on google...

thanks


1 / w ?

HTH,
Cambo_frog

For the love of god, please tell me that you've just omitted your error checking code for brevity, and you don't really assume that all those functions succeed.
It is 1.0f / W; but the "origin" of it is to do with the matrix mathematics that are done under the covers...

To be honest, I never rememeber exactly what it means - I just leave it set to 1.0f and ignore it [smile]

iirc, the positional data is stored as a 4 component vector [x,y,z,w] and when it's fed through the transform matrices, the w component needs to be 1.0f so that it works with whatever space it's in (again, not 100% sure). In normal 3D geometry this is done by multiplying through by 1.0f / w. When you deal with all the transforms (e.g. using D3DFVF_XYZRHW transformed vertices) then you need to take care of this yourself. Setting rhw=1.0f will NOT modify your [x,y,z] components.

Maybe someone else can explain it better in the Maths & Physics forum.

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

It's all about transformations.
When you are scaling or rotating your model, the formulas may be written as a 3x3 matrix. Applying transformation is then simply multiplying your vertices by a matrix. But the move transformation [translation] doesn't conform to this schema, because it uses addition, not multiplication.
To make all transformations go in the same manner, 3D cards uses so called "homogeneous coordinate system". In that system there is additional coordinate called W. If W=1 then homogeneous coordinate accords to typical cartesian coordinate [X,Y,Z]. But using that additional coordinate allows us to do all the transformations in the same way: by matrix multiplication. Vertices has then 4 coordinates [last W=1] and matrices are 4x4.

OK, now what is the "reciprocal of homogeneous W"? Homogeneous W is that fourth coordinate in vertex definition, and its reciprocal is 1/W. It is used in a projection transformation.
Nice Answer SasQ,
I didn't want to assume any context from the spythebeasts original post, so posted the most basic answer, but I guess your assumptions are correct.
(To spybeast) As jollyjeffers implies by his post, a DX matrix (4x4 homogeneous) usually has 1.0 as W if projection is not involved (e.g rotation, scaling, translation) and therefor reciprocal of W is 1.0
As SasQ states/implies W could be other than 1.0 in a projection matrix( e.g. a perspective transformation).
If you are trying to achieve something in particular with matrices please post more info from your book to give more context to "Reciprocal of homogenous w".

Also note that if you are using vertex shaders you can use matrices other than 4x4 homogeneous for effeciency, depending on the particular transformations you are using (e.g. a world transformation can be a 4x3 matrix to convert position coordinates to view space or 3x3 to convert normals to view space).

HTH,
Cambo_frog

[Edited by - Cambo_frog on May 22, 2005 3:04:19 PM]
For the love of god, please tell me that you've just omitted your error checking code for brevity, and you don't really assume that all those functions succeed.
Check this post on DevMaster for information on homegeneous W: Homegeneous coordinates

This topic is closed to new replies.

Advertisement