Can you animate vertex colors?

(TorQ) #1

If so, how? Thanks for your time.


(Carl) #2

yes you can… just look in the ipo window, then select (click on the word) ColR, ColG, ColB and then left click in the window to draw the curves…

ColA is the alpha value…

All these values range from 0 - 1

hope this helps, have fun


(TorQ) #3

I’m checking it out now…

(Ben) #4

-This is a python script which can animate vertex colors.

from math import *
cont = GameLogic.getCurrentController()
me = cont.getOwner()

mesh = me.getMesh()
vi = mesh.getVertexArrayLength(0)

for id in range (0,vi):
vcol = mesh.getVertex(0,id).getRGBA()
#print vcol
vcol = …your code…

-in the part of script …your code… you can put a function
which changes color how you want.The problem is that the color is a long.
It changes from -1(white) to -(16**6)(black).


(TorQ) #5


Could you explain a little more or give an example of the “…your code” section of this script? thanks.


(Ben) #6

-In this game:

there are two scripts(InTheDark and InTheSun) which add and subtract a
value of the vertex colors of the main car.So when it goes inthe tunnel becomes darker .As regarding to the color value it’s ,as I told in the other messagge, a long integer.You need a table of colors in hex format(the same used for the html code and convert it in decimal)