Does nybody know how 2 get the rasterized coords of a 3d object????
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
Yscr = Yworld / Zworld
or "optimized" with FOV:
Zdiv = FOV / Zworld
Xscr = Xworld * Zdiv
Yscr = Yworld * Zdiv
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
Wrong, bask. MSDN's Direct3D tutorials show you how to transform geometry without using Direct3D's geometry pipeline.
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( );
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement