Path: chuka.playstation.co.uk!news From: Jim Newsgroups: scea.yaroze.programming.3d_graphics Subject: Re: Clipping problem Date: Tue, 24 Feb 1998 01:20:16 +0000 Organization: Mobius Codeworks Ltd. Lines: 50 Message-ID: <34F22050.61F3CEB7@codeworks.demon.co.uk> References: <34F075F4.FB9EA26A@ix.netcom.com> <34F0CB76.15648E1C@codeworks.demon.co.uk> <34F0CE4D.E2BF2269@cybec.com.au> <34F1EDBB.BAC3047E@ix.netcom.com> NNTP-Posting-Host: codeworks.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.01 [en] (WinNT; I) X-Priority: 3 (Normal) Manny Najera wrote: > The polygons I'm using now are flat shaded, 4-sided polygons with 16bit > textures. How big are the textures? 16 bit ones are a slower that 8 and 4 bit ones. I also believe the texture cache can only hold a 32X32 16 bit texture. So if its bigger than this your going to get a lot of misses. Also try using tmdsort found on the SCEE site somewhere, that should maximize some of the cache hits for you. >I wanted to make them gouraud shaded, but I have no idea how > to calculate the 4 normals of each polygon (the TMD is made in the > program). > > I understand that the surface normal is the cross product of the two > vectors on a polygon, but I don't understand why gouraud shaded polygons > need four of them. Aren't they all the same? Gouraud shading interpolates the lighting coefficient calculated for each vertex. The light intensity is calculated by the angle between the vertex normal and the light vector. So If all your normals were the same they would all have the same light intensity therefore appear flat shaded. That's why we have 4 normals per polygon. To calculate them you just average the surrounding polygon normals to make vertex normals. You can do this by simply adding the poly norms and dividing by the number of contributing polys, or for a better effect and assuming you're not doing this in real time, just add all your normals and normalize them. I'd be happy to post some code to do this if you wish. > > Manny Najera Regards Jim