# Animation nodes color output - how to bake to keyframes as base color

I am creating colors for objects in animation nodes and want to write these colors to keyframes as base colors. In my example the color of the 3 cubes is created by a random color node in animation nodes. Now I want to bake these colors to frames 1-30. Then stop the animation nodes and manually keyframe colors (R, G, B Diffuse Color in the dope sheet) for the rest of the animation for the same cubes. (or use other animation nodes output) How could I achieve that?

(The cube with "manual" material is for reference, how I want to set the colors in manual mode)

You need to use the Set Keyframes node. Link to the docs.

It is designed to keyframe transforms (Loc, Rot, Scale), but you can keyframe other properties by choosing Custom in the first dropdown.

Click on the + icon to add a new field, and type color (implied object.color, that is to say the object viewport color) because that's the property you want to bake the keyframes to.

Check Enable to, well, enable the node's behavior.

Now if you play the animation, it will bake the keyframes to ALL frames.

How to restrict the baking to a certain frame range :

Add a Time Info node and a Compare boolean node.

Result :

• This answer works perfect! Thanks! May 4 '21 at 11:02
• @ChrisM Glad it helped :) By the way, if say you just want to bake the red channel of the color, instead of -1 beside the field where you type color, you can set it to 0 (1 for green, 2 for blue, and 3 for alpha) cheers May 4 '21 at 11:05
• Good to know, thanks. By the way, if I select the cubes and check material - viewport display, the color is still white for all cubes, in all keyframes, and the small dot also shows it is not keyframed. Same is the case for materials - surface, if I turn off "use nodes", the base color is still white and not keyframed. I can see the dots in the dopesheet, but not in the graph editor. Where/how can I see to color in these displays? May 4 '21 at 11:19
• @ChrisM You'll have to use a different setup for that, the object viewport color and the material viewport color are 2 different properties, they belong respectively to an object and a material. One material can be shared by multiple objects, and one object can have multiple materials. As you noticed, the material viewport color is used for the diffuse color of the default material when use nodes is unchecked May 4 '21 at 11:35

Nice name! ;)