sampling a custom set of points from a TOP?

I’ve been a bit stumped trying to work out the best way to sample color data from a top.

Up until now I’ve successfully done some small tests with the sample() command, works as expected however I’ve noticed it slows down pretty quick when sampling larger numbers of points.

This is my setup:

I’ve got a table DAT of x,y coordinates representing points in uv space.

I’m trying to rotate / translate / scale these points (they represent geometry vertices which represent relative led coordinates in a physical panel) but I want to avoid matrix mathematics and custom scripts every where if I can for performance reasons and its a bit over my head honestly.

Once those transformations are done, I’d sample the points and gather the RGB color values in a table that I could then pass on into other parts of the network.

My question is:

Is there a way to do the transformations on a table of coordinates using sop’s or any other built in nodes?

I can’t export this geometry as an fbx since I don’t have an easy way to order the points in my 3d application (order is important), but maybe I can import the points in the form of a spline and if so, would it be possible to get the coordinates of spline points same as poly points?

Or am I going about this in a totally wrong way?

Thanks for reading, I’ll keep trying things and if I come up with anything else I’ll be sure to update this thread but pretty stumped at the moment!

I got some sleep and made some more progress thanks to this thread:
[url]SOP displace by TOP - #2 by snaut - General TouchDesigner Discussion - TouchDesigner forum

I’ve got a setup of what I need using just nodes and it works pretty well! (See attached)

  • I’m using the xy coordinates of each point to create a line geometry, which I can do my transformations on.

  • Then that get’s passed as uv coordinates in a TOP to SOP node that’s receiving the video stream. and I get a clean chop with the RGB values.

The only issue is the cook time, it’s still rather high for what I need. I was able to drastically reduce the time by sticking a resolution node in and re sizing the video stream before it gets sampled. While this works it does introduce some slight jittering in the sampling.

All in all I was hoping for a cleaner way to optimize it. Any ideas on how to further optimize the setup in the attached file?

Thanks!
Lucas
customSampling_example.1.toe (7.18 KB)

Also, I noticed one of the geometry types I can build from the point table is a “particle system using all points”

When I apply a shader to this I notice the points all get shaded and colored which makes me think the RGB data might be accessible somehow?

I imagine particle implementation would be more optimized since it’s gpu friendly?

Just a couple small tips:

contant1 instead of :

op("chopto1").row(0)[0]

quicker to use:

op("chopto1")[0,0]

The former returns an entire row, from which the first cell is extracted, which is mostly used for searching on partial names, etc.

If you don’t need the chopto1 DAT, then get rid of it entirely and pull from the channels directly:

op("asd")[0][0]
op("asd")[1][0]
op("asd")[2][0]

If you want to avoid the expressions all together, you can put asd through a Shuffle CHOP (option: Split Every Sample) then export the right channels to the TOP parameters.
In my case the constant TOP cook time drops from .24ms to .06ms, though the new Shuffle CHOP takes .03 ms.

Final thought, consider dropping the constant TOPs to 2x2 pixels (instead of 256x256) to save GPU usage. (1x1 resolution has had some issues in the past with specific drivers).

One side note: The Transform CHOP allows you to modify tx,ty,tz points through a transform, without having to build actual geometry.

Cheers
Rob.