8
$\begingroup$

Is it possible to animate the vertex color of an object?

$\endgroup$
3
  • $\begingroup$ perhaps you could clarify on the basis of what you would like to animate it. A morph between two color layers, or something more procedural. $\endgroup$
    – zeffii
    Jun 14, 2013 at 8:00
  • $\begingroup$ two possibilities: - or to morph between two vertex colors layer in time - or to change , in same vertex color layer, the colors in time $\endgroup$
    – GabrielS
    Jun 14, 2013 at 9:07
  • 1
    $\begingroup$ please update your question with more details. $\endgroup$
    – ideasman42
    Jun 14, 2013 at 11:14

2 Answers 2

6
$\begingroup$

Cycles

In Cycles Render, it's rather easy. Create your two Color Layers and animate the MixRGB's Fac: value.

enter image description here

I'm not familiar enough with Blender Internal to find a suitable answer for that engine. Luckily, brecht provided an answer

Blender Internal

enter image description here

$\endgroup$
4
  • 1
    $\begingroup$ A similar setup works for Blender Internal, using two Geometry nodes for the vertex color, a Mix node to mix them and a Material node to plug the color into. $\endgroup$
    – brecht
    Jun 14, 2013 at 11:23
  • $\begingroup$ @brecht I tried and failed miserably, can you show a .blend? $\endgroup$
    – zeffii
    Jun 14, 2013 at 11:24
  • $\begingroup$ pasteall.org/blend/22120 $\endgroup$
    – brecht
    Jun 14, 2013 at 11:30
  • $\begingroup$ @brecht Thank you! I see, the viewport BI render doesn't seem to update (without switching from Render Preview to Texture Preview and back again), but a f12 regular render works fine. $\endgroup$
    – zeffii
    Jun 14, 2013 at 11:38
2
$\begingroup$

manipulating Color Layer directly with Python as a function of frame number

We can animate a color_layer vertex by vertex procedurally with frame_change_pre handler, docs for which are here. This assumes that there is a vertex color map called 'Col', and that you know how to render Vertex Colors

import bpy
import random

obj = bpy.data.objects["Cube"]
mesh = obj.data

color_layer = mesh.vertex_colors["Col"]

def set_vcols(frame):
    i = 0
    for poly in mesh.polygons:
        for idx in poly.loop_indices:
            r = 0.5
            g = 255 / (frame % 255)
            b = random.random()
            color_layer.data[i].color = r,g,b
            i += 1

def my_handler(scene):
    frame = scene.frame_current
    set_vcols(frame)

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

If you go this route, while developing it might seem that your code is not being executed as you hoped, run the below code from console, then rerun your script:

purge the event list:

f_change = bpy.app.handlers.frame_change_pre
del f_change[0:len(f_change)]
$\endgroup$
6
  • $\begingroup$ Thanks but I'm not sure what can i make with this code. What are the steps to use this script? I have creat a cube, asign to it a vertex colors named "Col", run the script, but nothing appears $\endgroup$
    – GabrielS
    Jun 14, 2013 at 7:29
  • $\begingroup$ I now how to render the vertex color, i want to animate this propertie: example: all vertex are red at 0s and all are greens at 1s $\endgroup$
    – GabrielS
    Jun 14, 2013 at 9:02
  • $\begingroup$ a gradual change ? $\endgroup$
    – zeffii
    Jun 14, 2013 at 9:07
  • $\begingroup$ yes exactly a gradual change $\endgroup$
    – GabrielS
    Jun 14, 2013 at 9:10
  • $\begingroup$ Blender internal, but if there is a technique juste for cycle, i want to know too for my knoledge $\endgroup$
    – GabrielS
    Jun 14, 2013 at 9:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .