jersmi's picture

Looking for advice, wisdom, resources, ideas, the usual.

Step one, I got the parabox node Make Mesh with Values to work drawing a mesh with the mouse. Cool. Now I want to make some mesh "brushes", and any other wild thing that comes up, geometric/parametric or otherwise.

The way I see it, elegant solutions have been around for a long time (at least a couple decades), and folks have done tons of interesting stuff in other software (Processing, Jitter, openFrameworks, javascript, etc.). At present I'm coming up a bit slow and short slogging through the interwebs.

Any ideas are welcome. Are there any tools I'm missing in Vuo at present?

I'm just getting started, here are some notes for some rudimentary triangle math (middle school level is about where I'm at right now) to try and get some geometry working, hope it makes sense.

Triangle ABC    
A = ax,ay (previous mouse point) 
B = bx,by (current mouse point)
C = cx,cy (the third point in the triangle, stroke width/2)

Lengths of triangle sides (line segments)
AC = .1 (stroke width)
AB = sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by))
BC = sqrt(AB*AB + AC*AC)

Find coordinates for C (cx,cy)
https://math.stackexchange.com/questions/543961/determine-third-point-of-triangle-when-two-points-and-all-sides-are-known

cy = (AB*AB + AC*AC - BC*BC) / (2*AB)
cx = sqrt(AC*AC - cy*cy)

To orient point C, maybe calculate direction of point B relative to point A (imagining an input selector with formulas for 4 possible orientations). I guess some vector math could come in about now (direction, momentum, et al.)
bx<=ax&&by>=ay??1:     -cx,cy (TL)
bx<=ax&&by<=ay??2:     -cx,-cy (BL)
bx>=ax&&by<=ay??3:     cx,-cy (TR)
bx>=ax&&by>=ay??4      cx,cy (BR)

Comments

You may get something useful

Scratchpole's picture
Submitted by

You may get something useful from this: https://vuo.org/node/2347 Scroll down and have a look at: Triangle Snake Kinect.vuo It creates a triangular prism with quaternion rotations, works well with Kinect or Leap motion input but also set-up to run from Waves.

I have done more to this such as adding UV coordinates and more vertices so it creates cylinders. I got stuck trying to fathom how to create Normals so not yet shared.

Ok, made some progress with

jersmi's picture
Submitted by

Ok, made some progress with help from Joe and the quaternions, but now I'm stumped. Currently the attached layout is hooked up to see Line Mesh. Looks promising, now I want a triangle mesh. Readouts from the positions and elements outputs on Get Mesh Values make it appear that Get Mesh with Values cannot unpack the elements created with Enqueue and Combine 3D Objects. Steve Reinterpret 3D Object also appears to not work, maybe for the same reasons? Help?

Then jumping ahead of myself, this Open Frameworks page is pretty cool. I'd like to approach some of these -- to start with, the image from the Polyline Brushes: Points, Normals and Tangents section showing getNormalAtIndex (the image below). Any help is hugely appreciated. Would it be a feature request to have a Make Normals (or whatever) node?

getNormalAtIndex

Cool.

Bodysoulspirit's picture
Submitted by

Cool.
I won't be of much help here, and sometimes due to limited mesh understanding I don't know either why I get or don't get info from the Get Mesh Values but from your comp, maybe it cannot retrieve child objects, so using a Flatten 3D Object allows Get Mesh Values to retrieve stuff.

However, using a "triangles trip" the enqueue list looses its last values smoothly, but using "individual triangles" it adds a jumpy flickering effect to the mesh / list.

Also, what I don't understand is that even with the mouse node output set to "Enqueue Events" instead of "Drop Events", moving the mouse quickly one gets gaps between the triangle strip. Would need more time digging.

Look more at the Cylinder

Scratchpole's picture
Submitted by

Look more at the Cylinder Snake comp I shared. Currently you are creating individual line vertex not triangle strip vertex. They need to be in the expected order to be interpreted correctly.

You need to create vertices for either side of the strip making up triangles which build the 'ribbon'.

See how I used: get item from, and interleave lists. You could delete parts of that comp to just leave one side of the cylinder remaining, and then repurpose that part.

Joe sorry, typo, I meant when

Bodysoulspirit's picture
Submitted by

sorry Joe, typo, I meant when moving the mouse quickly, not slowly.

I get the screenshot below kind of gaps, I thought enqueue would enqueue them all even if it means slowing down the comp, and connect the triangles, but surely it has to do with mouse & screen refresh rate and stuff I guess, was just a quick test composition, will check more when more time

Could be what Joe mentioned

jersmi's picture
Submitted by

Could be what Joe mentioned about the order of vertices, need to hack at that.

Also want to wrap my head around texture coordinates. How do you properly texture a real time growing ribbon? Speaking of which and maybe off topic, I'm trying to rework Steve's Metallic Scribbler comp with Make Mesh With Values. (I mean, look how awesome Zach Lieberman's shaders are. Then again, he helped create openFrameworks. Love his work). Right now I'm at that point where I need to understand how the texture coordinates work -- how do I get Steve' cool 1D texture to behave like it does in the metallic scribbler?

Work in progress attached.

Yeah, I was just looking at

jersmi's picture
Submitted by

Yeah, I was just looking at your setup in the Cylinder Snake comp. Joe, your comps are really helpful, thanks a ton for sharing, I can feel the amount of work you put in to get it this far.

I still need to catch up on some mesh 101 groundwork to learn the rules, why I need that order for UV coords, et al. That's why I think Steve`s metallic scribbler is a useful test -- how can I map UV coords to a randomly generating mesh, and in the case of the metallic shader a 1D randomly changing shader?

Also getting that parabox GLSL node on my radar.