Meaning of D3DFVF_XYZ/RHW

Started by
5 comments, last by Jess 21 years, 1 month ago
What is the meaning of vertex format transformed, and untrasnformed? which are the differences?
Advertisement
D3DFVF_XYZ = Untransformed for 3D
Vertices are specified in world space and will undergo transformations from world space to viewpoint to projection/screen space.

D3DFVF_XYZRHW = Transformed for 2D
Vertices are specified in projection/screen space (i.e. they won''t need to be transformed in any way). The RHW is the distance of the Z plane from the screen (set this to 1 in most cases).

pan narrans | My Website | Study + Hard Work + Loud Profanity = Good Code
Minister of Propaganda : leighstringer.com : Nobody likes the man who brings bad news - Sophocles (496 BC - 406 BC), Antigone
YAY! - they fixed the search - see here for one of my better answers regarding RHW

Or here


Pan Narrans: While W _could_ be the distance in eye space, its reciprocal certainly isn't

--
Simon O'Connor
Creative Asylum Ltd
www.creative-asylum.com

[edited by - S1CA on March 5, 2003 7:02:57 AM]

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

W and Z are not the same, though W is proportional to the Z depth of the screen coordinate... but it''s not it exactly. AFAIK W can be ignored unless you''re for some reason using W-depth buffers.
~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
quote:Original post by CGameProgrammer
AFAIK W can be ignored unless you''re for some reason using W-depth buffers.


W gets used tons by the rasteriser: perspective correct texture lookup (i.e. t''=t*(1/w)), perspective correct colour interpolation, fogging etc.

That''s the reason for setting RHW to 1 rather than 0 for sprites, because t''=t*0 means t=0, i.e. screwed texturing.

One of the most instructional things anyone can do to teach themselves what RHW really does is to write their own version of the T&L pipeline, i.e. take some vertices in world space and apply the transformations required to get the coordinates into screen space, then compare the results with D3D T&L.


--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

quote:Original post by S1CA
Pan Narrans: While W _could_ be the distance in eye space, its reciprocal certainly isn''t

Sorry, I was quoting from a book and I must not have worded it correctly:

"The only real difference between the 2-D and 3-D coordinates is the addition of the rhw variable, which is the reciprocal of the homogeneous W. In English, this typically represents the distance from the viewpoint to the vertex along the Z-axis. You can safely set rhw to 1.0 in most cases."

pan narrans | My Website | Study + Hard Work + Loud Profanity = Good Code
Minister of Propaganda : leighstringer.com : Nobody likes the man who brings bad news - Sophocles (496 BC - 406 BC), Antigone
Well 2D transformations was what I was thinking of. There''s really no reason to do your own transformations now that there are T&L cards, and even if not using one it''s safe to assume the driver/API''s transformation code is well-optimized.

Of course writing a software engine and using no API at all is fun, I did it a couple of years ago. Well it was a software polygon renderer but not exactly an ''engine''

~CGameProgrammer( );
DevImg.net - Post screenshots, comment on others.
~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.

This topic is closed to new replies.

Advertisement