Jump to content
  • Advertisement

Archived

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

MetalWorX

Does nybody know how 2 get the rasterized coords of a 3d object????

This topic is 6922 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

how do i get the 2d coords from a 3d object in space? rather is there ny method in stealing the info from the proj,view or world matrices?? or is it only the raypicking method??? thnx!!

Share this post


Link to post
Share on other sites
Advertisement
Xscr = Xworld / Zworld
Yscr = Yworld / Zworld

or "optimized" with FOV:

Zdiv = FOV / Zworld
Xscr = Xworld * Zdiv
Yscr = Yworld * Zdiv

Share this post


Link to post
Share on other sites
How does one get it out of the rasterizer. i''m using direct3d immediate mode for creating a real-time strategy game, and i need the stuff. pls let me know of some URLs about this subject if available

Share this post


Link to post
Share on other sites
Wrong, bask. MSDN's Direct3D tutorials show you how to transform geometry without using Direct3D's geometry pipeline.

D3DMATRIX Temp;
D3DMATRIX Final;
float XTemp;
float YTemp;
float ZTemp;
float WTemp;
float RW;

Temp = WorldMatrix * ViewMatrix;
Final = Temp * ProjMatrix;

// if X,Y,Z are the coordinates of the object
// in world space:

XTemp = (Final._11 * X) + (Final._21 * Y) + (Final._31 * Z) + Final._41;
YTemp = (Final._12 * X) + (Final._22 * Y) + (Final._32 * Z) + Final._42;
ZTemp = (Final._13 * X) + (Final._23 * Y) + (Final._33 * Z) + Final._43;
WTemp = (Final._14 * X) + (Final._24 * Y) + (Final._34 * Z) + Final._44;

RW = 1.0f / WTemp;

ScreenX = (1.0f + (XTemp * RW)) * ScreenWidth / 2.0f;
ScreenY = (1.0f - (YTemp * RW)) * ScreenHeight / 2.0f;
ScreenZ = ZTemp * RW;
ScreenW = WTemp;


ScreenZ is only needed for a z-buffer and certain special effects. ScreenW is only needed for a w-buffer and certain special effects.

~CGameProgrammer( );



Edited by - CGameProgrammer on May 13, 2000 3:29:55 AM

Share this post


Link to post
Share on other sites
Thanks A Lot!!!
and i really MEAN it CGame....!!

i havent tried it though but i''m really pleased for the trouble u took to jot it down!!

I''ll Get back 2 u.

it would be great if u could gimme ur e-mail addr??
well here''s mine anyway-
sandeep_kl@mailcity.com

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!