• Advertisement

Archived

This topic is now archived and is closed to further replies.

What does RHW do exactly?

This topic is 5502 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What does RHW do exactly? The documentation on what this is in the transformed lit vertex format makes absolutely no sense. Any help would be appreciated! If programming in Visual Basic won''''t kill you, C# will!

Share this post


Link to post
Share on other sites
Advertisement
i have wondered this too, and i THINK its the 44 of the matrix, so if you set the RHW to 0, it doesn''t get transformed. i could be WAAAY off base though, its a while guess.

0 0 0 x
0 0 0 y
0 0 0 z
0 0 0 rhw <- maybe?

also it says the reciprocoal of it, so it might be 1 / w (44 of the matrix)

Share this post


Link to post
Share on other sites
It means you have already transformed it.

Normally you write your engine/game in 3d (XYZ), and when its rendered with the DrawPrimitive calls, the DirectAPI will convert those 3d coords to be put on your 2d screen. RHW means you''ve converted it already. So the RHW vertex''s X,Y,Z is in 2d pixels already... If your screen is 800x600 and your XYZ of the RHW vertexes is (400,300,0) it will draw a dot in the middle of the screen. The Z is only used to fogging/zplane, which in RHW scale is 0 to 1...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
struct CustomVertex
{
float x, y, z, rhw;
DWORD diffuse;
float u, v;
};
const DWORD D3DFVF_CUSTOM = D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1;

D3DVIEWPORT9 d3dViewport;
pd3dDevice->GetViewport(&d3dViewport);

CustomVertex Vertex;
Vertex.x = d3dViewport.Width/2;
Vertex.y = d3dViewport.Height/2;
Vertex.z = 0.5f;

the vertex will be at the center of the screen

Share this post


Link to post
Share on other sites
Think of RHW as a value used for error correction during matrix transformations.

Share this post


Link to post
Share on other sites
Error correction? aaargh

can someone PLEASE fix the search.

Or extend the size of the "previous replies to topics by..." tracking - so I can find the big 2 page post I made on what RHW is, how to compute it etc.

If this is just for 2D sprite stuff then use 1.0f for the value and umm don''t worry about what it means. For 3D its time to search somewhere for "homogeneous coordinates" and "homogeneous matrices".

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

Share this post


Link to post
Share on other sites
Simon, you should make a website. Then just post HTML-link when the same question comes up over and over again. =)

Share this post


Link to post
Share on other sites
quote:
Original post by Nypyren
Doesn''t RHW stand for Right-Handed-World/Windowed?


Just a friendly reminder. The SDK docs are your friend. Searching for RHW answers the question pretty readily... Searching for nearly anything usually gives you a good start.

from the docs:
Immediately following the position, transformed and lit vertices must include a reciprocal of homogeneous W (RHW) value. RHW is the reciprocal of the W coordinate from the homogeneous point (x,y,z,w) at which the vertex exists in projection space.

That might not be the complete answer for some, but it will at least tell you what the letters mean and will give you good search terms.

Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces"

Share this post


Link to post
Share on other sites
quote:
Original post by JoeyBlow2
Simon, you should make a website. Then just post HTML-link when the same question comes up over and over again. =)


Aye, the idea had crossed my mind: www.sc3d.com

Just need to get the time/motivation to get the content written/uploaded etc

Any posts I make to message boards tend to be brain dumps of the thoughts in my head at the moment I post, they''re full of grammatical mistakes, occasional factual errors and sometimes don''t make sense to many people. I''ve been a columnist for Develop magazine, and even 400 words in a simple column can take a long time to get into a form that I''m happy with when I know it might be visible and analysed for more than a day.

A combination of articles, snippets and maybe some sort of Wiki setup is probably what I''ll do there (Wiki for the braindump bits) as well as the stuff about the rest of what I get up to and the usual boring "who is I" website stuff.

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

Share this post


Link to post
Share on other sites
I did read the docs, but what is a reciprocal homogenis W? I read the docs, but the documentation doesn''t make any sense to me regarding to RHW.

If programming in Visual Basic won''''t kill you, C# will!

Share this post


Link to post
Share on other sites
quote:
Original post by sgalland
I did read the docs.


Excellent. My Comment was mostly directed toward the people that were giving you misleading answers.

A relatively short explanation is that matrices represent a set of linear equations. For operations that require multiplication (such as scaling and rotation), such transformations could be done with a 3x3 matrix. However, you''d like to be able to treat all operations (including addition) in a homogeneous way. Homogeneous coordinates (long story very short) allow you to treat all transformations the same, but you need to introduce a 4th coordinate.

That''s just a very quick explanation. There are many sites and books that will fill in the gaps. Searching for "homogeneous coordinates" and related terms should turn up some good hits.

Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces"

Share this post


Link to post
Share on other sites

  • Advertisement