Path: chuka.playstation.co.uk!news From: rs108@mdx.ac.uk (Robert Swan) Newsgroups: scee.yaroze.programming.3d_graphics Subject: Re: Textures are skewed. Date: Tue, 10 Mar 1998 02:51:15 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 64 Message-ID: <3504a5f5.4576890@news.playstation.co.uk> References: <3504949A.95F1D356@cybec.com.au> NNTP-Posting-Host: stu-dialup10.mdx.ac.uk X-Newsreader: Forte Free Agent 1.11/32.235 On Tue, 10 Mar 1998 11:17:14 +1000, Toby Hutton wrote: >Anyway, I have some textured quads. The texture I'm using is a grid, a >whole lot of squares. When I put this texture on the quad, it'll go all >skewwy when viewed from an angle. > >Toby. As far as I'm aware, that happens to all of us and our textured polugons. Its as a result of the graphics chip taking loads of shortcuts (including not doing very good perspective correction) to keep the speed up. There are several ways around this... 1) keep your viewpoint further up and away from all textured polygons. This may sound silly, but take a look at hover (latest jap demo) and you realise thats why it can do so much without distortion, or 2) you can force the playstation to divide your polygon into smaller areas (as the smaller the polygon, the less distortion can occur as it is a factor of size and orientation). Good point = can correct your problems. Bad point = slows game down. If you subdivide a polygon into four smaller polygons then this puts more calculations through the yaroze. The best compromise is to only subdivide those textures which are near the viewer. How to do this requires you to code in a routine to check distances as this isn't done by hardware, and its effectiveness becomes a function of your programming skill. If you can easily subdivide your world into a grid system, whereby each object is attached to a cell in the grid, then you can force subdivision only on those objects in the cells nearest the viewpoint. (In simplified theory). Anyway, to actually set the factor of subdivision you manipulate the attribute member of GsDOBJ2 as shown below:- typedef struct { // any other variables you want to associate with a model, such as // speed, health, whatver GsDOBJ2 Obj_Handler; } modelInfo; modelInfo DemoObject[6]; DemoObject[0].Obj_Handler.attribute = 0; DemoObject[1].Obj_Handler.attribute = GsDIV1; DemoObject[2].Obj_Handler.attribute = GsDIV2; DemoObject[3].Obj_Handler.attribute = GsDIV3; DemoObject[4].Obj_Handler.attribute = GsDIV4; DemoObject[5].Obj_Handler.attribute = GsDIV5; // when these objects get registered to be drawn with an ordering // table using GsSortObject4(), they will be drawn with each of the // polygons in the model (textured or otherwise) affected as follows // automatically- // DemoObject[0] - drawn as normal // DemoObject[1] - subdivided into 4 smaller polygons // DemoObject[2] - subdivided into 16 smaller polygons // DemoObject[3] - subdivided into 64 smaller polygons // DemoObject[4] - subdivided into 256 smaller polygons // DemoObject[5] - subdivided into 1024 smaller polygons I've never had the courage to use GsDIV5 :)