Baking MoGraph color animation to keyframes.



  • Hi Alls!

    First time poster here. Have next to zero experience in any programming and python most especially. To make things worse, I am pretty new to c4d in general. But now I have this thing that I really need to implement, so I thought I should ask for help here.

    What I'm trying to achieve is a toolset that would let me convert/bake mograph animation with several points (spheres) into keyframes. The parameters that need to be keyframed are position and material color. So far I have the following:

    At the heart of this whole toolset is this XPresso that I was given. It lets me copy each object's position (from cloner) to corresponding objects in a null (that all have been created with "Current State to Object" command). It can even copy each object's color from mograph to individual materials (which I create using a script that I managed to cobble together by following a tutorial) for all the objects in the target null. It also assigns the same color to each object's "Display Color" for what it's worth.

    alt text

    Then comes the baking part. I can bake the positions using the nitrobake plugin, so I believe I don't even need to come up with any solution for that. But it won't keyframe the materials. Neither does it bake the display color to keyframes.

    I think all that's left to do now is to keyframe the colors. As far as I understand, it should be as simple as reading the materials' color value (coming from the XPresso tag) at each given frame and writing this value to a keyframe, then doing that through all the keyframes. Could anybody please confirm the possibility of achieving that? Any advice on how to achieve this would be greatly appreciated.



  • Hi @swever ,

    not sure if I fully understand your request, but you could try MographToNulls_Python.c4d for that:
    https://github.com/lasselauch/c4d-presets

    It basically copies your cloner into a set of new objects. From here you can bake your animation (colors included).

    material color is probably not the best way to think about this, it's probably better to use the display color of each object and use that within a given shader. This way it works with every renderengine.

    Cheers,
    Lasse



  • Thanks for the reply @lasselauch

    I think I've already managed to do the same thing that this MographToNulls_Python.c4d does. I will definitely have a look at it but I think it does the same. What I am trying to figure out now is how to bake. I need each object to have a unique material and have each frame of each materials' color keyframed. And it has to be the material color, because what I am working on is an animation for drone show and the tools down the pipeline are parsing this parameter.

    Here is an example .c4d that shows all stages that I managed to work out so far: https://wetransfer.com/downloads/cc50d50d6669ef1218535fce8891369920200311165106/26744dba1a0a24a1938cf2af47d668fd20200311165106/839449



  • hello,
    Welcome to the forum and nice to meet you.
    for your next threads, please help us keeping things organised and clean. I know it's not your priority but it really simplify our work here.

    We have almost everything you need in our github repository to achieve this

    First, our python documentation of course and if you are not aware, how to use the console

    For your purpose I think a script can handle this.

    I would go this way:

    Clone (make a copy) the cloner object and send a modeling command to retrieve the current state of the cloner. (the example show how to do it with a spline object but that's the same idea.)

    Once i got that edited object i can for each object create a track for the position, rotation, scale, editor color.

    for color you have this example showing how to retrieve the color with two way. I would use the MoData because you can also retrieve the Matrix of the object (position, rotation, scale)

    When you create a python effector and set the control to full, you have an example on how to check the matrix of each clone.

    for creating the track, and the key we have this following example

    Now you have almost everything you need to change the time of the scene and ask everything to update.
    Changing the time in the document can be done with SetTime.
    That will change the time but not update all objects in the scene, for that you need to ExecutePasses (and sometimes, you need to execute twice in a row).
    If you want some feedback but that's not necessary you can call DrawViews to update the views.

    It's sound a bit complicated but one step after the other you will achieve that goal. Of course if you have any question regarding this you are free to ask them we will answer as much as we can.

    We like the one question - one thread approche.

    Cheers,
    Manuel



  • Thank you @m_magalhaes



  • hi,

    I will mark that thread as resolved tomorrow if you don't have anything to add :)

    Cheers,
    Manuel


Log in to reply