Vertex buffer - changing colors of each mesh?

Hi there,

i try to give a tetrahedron 4 different colors for each side and i want to animate the shape of my tetrahedron by changing the position of the corners. i tried to handle it with vertex buffer, and i am able to set up an editable tetrahedron ending in a constant. but my mesh just gives me a spread of 1 and not of 4, so how can i give colors to the 4 different triangle meshes of my tetrahedron?
anybody knows?


tetrahedron.v4p (7.5 kB)

you have to use vertex collors shader from kalle get it here

You can activate (diffuse and specular) color pins on the VertexBuffer (EX9.Geometry Join) via the Inspektor - wouldn’t that be the easiest way to go?

/edit: eh, I overlooked the patch you provided, you obviously already tried that… :/

thanks for answering,
@grandchild - yeah i already tried :) not working :( i don’t have acces to the particular triangles…
so i tried kalle’s vertex color shader as well but i can’t figure out how to give different colors to different meshes. this shader makes a nice fade between my incoming colors through the whole tetrahedron but actually i just want to give single color to each of the four triangles of my tetrahedron. i’m not into shader right now but i think it’s dealing with the “fade to spec” command in the shader???

would love to help you more. If count of triangles don’t change you can split your vertex buffer with stallone or getslices and make enought meshes and shaders with colors. I’m sure there is more ellegant solution but so far it’s only thing rought way to go… So far i haven’t seen spreaded meshes generated within v4 so cut off proper indecies and make 4 shaders for them that all

you need to write a shader which uses the diffuse color, if you like to use it. right now, it works to set the color, but the constant shader does not draw it. try a DrwaFixed node…

@antokhio - yeah, thought about that and tried to build but, as u said, not very ellegant :)
i tried it with a draw fixed node from the help patch before and it didn’t work with the default indices. so i played with the indices now and traraa… got it! thanks anyway.

tetrahedron.v4p (10.3 kB)