• 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
1
Question by kamullis · Mar 01, 2014 at 05:02 PM · animationmaterialvisibilitymax

Bringing visibilty and material animation from Max to Unity

I have been researching this throughout the past week or so and haven't been able to find much useful out there. I was hoping someone might have written a script on the Max or Unity side to do this but haven't found one so far.

That being said I am eager to try to tackle this with my pathetically novice coding skills, but I don't even know where to start. So I was hoping someone might be able to point me in the right direction.

Specifically I am looking for a way to take keyframed diffuse and visibility animation (weather it's shader opacity or object visibility) and translate that to renderer.material.color and renderer.material.color.a or renderer.enabled animations in Unity.

I know enough to work out how to recreate these animations in Unity, however I will potentially be dealing with a large volume of these kinds of animations and recreating them all by hand will not be feasible.

So... Can anyone help me with where to start? First off is this not something I would do on the Unity side at all, should I be looking into writing a Max script? If this can be done on the unity side, I am guessing that I need to acccess the code within the fbx on import and translate the embeded animation from autodesk terms to Unity terms. If so where might I be able to learn more about that?

Sorry for the long winded question. I would appreciate any help anyone could give in pointing me in the right direction.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Baroque · Mar 02, 2014 at 04:29 AM

As far as I know, there's no way for Unity to directly use imported animation channels from e.g. FBX files for things other than transformation (rotation, position, scale) and for blend shapes. However, there are a few ways you could do it ranging from kinda easy to crazy complicated.

Probably the easiest way is to add some extra joints to your animation rig that aren't weighted to any vertices. You can then use the x,y,z position to animate different parameters. In Max, you can drive the position of the joint from your material properties using **wire parameters**. (I'm more familiar with Maya, where they're called Driven Keys). Call the joint something like MaterialDriver.

Once you import the animation into Unity you'll have these extra joints moving around in your character. Then you write a super simple script in Unity that takes those transform positions and drives the corresponding property in the material. Something like:

 public class MaterialDriver : MonoBehaviour
 {
     Transform MaterialDriver;
 
     void Update()
     {
         // Get the current color
         Color materialColor = renderer.material.color;
         // Set the alpha of the material from the local (animated) x position of the transform
         materialColor.a = MaterialDriver.localPosition.x;
         // Set the new color
         renderer.material.color = materialColor;        
     }
 }
 

Add this Component to the object you're animating and set its MaterialDriver to the MaterialDriver child object. Assuming you've exported the animation correctly so that its scale and axes are consistent with Unity, you'll get animated materials.

Comment
Add comment · Show 1 · 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
avatar image kamullis · Mar 04, 2014 at 06:57 PM 0
Share

Actually rereading what you wrote, this might work. I just need to figure out how to use max script to create all the joints and connects the wire parameters. There are a lot of objects in the scene and doing it manually would take too much time. Thanks again for the suggestion.

avatar image
0

Answer by kamullis · Mar 03, 2014 at 03:57 PM

Thanks for the response Baroque. That's a really clever work around! I will keep that in mind for other circumstance. Unfortunately that won't work for what I need the animation isn't actually created in Max. The animations are created in a construction scheduling software called Synchro, with which I am not super familiar. However, when I bring the animations into Max all the material and visibility animation is retained in the fbx from Synchro. I am asking about 3ds max because that is what I generally work with and I know that I can get the animations into Max without having to deal with Synchro.

So I love your work around, but won't work in this instance. I will really need a way to actually script an exporter in Max or an importer in Unity. I am not interested in getting to in depth into Sychro.

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
avatar image
0

Answer by edfreeform3d · Jul 10, 2017 at 10:14 AM

Sorry to bring up an old thread, I was wondering if you got anywhere with this kamullis?

I am also trying to bring 4d models from synchro into unity.

Thanks,

Comment
Add comment · Show 2 · 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
avatar image limaoscar · Dec 04, 2017 at 05:03 PM 0
Share

i coded a plugin in to take color change, appearance on!= off ect from synchro into unity, using the Xml from the FBX export. works well i also got the cutting plane to work from synchro.

avatar image jregnier limaoscar · Jun 13, 2019 at 01:59 PM 0
Share

Dear limaoscar, i'll be glad to know more about the way you did this plug-in. I'm also working with Synchro and i was wondering on exporting my synchro animation into unity to get a better animation. I'm thinking of using the X$$anonymous$$L file, but i'm not so sure about the parsing method to use in unity.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

24 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

Related Questions

Can I make animations snap to a frame? 2 Answers

importing max animation without translate 1 Answer

How to make a partial tube (with setting the angle) 0 Answers

Array breaking when pushing floats into it via a for loop. 2 Answers

Jerky Procedural Material Animation 2 Answers


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