Sampling the color from a point on a image

Hi guys
I’m trying to create an effect similar to the image below. I’ve managed to create the concentric circles but I can’t figure out a way of projecting the image into the lines. I’ve tried to instance the r,g,b, from a top to chop, but that doesn’t work (I think it’s because I’m dealing with a circle), I’ve also tried to color map it to a torus, also doesn’t work. What do you guys think can be a solution?
Is there anyway to store the information on a point so I can displace the points from the circles(“destroying” the image), with a noise for example and it still retains the previous information (from the image)?
Also How can I adjust the thickness of the circles?

I’m also linking my current network

Thanks
I would appreciate any help

Hey,

if instancing you would have to use a shader to look up the color depending on the position of each point.

If not instancing, then the attached will do, using the Topto CHOP you can use the position as a uv lookup into an image and get the colors back. I use a Chopto SOP to create the geometry from all channels and use Luminance as a width attribute which the Line MAT can make use off to control the thickness of the line.

The attached is using an experimental build which you can get from here: Releases | Derivative

Cheers
Markus
fetchColor.tox (1.2 KB)

Thank you so much. It was exactly what I needed. Learned a lot from your example!

Just one more question Markus. What if I wanted to do more complex shapes, for example like the stripes below. I would need to always look at it with a pattern point of view, to understand how x and y are behaving or I could use another solution?

Hey,

the solutions vary depending on your input pattern. For a strip pattern such as the one posted here, you could create a geometry with a couple Copy SOPs and then use the position from them to fetch the color using a Sopto CHOP.

The Copy SOP copy1 uses a feature called Stamping (https://docs.derivative.ca/Copy_SOP#Creating_Stamped_Geometry) which is great fun to play around with. Here I use the Members me.copyIndex and me.copyTotal to control the scale and position of each copy that is created. These parameters are used in the Transform SOP transform1 - so yes - with the Copy SOP (and also Copy CHOP) you can certainly go backwards in TouchDesigner.

Also see how I have to use the original geometry as an input to the Chopto SOP as otherwise the lines would all connect.

But in the end, there are various ways for each pattern - depends on how you want to solve it :slight_smile:

Cheers
Markus
fetchColor.v2.tox (2.1 KB)

This approach might be a bit wasteful as each line has the same number of points, so shorter lines have “more resolution” than longer lines. Also the center line is duplicated…