Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
I don't actually use any of the built in fbx stuff in Unity so this wouldn't be a quick script to write unfortunately. But when I have a bit more time I might look into it. Or even better, if someone else wanted to get it started and send a draft over that would be amazing. ;)
To translate to tc3d we need a script that pulls out raw data arrays from the fbx for:
[per mesh in the model]
- parent transform offset and rotation
- uvs
- normals
- materials
- vertices for every frame of animation, stored by animation name
If someone was able to write a script that could take an fbx and dump out all that information it might not be much work for me to add the bit to get it to tc3d format.
I can't get you that data straight from fbx, but I can definitely do it from a mesh imported into Unity. So basically an editor-side data extractor that leverages the Unity mesh importer.
Conveniently, it so happens that I'll be on holiday next week and that with the virus around there won't be much to do apart from staying home, so I'll try to get you some sort of basic tool sorted.
Quick questions before I get started:
- Normals: are they also animated or do you only need the 'untransformed 'value?
- Materials: what is that supposed to be? Just the material name on each object?
- Do you need indices or do I have to 'unroll' the vertex data?
- Not animated, just untransformed value.
- Materials: two parts.
1. Material index, every triangle will have a material associated with it. This is stored in an int array in the same order as the triangles.
So triangles might be:
[0,1,2,1,2,3] for two triangles: {0,1,2} and {1,2,3}.
Materials could be:
[1,0] for triangle 1 has material 1 and triangle 2 has material 0.
2. The second part is the data about the material itself, in the same order as the material index above:
So material 0 could be:
bool unshaded - this is a special tag we use in the name of the mesh to say whether to use the unshaded shader.
Color color - this is a color tint applied to the texture in the shader.
Color emissive - this is a color tint applied to the pattern texture in the shader.
bool diffuseHasAlpha - this tells the engine whether the material should support transparency or be opaque.
Dictionary<string,string> texturePairs;
Each key value pair assigns a texture to a material channel. The engine only supports two channels:
"DiffuseColor": "mainTexture.png"
"EmissiveColor" : "patternTexture.png"
The emissive/pattern texture is optional but should be included if it's present in the fbx model.
- Yes please, include indices. I forgot to mention that one in my original reply.
So to summarise again:
I think that's it. :)
All vanilla meshes are 1 material per mesh because this allows them to take advantage of a special rendering pipeline I've built which improves performance.
However, modders don't always do this so you should have support for multiple meshes and multiple materials per mesh.
Personally I wouldn't do any combining or splitting of the geometry that the fbx contains, even if it would be more optimised. I think it's better to just pull the data out as it is organised in the model file to give the designer more control.
EDIT: When we consider that different meshes might be animated differently it becomes even more important not to combine them.