Add nodes to create triangles and quads with per-vertex colors

To make sets of triangle objects for the shader scene using an input of 3D point lists and RGBA (4D points) list for vertex colours. Like the Kineme patch of same name in GLTools.

I guess seeing as we only have lists of similar types, there would need to be ports for points and for colours. Either three ports for each point, or one like Kineme patch that uses first three points in a list for first triangle etc etc. Same for vertex colours I suppose.

Quads while we’re at it perhaps if it would be just a minor tweet to the code to make an extra patch. I’m going to have a go at making a triangle set co-ordinate generating patch to feed the data to something like this, or loop on the single Triangle patch.

Opened for voting.

I updated the title to clarify. The biggest hurdle in implementation will be reworking the render pipeline to support per-vertex colors.

Thx Jaymie. Perhaps you can help me to understand what I’m really requesting here (i.e. apart from per vertex colours for triangles and quads which is really the final part of what I was requesting)

It was actually the ‘family’ part that interests me most, but thinking it through more I suppose I’m resisting the Build List paradigm for multiple object making in Vuo (and arrange object nodes) to some extent.

For clarification: my normal conceptualisation and workflow in QC for this kind of thing is:

  1. generate some geometry and point associated values exported from 3D app/spreadsheet/JS patch/script in Adobe Illustrator to export vectors for each path;
  2. plug co-ordinates (and colours) in to a GL primitive inside an iterator or GLTool Primitive Family patch;
  3. intercept and modulate some of the values by ramping them using various math/interpolate patches.

In Vuo I must think about this very differently using the Build a List method. And it’s hard for me to conceptualise the mathematics to describe the rows of triangles using this method in Vuo which would require the translation and scale distortion of the ‘universal’ Triangle Object (primitive triangle is not equatorial for e.g. so I’d have to scale X to be same as Height using trig). Then i’d need to translate and scale each instance in the list as it builds using “Build List Item” value and Transform with some maths. And making lists inside lists like QC has with nested iterators is out of bounds in Vuo so my math needs to get more complicated in the one level of list making.

Hence the desire to bring the data in and shove it into a node that takes a list of 3D Points (and possibly vertex Colours but that’s an extra) and makes triangles where I want them. Perhaps when I can code Vuo nodes well enough, I make a custom nodes to generate the co-ordinate (and colour) data using various (runtime adjustable) input ports.

Does this make any sense, @jstrecker? Given the image I posted in this forum question, how would you go about generating the position data for the triangles in Vuo as it currently exists (v1.2.2)? What would be the simplest way to make it a bit easier to achieve the things I want to do with a new node or two?

triangle mesh

In prioritised order of features I’m interested in it goes:

  1. triangle families taking list(s) at input ports (any kind of arrange in grid method doesn’t suit irregular sets of triangles)
  2. vertex inputs instead of transforming the existing ‘universal/platonic’ triangle shape (as a list of 2D/3D points is most logical input type with 2D defaulting to all Z co-ords=0) perhaps I need to be talked out of this if I can see a better way to do it using existing Transform and Build method.
  3. per vertex colours (currently no way to do this except for a custom shader I guess)

Have you tried the Parabox Make Mesh with Values node? It inputs a list of points and turns them into triangles in a mesh.

Here’s a composition demonstrating a Vuo equivalent of the QC workflow you described:

  1. CSV file contains list of points. Left part of the composition reads in those points. (Will become simpler after Load structured data.)
  2. Plug points into Make Mesh with Values.
  3. [not illustrated] Optionally feed points through math nodes before Make Mesh with Values or feed 3D object through filters after Make Mesh with Values to modify positions.

I think the one thing missing in this illustration is the ability to set different colors per triangle or per vertex.

Alternatively, you could use the built-in Make 3D Triangle instead of building up a mesh, which is what I think you were describing above. This actually seems closer to your QC workflow. For step 2, you could use Process List to take a list of points and turn them into triangles. The difficulty of this step really depends on the data that you’re feeding in. Since Make 3D Triangle takes a Transform (as opposed to the 3 vertices), it would be easiest if your CSV could contain the triangle’s center point (center of mass) and rotation. Or if that’s not possible, then you could feed in a point-triplet (3 vertices) and do the math.

So, what do you think? Can you accomplish your task using either Make Mesh with Values or Make 3D Triangle, and would just like to see certain things streamlined? Or is there some part of your task that you just can’t do yet?

Since this feature request doesn’t yet have any votes and we’re all still trying to figure out what it should be, I’ve changed its status from “open for voting” to “waiting for information” for now. (69.3 KB)

@useful_design, if you have any thoughts on my latest comment, and whether that solves your problem, let me know. Until then, I’ll close this feature request.

I think the one thing missing in this illustration is the ability to set different colors per triangle or per vertex.

Yes, true. Here it is as triangle family with per vertex colour attributes:

@jstrecker Thanks for the demo comp and sorry I took so long to check it out, I had forgotten that you’d posted it. Installing Parabox was much less effort than I must have imagined back then when I avoided it. I’m really keen for this node, much of what I want to do soon is around triangles and it will force me back to QC. a quad family node would be good too (though 2x triangle can simulate a quad obviously).

I’m not sure how to set different colours for each triangle if not per vertex of each triangle with the Parabox Make Mesh with Values node.

I note there’s a Texture input in the Make Mesh with Values, but it’s getting the same point list as the Positions input, some sort of UV map?!

It’s not clear to me how this node works exactly, I had a fiddle around. The elements is a integer list: [0, 17] (inclusive) so presumably it tells the node where to get the next vertex position from in the Positions list? I’m not sure how to enter multiple textures, is that the only way to colour each triangle with coloured images, a UV map? That would seem to make this a lot more complex to use than the Triangle Family node (al la Kineme Triangle Family if that’s what it was called).

Incidentally when I tried to use a Make Lit Color Shader node to work with the Make 3D Object nodes it didn’t work where Make Unlit Color Shader does.

triangles_alt_AL.vuo (8.8 KB)  

Okay I’ve had a think about this Jaymie and I have a suggestion for the inputs and output(s). But I’m realising the way VUO makes objects is a bit more complex than a simple Renderer patch in QC. This means that you may not be able to simply replicate the Kineme Triangle Family patch (or Quads) quite so easily as ‘porting’ the concept.

I guess Vuo uses a workflow that’s a bit closer to how GPUs actually process geometry into images. Creating 3D objects (that have an opaque datatype in Vuo called “Scene Object” in the ‘tooltips’) typically have a single shader input for describing the colour and/or lighting for these objects in any given scene.

The only exception I found was the Make Cube with Materials which has a material input for each face of the cube. So I can’t find an example anywhere in Vuo of applying different colours to the one object except by applying a gradient image or something convoluted like that.

Anyhow please let me know if you think this is doable, it seems so straight forward to the uninitiated :-)

If we had a single Triangle patch “by vertex” with color inputs for each vertex then a Process List could build the 3D Object list of triangles. I realise in theory one can use the Make Triangle (primitive) node and apply individual transformations for translation, scale, and rotation with the Copy 3D Object node but:

  1. it’s not how I tend to think about making generative graphics (which possibly I could retrain my mind for), I tend to think of creating and manipulating Point Data, and
  2. the kinds of things I want to do subsequently with the co-ordinates — like rotate points about an arbitrary axis will become impossible for me to wrap my head around if I’m forced to use 3x3Point transform vectors to describe each triangle and then apply 4 steps of transform matrices rather than processing a list of points in 3D space through those transformations required to do the rotate around and axis (folding 3D objects in 3D space essentially).


You can nearly do the coloring with Make Vertex Attribute Shader. You end up with one corner black instead of a chosen color. I wonder if you could fake it with some color adjustments (Render Scene to Image and then modify the image).

By “rotating about an arbitrary axis”, do you mean the edge of the triangle? That’s quite doable using transforms.

Both are illustrated in the attached composition.

FlappyTriangles.vuo (4.65 KB)

Thanks for the comp @jstrecker. I’ll look at this some more when I have more time but it doesn’t seem to cover the use cases I want to explore. And correcting for the black corner is unworkable for me. It’s hard enough putting an idea into Vuo for me without having to pull that kind of workaround. Also the rotation doesn’t look to be clearly on the triangle edge to me.

Ultimately I’d want to be able to rotate a bunch of points or triangles/quads around an arbitrary axis, like an edge of one single object in a single node as a calculation on [X,Y,Z] lists.

Here is an illustration of a long strip (quad) that gets folded a bunch of times to make a “K” shaped object. Imagine watching the folding happening like origami through a series of transformations.

Untitled-1.pdf (453 KB)

I would have to update the set of points to be “folded” after each fold transformation has been animated to remove the pair of points where the last fold took place and add a new quad to the list of stationary quads. I’d want to handle this programmatically for simplicities sake. I’d much prefer to be doing this all with point co-ordinates that I can see and check as numbers rather than sending it into the black box of the transform node which I can’t validate the numbers out of. That’s why I’m attempting to learn C so I can roll my own nodes, Vuo just isn’t set up to work the way I like to think and used to work in QC, as as much as I’m happy to learn the new way of doing things, it’s not unlocking the potential power of Vuo for me just yet.

I started writing a long post on another thread about this more general limitation/frustration I experience in Vuo so often and was editing it over the last two weeks but a restart of Chrome lost me the comment (unsaved). I expect I’ll end up rewriting it at some point, it’s basically a QC was Lego and Vuo is like Meccano to me kind of post exploring how I keep getting myself painted into a corner without the right node to get me out of it in Vuo, whereas QC could be slow and frustrating but generally you could hack something together in the end and there felt like a lifetime’s worth of flexibility in terms of patches fitting together and language versatility in QC (especially with all the amazing Kineme addons). I just can’t get that flow (an intuitive, creative mind-state) in Vuo so this FR is an attempt to provide some of the basic functionality to get me started. I’d really like to see it opened for voting, to me it’s a no brainer kind of fundamental functionality to provide for Vuo to be built on with other nodes.

(i imagined it was going to be easier to use C than it is when I first suggested we have a QC replacement where the nodes are written in C to get optimal speed and where we can write/modify our own, to be honest most of the stuff I’m looking to write in nodes is just performing calculations on a bunch of (X,Y,Z) points and colors so it could probably happen in a Lua/JS/Python node plenty fast enough!).