Coloring Faces

cheers,

i’m searching for a way to color the faces of a mesh with different colors. i know it sounds simple and i’ve tried to get it done, but shader and me aren’t the best friends yet.

the most useful solution would be something like this:

i get a spread for every face of the mesh and could change the colors with a color-spread.

thx in advance,

clay

for this you need subsets in your mesh. each subset will be like a separate mesh an can get its own color. there was a script somewhere for 3ds max or so, to do this, but i cant find the link right now…

thanks for your reply.

i’m using the grid-node to generate my mesh, no external x-file. is there a way to get a subset out of it directly in vvvv?

otherwise, i have to generate a mesh in 3ds max with the help of the script. but then, the face-count is limited to the one, i’ve built in max and i couldn’t change it at runtime…

hello, no you cant get subsets out of it. but if it is spreaded, each slice of it can have its own color. so, how do you built your mesh out of it?

sorry, i’ve rembered it wrong. i’m not using a grid. i build my own mesh with the mesh- and vertexbuffer-nodes. Am i right, that the coloring should be the job of the shader? best would be a shader with spreadable color-input…

actually since beta21 geometry primitives can be spreaded to subsets. see attached…

PrimitiveSubset.v4p (7.4 kB)

@joreg: that’s probably awesome; can you explain the benefit? one mesh with multiple subsets instead of multiple meshes sounds like added convenience for vertexshader athletics… right?

@clay: you could color your vertices one by one using the Diffuse Color pin on the VertexBuffer (EX9.Geometry Join) , then use the DrawFixed effect (which respects those colors). to really separate the colors (to avoid funky gradients in shading modes other than flat) you’d have to make sure that the faces aren’t sharing vertices (e.g. give each triangle its own set), though.

@diki: my patch is quite stupid as an example for that new feature as it isn’t really making use of the spreaded grid. all grid-subsets have the same resolution (the result looks exactly the same without spreding the grid). but note that they could have different resolutions. that wasn’t possible before beta21.

thanks guys. the vertex-buffer-hint was the key. and the the subset-fact is also a nice-to-know .

attached patch proves this feature a little better.

EX9.PrimitiveMeshes are Spreadable (Tutorial).v4p (10.0 kB)