Cycles Attribute Node

I don’t know exactly where to put this question because it is involving:

  • Cycles node connection
  • Drivers
  • Animation

The quick question will be: what can I pass on via Attribute node inside Cycles Material?

What I am trying to do is to setup animation Drivers that control Cycles. So far, I failed to do so, seems like Cycles refuses any Drivers connection. Unless I am doing it wrong.

For example, I created Custom Property, I called it: myValue. I want this myValue to drive value of material of Cycles.

Do I do it from Attribute Node? I tried [“myvalue”] inside Attribute Node but didn’t work.

I know from Miika that Attribute Node can help Cycles to render vertex coloring.

As far as I know you can’t use custom variables in the node as of now.

The node right now is used mainly to allow for the usage of vertex color layers and multiple UV layers, so if you need to use more than one UV layer or need to use vertex colors, that is what you want to use.

I looks like you can add keyframes to values in nodes. So values and colors can be animated. Even something as strange as changing a math node from Greater Than to Less Than can be powered by a keyframe.

But when I setup a scripted driver for such values it does not work for nodes. The same exact expression does work for object properties. So I guess that the driver connection to nodes still has bugs or is not fully working yet.

I have exactly the same problem. Adding a driver on simple value node of a cycles shader doesn’t seem to work. I tried with a scripted expression as simple as “6.0” and it just doesn’t update the value.

I was just thinking about this and maybe there is still a way. We know f-curves work so what if, instead of a driver, we setup a frame_change event and create an f-curve, on-the-fly with the value of “myValue”. When the frame changes, the f-curve will be generated and the node may recieve the new value.

This is kind of what I was thinking about.

This example file shows how you can drive a node value from a frame change event.

Download the BLEND file and scrub the timeline. You will see that the color of the cube changes over time because the frame_change event is creating a f-curve for the Node Color Input on-the-fly.

NOTE: you do have to run the script first to register the frame_change event.

Attachments

26_insert_key_on_node.blend (589 KB)

That is really cool, I thought that the reason for lack of drivers was dependacy errors. That is Compositing comes to late in the chain to receive driver values.

@Atom
Thanks for answering to this question with nice example. Looks like many questions I have in mind can be answered via Python scripting. I have to study this first~