Path: chuka.playstation.co.uk!news From: "Mario Wynands" Newsgroups: scea.yaroze.programming.3d_graphics,scee.yaroze.programming.3d_graphics Subject: Re: Billboarding - fast method? Date: Tue, 12 May 1998 22:22:46 +1200 Organization: Sidhe Interactive Lines: 61 Message-ID: <6j97ua$r1a5@chuka.playstation.co.uk> References: <6iomsu$jpr33@chuka.playstation.co.uk> NNTP-Posting-Host: p10-max11.well.ihug.co.nz X-Newsreader: Microsoft Outlook Express 4.72.2106.4 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Xref: chuka.playstation.co.uk scea.yaroze.programming.3d_graphics:250 scee.yaroze.programming.3d_graphics:554 wayne a. lee wrote in message ... >In article <6iomsu$jpr33@chuka.playstation.co.uk>, "Mario Wynands" > wrote: >> This kind of works, but by zeroing out all the rotations I am also the >> killing perspective transformation meaning the object is slightly stretched. > >What do you mean by "stretched"? As far as I can tell, perspective >projection happens after the LS matrix has been applied, so your code >should be OK. > >On the other hand, I'm not sure how screen aspect ratio fits into all this. >You might want to look at the global variable GsIDMATRIX2, in : > >extern MATRIX GsIDMATRIX2; /* Unit Matrix including Aspect retio */ Thanks for the hint Wayne. It was the screen aspect ratio that was causing some of the problem. Taking it into account solved the vertical stretching problem. The code still doesn't work quite right for the general case I was looking for, but should suffice for my immediate needs (which is just a single forwarding facing polygon). For anyone interested the code is as follows //************************************************************** //* Draw TMD * //************************************************************** void DrawTMD(GsDOBJ2 *dobj, GsOT *ot, int billboard) { MATRIX screen_matrix; GsGetLs(dobj->coord2, &screen_matrix); if (billboard) { screen_matrix.m[0][0] = GsIDMATRIX2.m[0][0]; // I'm sure there is a better way to code this :) screen_matrix.m[0][1] = GsIDMATRIX2.m[0][1]; screen_matrix.m[0][2] = GsIDMATRIX2.m[0][2]; screen_matrix.m[1][0] = GsIDMATRIX2.m[1][0]; screen_matrix.m[1][1] = GsIDMATRIX2.m[1][1]; screen_matrix.m[1][2] = GsIDMATRIX2.m[1][2]; screen_matrix.m[2][0] = GsIDMATRIX2.m[2][0]; screen_matrix.m[2][1] = GsIDMATRIX2.m[2][1]; screen_matrix.m[2][2] = GsIDMATRIX2.m[2][2]; } GsSetLsMatrix(&screen_matrix); GsSortObject4(dobj, ot, 14 - ot->length, (u_long *)getScratchAddr(0)); } Mario