Path: chuka.playstation.co.uk!news From: Craig Graham Newsgroups: scee.yaroze.freetalk.english Subject: Re: Triangles, Quads??? Date: Thu, 15 Oct 1998 17:47:20 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 199 Message-ID: <36262718.A98BE61@hinge.mistral.co.uk> References: <362238AE.DF3414FF@usa.net> <36228105.D38787F2@datasys.net> <3622FF14.B0A6AA9D@hinge.mistral.co.uk> <3624E1B7.DB009494@usa.net> <01bdf79b$33250e60$016f6f6f@fffaaasssttt> <362515C7.B9E07223@revolution.co.uk> <3625D84A.9E500615@hinge.mistral.co.uk> <01bdf841$c0c8f500$016f6f6f@fffaaasssttt> NNTP-Posting-Host: d2-s42-136-telehouse.mistral.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.05 [en] (Win95; I) Peter Dollochan wrote: > > > > I've added a more advanced tri->quad convertor to RsdANIM (first change > since > > 1.51)that lets you selectively apply it, and use different co-planarity > factors > > for different > > bits of the model. (the one in dxf2rsd does work ok though, but can only > be used > > on a > > whole model at one go). > > > > New version will be on my WWW page in the next day or two.... > > sounds good :-) > > > some of it isn't (for example I'm surprised that no-one is using static > > pre-processed > > point lighting on the yaroze - zero runtime overhead for nice > lightbulb/torch/fire > > lighting > > effects). > > > > Craig. > > > I believe Dr Steve Collins is doing some pre-computed light sourcing for a > landscape engine he is working on.. but I'm sure once its been mentioned > several people will wonder wot its all about and read up on the various > implementations available to them on the yaroze. Simple example that just handles gourard+textured poly3's: // Vertex Lighting typedef struct { short x,y,z; // light source coord char ri,gi,bi,flags; // light colour intensity, light type flags short radius; // light radius (no lighting outside this distance) short rs,gs,bs,dummy2; // drop-off rate within radius (from full intensity ri at distance 0 to ri-(rs*radius) at radius) } POINT_LIGHTSOURCE;void LightVertices(TMD_OBJECT *o, POINT_LIGHTSOURCE *p){ TMD_VERTEX *v=o->vert_top; TMD_GTP3 *prim=(TMD_GTP3*)o->primitive_top; unsigned long np=o->n_primitive,f; unsigned short vertex,radius; for(f=0; fhead.mode!=0x35) { switch(prim->head.mode) { case 0x31: { TMD_GP3 *prim_2; prim_2=(TMD_GP3*)prim; prim=(TMD_GTP3*)(prim_2+1); } break; case 0x30: { TMD_GP3N *prim_2; prim_2=(TMD_GP3N*)prim; prim=(TMD_GTP3*)(prim_2+1); } break; } }else{ vertex=prim->vr0; // Use simple (fixed point) test for quick reject of a vertex if(((ABS(v[vertex].vx-p->x)radius) ||(ABS(v[vertex].vy-p->y)radius)) ||(ABS(v[vertex].vz-p->z)radius)) { //Calculate real distance (ish) #if REAL_LIGHTING_DISTANCE t=v[vertex].vx-p->x; tl=t*t; t=v[vertex].vy-p->y; tl+=t*t; t=v[vertex].vz-p->z; tl+=t*t; radius=(short)lksqrt(tl); #else radius=manhatan_distance(v[vertex].vx-p->x,v[vertex].vy-p->y,v[vertex].vz-p->z); #endif // Accurate reject if(radiusradius) { radius=radius>>4; // Light proportional to distance prim->r0+=p->ri - (p->rs*radius); prim->g0+=p->gi - (p->gs*radius); prim->b0+=p->bi - (p->bs*radius); } } vertex=prim->vr1; // Use simple (fixed point) test for quick reject of a vertex if(((ABS(v[vertex].vx-p->x)radius) ||(ABS(v[vertex].vy-p->y)radius)) ||(ABS(v[vertex].vz-p->z)radius)) { //Calculate real distance (ish) #if REAL_LIGHTING_DISTANCE t=v[vertex].vx-p->x; tl=t*t; t=v[vertex].vy-p->y; tl+=t*t; t=v[vertex].vz-p->z; tl+=t*t; radius=(short)lksqrt(tl); #else radius=manhatan_distance(v[vertex].vx-p->x,v[vertex].vy-p->y,v[vertex].vz-p->z); #endif // Accurate reject if(radiusradius) { radius=radius>>4; // Light proportional to distance prim->r1+=p->ri - (p->rs*radius); prim->g1+=p->gi - (p->gs*radius); prim->b1+=p->bi - (p->bs*radius); } } vertex=prim->vr2; // Use simple (fixed point) test for quick reject of a vertex if(((ABS(v[vertex].vx-p->x)radius) ||(ABS(v[vertex].vy-p->y)radius)) ||(ABS(v[vertex].vz-p->z)radius)) { //Calculate real distance (ish) #if REAL_LIGHTING_DISTANCE t=v[vertex].vx-p->x; tl=t*t; t=v[vertex].vy-p->y; tl+=t*t; t=v[vertex].vz-p->z; tl+=t*t; radius=(short)lksqrt(tl); #else radius=manhatan_distance(v[vertex].vx-p->x,v[vertex].vy-p->y,v[vertex].vz-p->z); #endif // Accurate reject if(radiusradius) { radius=radius>>4; // Light proportional to distance prim->r2+=p->ri - (p->rs*radius); prim->g2+=p->gi - (p->gs*radius); prim->b2+=p->bi - (p->bs*radius); } } prim++; } } } > Pete. Craig.