Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by MaT227 · Sep 02, 2015 at 08:00 AM · c#editorimportfbx3dsmax

Custom Export and Import FBX Data

Hi there,

I am trying to write custom data inside a FBX file from 3dsmax at export time. This might be possible even if I don't know right now how to do that.
But my question would be how can I read those custom FBX data inside Unity on import.

Thanks a lot.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by MaT227 · Sep 04, 2015 at 08:41 AM

Here is a great answer from theodox on Stackoverflow.

The easy way to do this is to add a custom attribute to an object in the Maya/Max scene and then use the Unity > AssetPostprocessor to find the attribute and parse it's data.

AssetPostprocessor has an OnPostprocessGameObjectWithUserProperties callback which will be fired for every transform in your fbx file which has a custom attribute applied. You'll want to find your attribute in the postprocessor and do something:

 public void OnPostprocessGameObjectWithUserProperties(GameObject incomingGameObject, string[] incomingPropetyNames, object[] incomingValues)
 {
     var thisModelImporter = this.assetImporter as ModelImporter;
     var meta_key = "your_attribute_name";
     if (incomingPropetyNames.Contains(meta_key))
     {
         string raw_data = (string)incomingValues[Array.IndexOf(incomingPropetyNames, meta_key)];
         // use the data here....
     }
 }

It's annoying that there's no standard way to create file-level metadata, I usually just attach my 'top level' data to something like the root of the model in the FBX file. You can pass complex data by storing things as a JSON blob and passing the JSON as a string attribute; that's usually easier to maintain than a web of multiple attribute names and types.

Be warned that FBX tends to mangle long attibute names - I'm not sure where the cutoff is but extremely long attribute names sometime get truncated to a meaningless string like `FBXASC_012345" if they exceed the magic character count.

The only thing you cant do easily this way is vertex or face level data; while you could pack that sort of thing into custom attributes, there's not a rock-solid guarantee that the indices you see in Max/Maya will be the same as the ones in the FBX. For that type of data vertex colors or extra UV channels are good places to store extra information, though it's up to you to come up with a way of deciding what a given color or UV means.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

28 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

FBX Workflow: 3DS=>Unity 4 Answers

How can I change default shader for new/imported objects? 1 Answer

3dsMax Biped always importing with rotation of 270, 90, 0 1 Answer

"Max couldn't convert the max file to an FBX file!" error 1 Answer

import scene from 3DS max to unity 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges