Swap materials at runtime
by Bryan Stroebel · in Torque Game Engine Advanced · 05/21/2006 (2:12 pm) · 10 replies
Anyone know how I could pass the object id to the matInstance?
If I could save the ID of the object thats rendering it, to the material instance, we could swap materials by object ID and material name. This would give us the granular control we need for material swapping.
If I could save the ID of the object thats rendering it, to the material instance, we could swap materials by object ID and material name. This would give us the granular control we need for material swapping.
#2
Is it possible to swap in script or do we need C mod?
01/19/2007 (7:57 pm)
Any more luck with this? I am just starting to research hot swapping shaders again. Is it possible to swap in script or do we need C mod?
#3
01/22/2007 (3:21 pm)
Didn't someone post a resource on this? Search for reskin in TSE.
#4
01/22/2007 (3:33 pm)
Yup, Bryan Stroebel did post two resources about this.
#5
Would be nice if this was added to the engine build. Seems like a function that would be used a lot.
I don't mind the compile just sayin... it's got so many applications.. Like shield effects.. spell effect.. potions.. uh.. you know a state change.. you drink inv potion and it triggers the proper shader material to turn on.. etc.
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10957
01/23/2007 (11:21 pm)
Thanks!.. Would be nice if this was added to the engine build. Seems like a function that would be used a lot.
I don't mind the compile just sayin... it's got so many applications.. Like shield effects.. spell effect.. potions.. uh.. you know a state change.. you drink inv potion and it triggers the proper shader material to turn on.. etc.
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10957
#6
P.S. I've been busy with XNA. Haven't had time to get back into TSE.
01/30/2007 (11:01 am)
This was a really simple implementation once I understood how the shaders were applied to the objects. I dont know if it still works in the latest version of TSE tho. P.S. I've been busy with XNA. Haven't had time to get back into TSE.
#7
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10957
and this Ressource
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5421
they both working on the testCube and the SpaceOrc. i can hide Parts of the orc, change the Material everything fine.
But if export a test Model(2 Cubes), with a Multisub object Texture with 2 materials inside they dont work.
i see the model right textured, but i do %obj.setSkinName(oldmat,newmat);
nothing happens, in the console look ok (mapping string to blalba).
So it must be my Max Setup. Ayone can explain me step by step how can i do that?
result must be:
one dts, with 2 separate meshes inside, one Multisubobjectmaterial wiht 2 material id's
thx in advance
Miguel
03/29/2007 (12:45 am)
I have some troubles getting my models to work,with thiswww.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10957
and this Ressource
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5421
they both working on the testCube and the SpaceOrc. i can hide Parts of the orc, change the Material everything fine.
But if export a test Model(2 Cubes), with a Multisub object Texture with 2 materials inside they dont work.
i see the model right textured, but i do %obj.setSkinName(oldmat,newmat);
nothing happens, in the console look ok (mapping string to blalba).
So it must be my Max Setup. Ayone can explain me step by step how can i do that?
result must be:
one dts, with 2 separate meshes inside, one Multisubobjectmaterial wiht 2 material id's
thx in advance
Miguel
#8
That would be your problem if so, only one UV is allowed I believe.
03/29/2007 (12:57 am)
So that mean you object you made in max has UVW cords right?That would be your problem if so, only one UV is allowed I believe.
#9
and the Orcplayer must have separet meshes or something, then i can hide the "helmet""chest" etc.
I need a setup like the new Orc.
03/29/2007 (3:16 am)
But the texture shows up right, i just cant change it.and the Orcplayer must have separet meshes or something, then i can hide the "helmet""chest" etc.
I need a setup like the new Orc.
#10
1. Materials defined, but not applied to any mesh at the beginning, show up dark and not right, all looks the same grey/black.
2. when you apply a material that allready is here, example the orceye, it blents the 2 materials, and not swap really.
you have the same issues?
Miguel
04/18/2007 (11:59 am)
Ok have a 2 new problems:1. Materials defined, but not applied to any mesh at the beginning, show up dark and not right, all looks the same grey/black.
2. when you apply a material that allready is here, example the orceye, it blents the 2 materials, and not swap really.
you have the same issues?
Miguel
Associate Kyle Carter