Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: Tim O'Neil Newsgroups: scee.yaroze.programming.3d_graphics Subject: Re: Accessing screen translated vertices Date: Sun, 02 Nov 1997 02:11:25 -0500 Organization: SCEA News Server Lines: 37 Message-ID: <345C279D.BD5E35D4@chat.carleton.ca> References: <345BFB81.51488BFC@ibm.net> <345C1288.E288E7A@ibm.net> NNTP-Posting-Host: obatanga.chat.carleton.ca Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.01 [en] (Win95; I) X-Priority: 3 (Normal) Well, you're right, the process (in theory) is sorta complicated, but really its very simple to do. To do the three transformations you talk about, its basically a process of multiplying the points by one matrix for each and then doing a division relative to your projection distance. Fun thing about matrices is that if you multiply them all together before multiplying the point by them, you get the same result... guess where this work is done... GsGetLs ... the matrix that GsGetLs gives back to you is the hierarchical transformations put together along with the viewpoint shift, so all you have to do is take your WorldSpace coords and multiply them by this matrix and then divide them by the Z value. Sorta like this (this is just from memory, so its sorta rough) GsCOORDINATE2 WhateverCoordSystem; GsInitCoord2 (WORLD, &WhateverCoordSystem); GsGetLs (&WhateverCoordSystem, &tmpls); /* this gets the proper matrix relative to pure world coordinates*/ Vertex worldPoint = {0,0,-1000}; Vertex newPoint; multiply (newPoint, worldPoint, tmpls); /* assuming this function multiplies worldPoint by the tmpls matrix and puts the result in newPoint... I've set up my own inlined functions for this to cover over the nasty playstation naming, but you get the point */ short screenX = (newPoint.x * projectionDistance)/newPoint.z; short screenY = (newPoint.y * projectionDistance)/newPoint.z; .... This will give you the x,y screen values that 0,0,-1000 would map to given the current viewpoint etc. To get these points relative to another system (ie. the x,y coords of an animated figure that you have in another coordinate space) all you would have to do is put a different coordinate system into the GsGetLs function. That is pretty much it. Hope this helps. Tim