Animating Cycles (node group based) Shader

Hi, first i apologize if this subject was already discuss, i did’nt find anywhere on the web something related to,

i have a mesh, imported several complex shader and i wanna that the material dynamically change for a time, i know the function for simple color or texture etc…
but what about a complex group based shader ? http://i.imgur.com/6zyepyG.jpg?1

Animating nodegroups is quite easy, and the process is the same as animating just one value. (simply changing the value and creating a Keyframe)
In NodeGroups, if the value(s) to be animated don’t have an input socket, it will render ok, but the animation will not be updated in the viewport.
If you want to be able to see the animation in the viewport, you can still create an input socket for that value, and animate the value outside the nodegroup. (though this will not be reflected in all the instances of that group, but then you can use drivers :slight_smile: )

Can you specify exactly what do you want to animate? if possible, post a blend file with your material.

i thought to use the python function through the info panel (ike jonathan williamson scripts) but that gave me nothing, i just wanna batch change the shader on each frames for example, according to the list of materials included in the file. It doesn’t matter if i cant see the change in the preview window, but just having a still image is enough for me, about the drivers i know they are used on ibl f.ex. i’ll give it a try on the fly

here is the blend https://dl.dropboxusercontent.com/u/70029532/Mandelbulb%20Benesi1Pow2.blend

i don’t know if i was clear.

PS: sorry for my english i’m swiss-french.

Ahhh, so you want to change the material each frame!! not animate a material!! Ok, then you need python to do it.
Go into the Text Editor, create a new text, paste the following code inside, and press ‘Run Script’.

this will change the material of the object ‘slices.pgm’ everytime the current frame changes.
you can add, remove or change the order of the materials in the myList array

import bpy

myList=['AO', 'AO wireframe', 'AO.001', 'Dust Surface', 'GL_Absorption', 'GL_Iridescent', 'GL_Soap Bubble', 'GL_bdsf', 'GL_dispersion', 'ST_plain_diamond_G', 'misc_emit_invisible']

def materialChanger(scene):
    matname=myList[scene.frame_current - 1]
    scene.objects['slices.pgm'].material_slots[0].material=bpy.data.materials[matname]

bpy.app.handlers.frame_change_pre.append(materialChanger)

Thank you a lot for your help! this is exactly what i would, sorry for being not clear at start, making a clear formulation is quite difficult for me even on my mothertongue.

what is the difference between this method or with drivers? and could i save the text as a .py file ? i’m a noob with python, i learn on the fly, and this is an amazing language.

Glad it worked as you wanted :)!

Python is a very easy language to learn (the syntax is very understandable, even for non programmers). The Blender API, not so much… Just because you have allmost everything Blender does, inside the API; and the internal logic of Blender must be known for a proper use.
Fortunatly there’s a lot of documentation, examples and working scripts that you can take information from!! :smiley:

The main difference from Python and Drivers, is that, drivers allow you to control different values from different objects by changing just one value from whatever you like. Python let’s you change allmost everything in Blender, even drivers.