Search Unity

Feedbacks for experimental feature: GameObjectRecorder (2017.1)

Discussion in 'Animation' started by Deleted User, Apr 24, 2017.

  1. Deleted User

    Deleted User

    Guest

    The bug is filed, but I'm not working on it right now (sorry :/ )
    But on the bright side, I'm on the Animation C# Jobs (which is going to be huge!)
     
  2. SuppleTeets

    SuppleTeets

    Joined:
    Aug 22, 2014
    Posts:
    30
    Serves me right for using an experimental feature I guess.

    So I got my stored data to work, so well that I even just rewrote the transform stuff too and I'm not using GameObjectRecorder at all anymore... but now I have a new issue... file size :( Is there any way to pass my clip through Unity's built in animation compression for fbx files?

    EDIT:
    I wrote my own simple keyframe reduction(not as good as Unity's but it'll be fine) and for anyone else running into rotation issues this thread is very helpful: https://forum.unity.com/threads/new-animationclip-property-names.367288/

    EDIT2:
    After banging my head against the wall with an editor script that reduces keyframes after the clip has been created (I'd remove keyframes and the file sizes seemed to get 2-3x bigger...?) I found that reducing the curves BEFORE assigning them to the clip made works great. Maybe this will help someone some day... maybe not.

    EDIT3:
    First off, if you've gotten this far reading my post, thank you for joining me on this journey. After several failed attempts at trying to remove gimbal lock pops from the rotation I was recording, I ended up just going back to using the recorder for transforms. There were way too many discrepancies between what I recorded vs what I was looking at in the animation window vs what was getting evaluated in the scene, and while that forum post linked above explains a lot of it, I still didn't quite get why I was seeing pops when i was simply recording quaternion values and binding them as such.

    If you're attempting what I'm attempting, save yourself the headache and just use the recorder for Transform recording, custom data for everything else.
     
    Last edited: Nov 30, 2017
  3. Deleted User

    Deleted User

    Guest

    When recording using the GameObjectRecorder, do you see the pops in the animation window? Could you take a screenshot?
     
  4. SuppleTeets

    SuppleTeets

    Joined:
    Aug 22, 2014
    Posts:
    30
    Oh no when I use the GameObjectRecorder there are no pops, I only saw pops when I was manually creating rotation curves from the Transform properties and adding them to a clip using SetCurve().
     
  5. Mgravitus

    Mgravitus

    Joined:
    Oct 8, 2015
    Posts:
    13
    So please correct me if I am wrong but because this uses the UnityEditor . There is no way to get this to work on standalone builds? Even if the animation was supposed to be 'saved' in memory.

    I was looking for a solution that allow users to re-position objects in a sequence and save and replay this.
     
  6. calebc01

    calebc01

    Joined:
    Jul 21, 2015
    Posts:
    62
    Wow, I could definitely use this! For my part, I'm building an arcade-style simulation that needs to be filled with enemies flying complex motion profiles - circles, loops, figure-eights, etc. It would be convenient to store a series of positions (as opposed to an animation) that I could then feed to the objects at run-time. I'd like to move the objects with a space mouse and record that sequence.

    Actually, if I had the position, orientation, and velocity over time, it would be enough.
     
  7. Deleted User

    Deleted User

    Guest

    You're right, it's editor only. I know that it's tempting to use it as a replay mechanism, but I'm not sure it would be the right solution, at least not in its current state, since the GameObjectRecorder can quickly record too much data and take *a lot* of memory.

    It's not impossible to bring it to the engine and optimize it, but it would require quite a lot of refactoring to achieve this feature. That's why, for now, we've limited this feature only to the editor.
     
  8. Deleted User

    Deleted User

    Guest

    Hello fellow users of the experimental GameObjectRecorder! ;)

    Just to let you know that, just this morning, a fix landed in our main branch and that it's main goal is to allow to record MonoBehaviours. But along the way, I fixed two more bugs:
    • A better detection of the bindings types, which means better curves and tangents. Overall, this makes the recorder stabler, and fixes some edge cases, like when recording BlendShapes.
    • While writing a test for the MonoBehaviour recording, I discovered a bug in the key reduction algorithm. Nothing critical, but still, it's nice to find and fix this kind of bugs ;)
     
  9. jilt

    jilt

    Joined:
    Nov 7, 2014
    Posts:
    49
    Great that this is being worked on. Does this fix the issue where recorded blendshapes become choppy when reloading Unity? In the meantime, is there any workaround to save/export the detailed blendshape animation before it gets destroyed? I would very much like to use this in a workshop next week but I'm afraid I won't see a Unity update that soon.
     
  10. Deleted User

    Deleted User

    Guest

    I don't have a test for that right now, but considering the fixes I've done, I would not be surprised if they would fix that issue as well.

    But I'm afraid there is no workaround for it in the released versions :/
    For your workshop, do you really need to record blendshapes? For now, it would be safer if you would record the Transform of your objects (for instance recording objects in a physics scene).
     
  11. jilt

    jilt

    Joined:
    Nov 7, 2014
    Posts:
    49
    The workshop involves students acting out a monologue on their 3D selfie character, so recording face blendshapes is essential. Are your fixes in any of the patch releases since last week?
     
  12. Deleted User

    Deleted User

    Guest

    @jilt nope, it just entered in 2018.2.0a1 (and the current beta is for 2018.1). Alphas aren't publicly released, you'll have to wait for the beta for that. And I can't backport it since GameObjectRecorder is still an experimental feature.

    Once 2018.1 is released, we'll enter the beta stage for 2018.2
     
  13. jilt

    jilt

    Joined:
    Nov 7, 2014
    Posts:
    49
    OK thanks for confirming, I'll have to hack up my own recorder/player for blendshapes then.
     
  14. Mgravitus

    Mgravitus

    Joined:
    Oct 8, 2015
    Posts:
    13
    Anyway to record values on custom scripts?
     
  15. Deleted User

    Deleted User

    Guest

  16. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    i tried to record animation of an camera that attached as children to the head of animated robot ...
    but nothing was recorded :\

    Capture.JPG
     

    Attached Files:

    Last edited: Feb 7, 2018
  17. Deleted User

    Deleted User

    Guest

  18. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    yes ...

    Capture.JPG

    Capture1.JPG


    P.S. : i tried to recording the Robot head transform or all of Robot parts transforms , but same result :\
     
    Last edited: Jan 31, 2018
  19. Deleted User

    Deleted User

    Guest

    Ok, the GameObjectRecorder records the local transforms, so since I guess you only recorded the Cine GameObject and not the entire character (correct me if I'm wrong), then the GameObjectRecorder records the changes between Cine and its parent (Robot_Head), i.e. nothing since there's no movement between those two.

    You have different solutions:
    1. You can create a global camera GameObject (not linked to any other object) and make a script that update the camera transform based on the transform of the Robot_Head GameObject
    2. You can bind each property separately: m_Position.x/y/z and m_Rotation.x/y/z, usind the Bind() method in the GameObjectRecorder (by default it records m_LocalPosition and m_LocalRotation)
    My preference goes with the first solution. It's a little bit more trouble, but it adds a lot of flexibility.

    It's often a bad idea to link a camera directly to a bone because the camera will get each and every movements from this bone. It seems like a good idea at first because of the immersion and everything, but in real life, the brain smoothen out our head movement using both our eyes by changing their rotation to keep focus, and by interpreting the images from the optical nerve. When we get the same images from a screen, our brain can't interpret them the same way, and it's often the cause for motion sickness.

    Also, if you want to go third person, or any other blend outside of the character, it will be way easier using global transforms.

    For the second solution, I haven't tried it personally, but it should work.
     
  20. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    i'm not familier with this type of scripting :[
    can you help me? give some examples or does exists an premade script for using on camera?
    i mean an script to select target for camera to grab transforms ....
     
  21. Deleted User

    Deleted User

    Guest

    you can have something like that (haven't tried it, but if there's error, it should still look pretty much like that ;) ):

    class CopyCameraTransform : MonoBehaviour
    {

    public Transform source;

    void LateUpdate()
    {

    transform.SetPositionAndRotation(source.position, source.rotation);
    }
    }

    You unlink your camera from its parent and you add this script to the camera.

    To be 100% sure that the script is executed before the GenericFrameRecorder (preventing a one frame delay), you can change the execution order, see documentation here: https://docs.unity3d.com/Manual/class-MonoManager.html
     
  22. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    well done ... it works :]
     
    Last edited: Feb 7, 2018
    Deleted User likes this.
  23. Mgravitus

    Mgravitus

    Joined:
    Oct 8, 2015
    Posts:
    13
    Is GameObject recorder capable of recording material changes?
     
  24. Deleted User

    Deleted User

    Guest

    @Mgravitus: it should ;)
    if it doesn't, please file a bug!
     
  25. Mgravitus

    Mgravitus

    Joined:
    Oct 8, 2015
    Posts:
    13
    Hey, to clarify, I had trouble getting it to track changes to custom shader variables.
     
  26. Mgravitus

    Mgravitus

    Joined:
    Oct 8, 2015
    Posts:
    13
    How do you set up the EditorCurveBinding to record the Active state of a gameObjects Children (and nothing else)?

    Currently using:
    m_Recorder.Bind(EditorCurveBinding.FloatCurve(path, typeof(GameObject), "m_IsActive"));

    where path = path to gameObject.

    This however doesn't work. Is there another way? Could not find example in the docs.
     
  27. simonmeijer

    simonmeijer

    Joined:
    May 22, 2017
    Posts:
    7
    Hey there,

    I'm working on a test script which runs through the game automatically for performance testing. I'm using the recorder to 'record' player input and I will play it back on test scanarios on other devices. Player input is not only consists out of transform and rotation but also events like mousepresses etc. I would like to include this in the recording.

    I want to do the following:

    1. I press the mouse during recording.
    2. Recorder inserts an animation event in the clip.
    3. I can use the animation event to trigger functions afterwards.


    I tried to do it as follows:
    1. // Set it up to record Animation events recursively.
    2. m_Recorder.BindComponent<AnimationEvent>(gameObject, false);
    Only components seem to be able to be binded with the recorder.

    I also tried to make a custom script tried to add this as follows
    m_Recorder.BindComponent<SomeMonoBehaviourScript>(gameObject, false);

    Did anyone figure out any workaround for this ?
     
  28. Deleted User

    Deleted User

    Guest

    Hi!

    I've tested it and it should work. Are you sure you're not giving the path to the GameObject that has the GameObjectRecorder script on it?

    I fooled myself like that by tracking m_IsActive property of the root, but the script is also on the root, so the GameObjectRecorder wasn't running as well. But as soon as I tracked m_IsActive on one of the children, is worked flawlessly.
     
  29. Deleted User

    Deleted User

    Guest

    Hi!

    GameObjectRecorder.BindComponent can indeed only bind components ;)

    A possible workaround might be to create a script that listens to all the inputs you need and stores them into properties, then use the GameObjectRecorder and create a bind to these properties using GameObjectRecorder.Bind (see last Mgravitus comment on how to create a binding on just one property).
     
    simonmeijer likes this.
  30. aaornrylow

    aaornrylow

    Joined:
    Jul 28, 2013
    Posts:
    4
    Any word on if/when the humanoid recording feature is coming? Or could you provide more details on a workaround? I'm using VRIK with an Oculus Rift, and would love to use it as a basic motion capture tool for creating humanoid animations.
     
  31. Deleted User

    Deleted User

    Guest

    I realize I've said that 8 months ago already...
    Our resources have been diverged to other, more important, features (namely the Playables and the Animation C# Jobs). That being said, I was planning on getting back to the GameObjectRecorder soon, at least to make it out of experimental, especially since it's used by the Generic Frame Recorder now.
    But as for the Humanoid feature, we still need to find a solution. As a workaround, maybe you could record as generic and then convert it back to humanoid? It one more step to do, but I think it would work in the end.
     
  32. aaornrylow

    aaornrylow

    Joined:
    Jul 28, 2013
    Posts:
    4
    I appreciate the response. Sorry if I've made you repeat yourself!
    Is there a way to convert from generic to humanoid within Unity, or would that require an external program?
     
  33. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Do you know how much of a pain it was to make a tool to record user input that could be replayed on a character?
     
  34. Deleted User

    Deleted User

    Guest

    I'm sorry, I thought about the FBX importer, which makes it easy to switch from generic to humanoid. In our case, it is possible to write a script, but it's going to be a bit painful to do, I'm afraid. You would have to write a script that would take the generic animation and then recreate a humanoid animation based on that (see https://docs.unity3d.com/ScriptReference/HumanPoseHandler.html). But I got to confess: it's not gonna be easy.

    It is possible and not so painful. The bad news is that the inputs are not "animatable" (as we call these properties that can't be animated), but the good news is that MonoBehaviours members are! So you will have to create a script that would read and store the inputs in the class members, and then say the GameObjectRecorder to record these members.

    To replay them, you will have to play the recorded anim, it will fill the members of your script, and then read the members and fake the inputs. But be careful: the recording is discrete, the values are true only when you're _on_ the key. In between keys, you will only get an interpolation. Just be aware of that ;)
     
  35. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Which is exactly what we did... And we still feel it to be really dumb.
    Honestly, Unity REALLY need to start getting more off the serialization.

    Still can't figure out why I can't simply "put" a float in an animation at the time I want, and evaluate it back anytime I like.
     
  36. Deleted User

    Deleted User

    Guest

    I'm not sure I understand your problem. Isn't it possible to do that by creating an AnimationClip and feeding it with curves and keys? (see https://docs.unity3d.com/ScriptReference/AnimationClip.SetCurve.html)
     
  37. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
  38. theotrian

    theotrian

    Joined:
    Oct 27, 2013
    Posts:
    4
    Hi there! Thanks for the feature! Its really fun to play with! I have been having this issue, where I am trying to record the GameObject.IsActive state and seems to work fine but for the keyframes that seem to be "snapping" at specific intervals (see attached), and thus the animation looks out of sync. Any ideas how to fix this? Has it something to do with how keyframes are compressed?
     

    Attached Files:

  39. Deleted User

    Deleted User

    Guest

    I haven't tested it, but I would be able to create the .anim with AssetDatabase.CreateAsset.

    Thanks ;)
    What is weird is that there's a key at each frame. Are you flipping the bool that frequently? As for the post-processing that happens when saving the animation, all the curves are baked at 30 fps and the keys between frames are removed, then a light compression pass is applied, but it should do much on a bool curve except skipping out the subsequential keys with the same value.
    Could you click on an isActive curve show me its curve?
     
  40. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Not what I meant. How would you evaluate the animation's values at runtime? Right now, the only way is to have a serialized structure that follows the animation property paths.
     
  41. Deleted User

    Deleted User

    Guest

    Well, I explained that in my reply:
    > To replay them, you will have to play the recorded anim, it will fill the members of your script, and then read the members and fake the inputs.
     
  42. Crazy-Minnow-Studio

    Crazy-Minnow-Studio

    Joined:
    Mar 22, 2014
    Posts:
    1,399
  43. Deleted User

    Deleted User

    Guest

    I didn't know this project, I'm interested to know how they managed to generate animation at runtime.

    I haven't tested on the GameObjectRecorder, but the blendshape problem should have been fixed a long time ago when I fixed the way the bindings were recorded. I haven't heard of a problem with the blendshapes since then.
     
  44. Crazy-Minnow-Studio

    Crazy-Minnow-Studio

    Joined:
    Mar 22, 2014
    Posts:
    1,399
    Hey @RomainFailliot! I just tested on 2017.3.0f3 and it was recording every 50 frames.

    [UPDATE]: I just updated to 2017.3.1f1 (latest release version) and same thing.
     
    Last edited: Mar 23, 2018
  45. theotrian

    theotrian

    Joined:
    Oct 27, 2013
    Posts:
    4
    So I am using this to bind the GameObject.IsActive :
    EditorCurveBinding binding = EditorCurveBinding.FloatCurve(AnimationUtility.CalculateTransformPath(childFX.transform,transform), typeof(GameObject), "m_IsActive");
    m_Recorder.Bind(binding);​
    And I am recording on Update() instead of LateUpdate because that seems to work better for the rest of the things I am recording (VRIK and some animation hacks).
    m_Recorder.TakeSnapshot(Time.deltaTime);​
    Attached is the isActive Curve:
     

    Attached Files:

  46. Crazy-Minnow-Studio

    Crazy-Minnow-Studio

    Joined:
    Mar 22, 2014
    Posts:
    1,399
    Hello @theotrian, It looks like the snapshots might still be recording every 50 frames. It looks like there are 6 indicator nodes for every 5 seconds of recording. Am I reading it correctly? I also tried Update() vs LateUpdate() in my tests but did not see any change/benefit.
     
  47. Deleted User

    Deleted User

    Guest

    Interesting, thank you!
    Which Unity version are you using?
     
  48. Crazy-Minnow-Studio

    Crazy-Minnow-Studio

    Joined:
    Mar 22, 2014
    Posts:
    1,399
    @RomainFailliot -- FYI,I tested blendshapes on 2017.3.1 and they were still recording every 50 frames.
     
  49. Deleted User

    Deleted User

    Guest

  50. Velcrohead

    Velcrohead

    Joined:
    Apr 26, 2014
    Posts:
    78
    Do we have any workarounds for the 50 frame sample issue? It's causing us to have gameobjects turn on and off significantly out of time. Unfortunately deadline is looming so any solution will do.