Advertisement Jump to content


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


What does RHW do exactly?

This topic is 5829 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
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;

D3DVIEWPORT9 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
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

Share this post

Link to post
Share on other sites
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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!