Advertisement

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

Started by May 12, 2000 09:01 PM
4 comments, last by MetalWorX 24 years, 7 months ago
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!!
Raptor
Xscr = Xworld / Zworld
Yscr = Yworld / Zworld

or "optimized" with FOV:

Zdiv = FOV / Zworld
Xscr = Xworld * Zdiv
Yscr = Yworld * Zdiv
Advertisement
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
Raptor
I AM *THIS* CLOSE TO KILLING YOU...

Were still friends, right?
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

~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.
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
Raptor

This topic is closed to new replies.

Advertisement