-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export to Game Engine #5
Comments
Yes, it is possible when you choose the mesh animation in our repo. This animation result is actually more suitable for exported as BTW, please tell me which game engine you would like to use if you need me to look into some export details. |
Unity first, if skeleton that could be perfect! thanks for your help |
I'll have a look at Unity, but our mesh animation is not skeleton animation, it is more like shape deformation. Hope that is okay for you. |
nice if u make it happen |
Good to find that FBX animation files can be directly imported into Unity. However, since we're using embedded textures, you'll need to extract the textures manually, following steps bellow:
I also write a simple c# script to help you automatically extract the texture and recognize normal map, your normal map should use '_noraml' as suffix in this case. You can name the file as using UnityEngine;
using UnityEditor;
using System.IO;
public class TexturePostprocessor : AssetPostprocessor
{
void OnPreprocessTexture()
{
TextureImporter textureImporter = assetImporter as TextureImporter;
if (textureImporter != null)
{
// Automatically set normal maps
if (assetPath.ToLower().Contains("_normal"))
{
textureImporter.textureType = TextureImporterType.NormalMap;
}
// You can add automatic recognition for other texture types, e.g.:
// else if (assetPath.ToLower().Contains("_metallic"))
// {
// textureImporter.textureType = TextureImporterType.Default;
// textureImporter.sRGBTexture = false;
// }
}
}
}
public class FBXPostprocessor : AssetPostprocessor
{
void OnPostprocessModel(GameObject go)
{
if (assetPath.ToLower().EndsWith(".fbx"))
{
ExtractTexturesFromMaterials(go);
}
}
void ExtractTexturesFromMaterials(GameObject go)
{
ModelImporter modelImporter = assetImporter as ModelImporter;
if (modelImporter != null)
{
modelImporter.ExtractTextures(Path.GetDirectoryName(assetPath));
}
}
} As for animation clip, You'll need to manually bind the animations from the FBX file to the objects. I guess you are more familiar with this process than I am, as I haven't used Unity before. Please give it a try🚀 and if you encounter any issues, feel free to post them here~ |
brilliant,thx. i'll use the code |
Is it possible?
The text was updated successfully, but these errors were encountered: