Author Topic: Same Model, different skin?  (Read 186 times)

Ben Olding   «   on: August 10, 2012, 03:22:04 PM »
Hello,

I suspect this is a really basic question, but I cant figure it out.

In both my games I come across problems where I want to have the same model reused, but with different colours or a different skin. For example in one of the games it is a sports game with 2 teams of 10, i want one of the teams to have different colours from the other. I have managed to change the colours no problem, but when I change 1 man it changes them all. The only way round it that I have found is to embed the model twice, which of course doubles the filesize. 

I assume the problem is because there is just 1 texture and its referenced by all the models to save memory, but is there a way to have more than 1 texture?

Thanks in advance. Sorry if I got my terminology wrong, I have someone else doing the modelling and am finding it hard to get my head round it all

Ben Olding   «   Reply #1 on: August 10, 2012, 03:26:40 PM »
I've tried cloning the pivot btw, but no luck

Sam Chau   «   Reply #2 on: August 13, 2012, 07:37:57 AM »
I am assuming all of the players are clones of a single f3d model, and that you are getting a model's material and changing the colour. If so, then the reason why they all change colour is because they are sharing the same material, and any changes made to this will affect all models associated with it.

Try assigning a new material to the other team. Example:

var oTeamBMaterial : Shader3D = new Shader3D("Team B", [new colorFilter(0xffcc11)];
foreach(var player : Pivot3D in TeamB)
{
    player.setMaterial(oTeamBMaterial);
}

Ben Olding   «   Reply #3 on: August 15, 2012, 02:05:01 PM »

               
                  
                     "I am assuming all of the players are clones of a single f3d model, and that you are getting a model's material and changing the colour. If so, then the reason why they all change colour is because they are sharing the same material, and any changes made to this will affect all models associated with it.

Try assigning a new material to the other team. Example:

var oTeamBMaterial : Shader3D = new Shader3D("Team B", [new colorFilter(0xffcc11)];
foreach(var player : Pivot3D in TeamB)
{
    player.setMaterial(oTeamBMaterial);
}
"
                     Sam C.
                  

               
               

You were right in your assumptions. I tried to do things like your suggestion, but found that it often affected all. I'm not sure for your specific code though.

I did manage to solve the problem in the end by having a separate loader for each team, loading the same embedded model, but seperately. Rather than cloning one I had already loaded. That did the trick.

Thanks for your help