Is there an alternative to mesh hiding?
by Kyrah Abattoir · in Game Design and Creative Issues · 03/27/2012 (7:54 pm) · 12 replies
I'm faced by the problem of having to create a large volume of assets to be wearable for characters for my game. Some are non rigged so i guess i can simply put them into mount points, however some of them are partial rigs (armors, etc...).
I was recommended to use mesh hiding to swap from one to the other, but is there another method? I'm afraid that the resource files might become impossible to work with if i have to put everything together.
Is there a way to make a player entity "wear" simultaneously multiple rigged models on it's skeleton that doesn't require deep changes in the engine?
I was recommended to use mesh hiding to swap from one to the other, but is there another method? I'm afraid that the resource files might become impossible to work with if i have to put everything together.
Is there a way to make a player entity "wear" simultaneously multiple rigged models on it's skeleton that doesn't require deep changes in the engine?
About the author
3D artist, programmer, game designer, jack of all trades, master of none.
#2
The logical approach would be to use mesh hiding , like the zombie art pack multiple faces, the problem is that i'm not sure it's the most sane approach when you plan to have literally hundreds of different parts.
I could see using it for having several faces on a character, but having every items of the game part of a single mesh, wouldn't that be... bad?
03/28/2012 (2:35 pm)
Well it's fairly simple i'm working on a system for characters to equip objects, my problem si that most of these objects will be rigged.The logical approach would be to use mesh hiding , like the zombie art pack multiple faces, the problem is that i'm not sure it's the most sane approach when you plan to have literally hundreds of different parts.
I could see using it for having several faces on a character, but having every items of the game part of a single mesh, wouldn't that be... bad?
#3
03/28/2012 (7:19 pm)
It doesn't solve all the associated problems but I've been separating sets in my modeling program and then adding them back into one by using tsshapeconstructor. That keeps everything manageable outside the engine. It's still a pain if you have to use the shape editor though.
#4
03/29/2012 (4:47 pm)
Mind explaining how do you do that exactly?
#5
example, in baseCharacter.cs
This is nice because it makes the assets more manageable to work with and you can add new sets easily without re-exporting the whole file. It still is a problem if you have to use the shape editor within the editor because everything will be loaded at that time.
03/29/2012 (11:02 pm)
In my modeling program files, i have my baseCharacter and all the different sets saved in different files (they all have the same rig though). Then using tsshapecontructor, I add them back into one model in the engine to be able to utilize meshhiding.example, in baseCharacter.cs
singleton TSShapeConstructor(BaseCharacter)
{
baseShape = "./basecharacter.dts";
};
function BaseCharacter::onLoad(%this)
{
%this.addMesh("ElvenArmourArms2", "./Elven/elven.dts", "ElvenArmourArms 2");
%this.addMesh("ElvenArmourBicep2", "./Elven/elven.dts", "ElvenArmourBicep 2");
%this.addMesh("ElvenArmourBoots2", "./Elven/elven.dts", "ElvenArmourBoots 2");
%this.addMesh("ElvenArmourLegs2", "./Elven/elven.dts", "ElvenArmourLegs 2");
%this.addMesh("ElvenArmourTorso2", "./Elven/elven.dts", "ElvenArmourTorso 2");
%this.addMesh("ElvenArmourWrist2", "./Elven/elven.dts", "ElvenArmourWrist 2");
%this.addMesh("ElvenGloves2", "./Elven/elven.dts", "ElvenGloves 2");
%this.addMesh("ElvenHelmet2", "./Elven/elven.dts", "ElvenHelmet 2");
etc...This is nice because it makes the assets more manageable to work with and you can add new sets easily without re-exporting the whole file. It still is a problem if you have to use the shape editor within the editor because everything will be loaded at that time.
#6
Weight wise, what is the impact on the client? I haven't studied much about mesh hiding, but would all the parts have to be loaded as soon as the character is loaded? or only when they are displayed?
03/30/2012 (2:40 am)
Ohhh, this is a very nice method indeed that entirely skirt around the problem.Weight wise, what is the impact on the client? I haven't studied much about mesh hiding, but would all the parts have to be loaded as soon as the character is loaded? or only when they are displayed?
#7
04/02/2012 (8:45 pm)
All the parts are loaded into memory. I think all assets are at mission load. Only the ones not hidden are rendered though, which is where most of the framerate savings is.
#8
In order to answer your original question changes to the engine would require a mountable object that receives information from the object it is mounted on. Something that would cause it to animate in sync with the host object. I have no idea what that would take coding wise. On one level it might be like mounting an invisible player with different mesh info attached.
For the short term I think Kenan has a great solution that is currently supported in the engine. I might add as well that you can have multiple player objects defined. Then you can put sets of armor on those. So for guards that only ever one set of armor then only have the armor in their mesh defined for what they will actually ever wear.
It may be possible to build mesh sets on the fly. This would require scripting, but since you are building an object in script at load time, this should be possible while you are running. It would be worth a try to reduce memory consumption.
@Kenan,
Thanks for explaining how this works. I learned something new today! T3D is certainly full of new tricks. Out of curiosity, do you know if a dts can be deleted? That way if one wanted to update a dts the old one could be deleted and new one created.
04/03/2012 (1:41 am)
@Kyrah,In order to answer your original question changes to the engine would require a mountable object that receives information from the object it is mounted on. Something that would cause it to animate in sync with the host object. I have no idea what that would take coding wise. On one level it might be like mounting an invisible player with different mesh info attached.
For the short term I think Kenan has a great solution that is currently supported in the engine. I might add as well that you can have multiple player objects defined. Then you can put sets of armor on those. So for guards that only ever one set of armor then only have the armor in their mesh defined for what they will actually ever wear.
It may be possible to build mesh sets on the fly. This would require scripting, but since you are building an object in script at load time, this should be possible while you are running. It would be worth a try to reduce memory consumption.
@Kenan,
Thanks for explaining how this works. I learned something new today! T3D is certainly full of new tricks. Out of curiosity, do you know if a dts can be deleted? That way if one wanted to update a dts the old one could be deleted and new one created.
#9
04/03/2012 (8:09 am)
...and don't forget a %this.saveShape("./myCoolDTSshape.dts"); after you make all the 'adds' and whatnot. This 'will'/should generate an entirely new DTS shape, yes a true binary file, outside[before] it gets loaded into memory!! I guess overwriting it, Frank, would be an update..??
#10
Is there a possibility to do other on the fly operations to Shape objects, lets say... various levels of mixing between a fat and a slim body?
04/03/2012 (12:28 pm)
Oh this is very nice too, one could literally build a new character on the fly everytime a player logs in based on the content of his inventory am i right?Is there a possibility to do other on the fly operations to Shape objects, lets say... various levels of mixing between a fat and a slim body?
#11
This is why people use the mesh hiding trick.
04/04/2012 (11:43 am)
I think you would only build a new character on the fly if that model shared no assets with any other model. I cant confirm right now because I cant check the code but I believe the tsshapeconstructor is modifying the tssmesh data which tsshapeinstances reference for their static data. So if you were building characters on the fly you would be creating lots of duplicate data in memory.This is why people use the mesh hiding trick.
#12
For multiplayer it would be better to send the script data and have the dts get built on each client. But like Kenan said it would create some memory bloat.
04/23/2012 (1:57 am)
Well if it is just for the main character then it would probably be okay. Is this a multiplayer game? Then it might be a problem. Also, if it is multiplayer would the game have to transfer the new shapes over the net for others to see them. Maybe it is not the best idea for multiplayer. I could see if flying for a single player.For multiplayer it would be better to send the script data and have the dts get built on each client. But like Kenan said it would create some memory bloat.
Torque Owner Tim
WinterLeaf Entertainment