Path: chuka.playstation.co.uk!news From: "Alex Herbert" Newsgroups: scee.yaroze.programming.3d_graphics Subject: Re: Using same model with multiple textures and CLUTs Date: Sun, 7 Nov 1999 13:55:44 -0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 55 Message-ID: <803vll$5f53@chuka.playstation.co.uk> References: <381f3ab8.91536281@news.scea.sony.com> NNTP-Posting-Host: 212.56.110.67 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Hi Scott, A problem I have also faced... My final solution was to duplicate the primitives only (not the whole model) - then it's just a case of changing 1 pointer (in the TMD header) to switch surfaces. This worked fine for me as I only needed 4 or 5 versions of each model and I could afford the memory required. However, if you can't afford the memory, then you could pre-build tables of pointers to index the parts of the model to be changed. For example, if it were just CLUTs you are changing, you could have an array of pointers to each CBA in the model. Then it would only need a very simple loop to update the CLUT references. Another way would be to load a new texture into VRAM to overwrite the existing one. This would change the texture without having to touch the TMD, but is probably not suitable as it would change the texture for all instances of that model. Herbs Scott Cartier wrote in message news:381f3ab8.91536281@news.scea.sony.com... > Here's the situation. I have a model upon which I map a single 4-bit > texture. I want to be able to have several of these objects on the > screen at the same time, each with a different texture. Also, to > increase variety, I want to be able to have multiple CLUTs for each > texture. > > So my program should conceivably display the same model using textures > A and B, and if I have two models using texture A I want to be able to > have them use CLUTs X and Y. > > I want to do this with a minimum of per frame computation. Meaning I > want to set up as much as possible beforehand to reduce the work each > frame. > > What is the best way to do this? > > With sprites it's easy since there are fields in the GsSPRITE > structure to allow you to point to different textures/CLUTs. However, > with TMDs the texture/CLUT information is stored in each polygon of > the model. So I get the feeling that the only way to use multiple > textures/CLUTs (without having multiple copies of the model) is to > traverse the TMD, altering each polygon to point to the texture/CLUT > it needs. This has to be done for each object, and since this needs > to be done every frame, it eats into computation time. > > Does anyone know a way to get around this? > > Scott