Path: chuka.playstation.co.uk!news From: Ian Thompson Newsgroups: scea.yaroze.programming.3d_graphics Subject: Re: Calculating RSD Normals Date: Sat, 09 May 1998 00:10:29 +0100 Organization: The PC Shop Lines: 33 Message-ID: <355390E4.116E0F26@clara.net> References: <3551A622.6DF487E9@clara.net> <6iv58b$6r13@scea> Reply-To: ianthomp@clara.net NNTP-Posting-Host: du-1956.claranet.co.uk 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) Jar Williams wrote: > I am just starting with Yaroze, but I have tried to make a similar > converter, so I'll give it my best shot. > > As far as I can tell (please, anyone feel free to correct any mistakes!) the > flat shading model calculates a single normal for each polygon. Try looking > at PLY file that was generated by dxf2rsd. You will notice that there is one > entry in the Normal section for every entry in the Polygon section (as long > as the conversion..... Hi Jar, I still can't get it to work. Here is the code I produced based on your explanation. x1,x2,x3,y1,y2,y3,z1,z2,z3 are a triangle's vertices. nx = ((y2-y1)*(z3-z1))-((z2-z1)*(y3-y1)); ny = ((z2-z1)*(x3-x1))-((x2-x1)*(z3-z1)); nz = ((x2-x1)*(y3-y1))-((y2-y1)*(x3-x1)); length = sqrt((nx*nx)+(ny*ny)+(nz*nz)); nx=-nx/length; ny=-ny/length; nz=-nz/length; Please correct me if I am wrong in the implementation. Thanks for the help, Ian T.