Manipulating .ply point cloud sectionally with Arduino serial input

Hi everyone!

I want to be able to control selected areas/sections of the scanned room .ply point cloud, corresponding to the values generated by 4 ultrasonic proximity sensors from arduino. I am currently able to just put the real-time number input into the threshold of the point cloud to generate movement, but I want, for instance, the area around the armchair to change only when one sensor is activated, the bicycle to move when the other is activated, and so on. I assume it would be something with shape masking of some sort… I am attaching my current workflow file, would appreciate any help- thanks so much!

d.14.toe (8.4 KB)

2 Likes

p.s. it would not let me attach my ply file for whatever reason!

Hi @ayli6ka,

doing this precisely for only certain shapes is not trivial, you would need to create pixel masks that represent the pixels of each object of interest.
For a general area approach - like points in proximity to a position, have a look at the Point Field Component in the Palette’s Pointcloud folder. For this, connect your pointcloud to the TOP input of the component and select “TOP” as the value for the Use Input parameter. For the Type parameter choose “Relative to a Point” and now set the translate, radius and falloff parameters as needed.
The TOP output of the component will be a TOP with the assigned weight mask saved in the TOP’s alpha channel - basically doing a lot of the work you would have to do with multiple Threshold TOPs.

Perhaps of interest to you is the InSession with Matthew Biederman from a few years ago where we discuss some of these techniques.

Hope this gets you started
cheers
Markus

I will take a look ASAP- thanks for your prompt response!

hey @ayli6ka !

upon discussing with some friends, one of them mentioned this tutorial might be relevant for your question: https://youtu.be/dF0sj_R7DJY
(aka, set a threshold of distance so that a transformation only applies within that threshold)

hope this helps!

Hi again Markus!

The component is super helpful, thank you, it’s just now I am struggling with plugging in several nulls from the pointfield components into a single geometry picture. Essentially, what I mean is that initially, I want the whole reconstructed pointcloud scan image to be showing, but each pointfield would be affected separately by the changing radius values from the serial output of the Arduino sensors. How can I “render” them altogether? P.S. I am fairly new to TouchDesigner, it’s been 2 months since I’ve started using it haha, so apologies if the questions seem “basic”.

Hi @ayli6ka,

the output of the pointfield component can be treated as a mask. So for example I just want certain parts of the default banana pointcloud be effected by a noise - I would connect the original banana to the first input of the Matte TOP, the Noise to the second input and the output of the pointfield component to the third input.
The Matte TOP by default uses the alpha channel of the third input to decide from which of the first 2 inputs to use the pixel value from. For an alpha value of 0, the corresponding pixel in the second input is used, for an alpha value of 1, the corresponding pixel in the first value is used.
For values in between 0 and 1, the values between the first and second input are interpolated.

You can do the same process in parallel or in sequence for as many sections as your hardware can handle.

Hope this helps
Markus
base_bananaNoise.tox (5.9 KB)

Thanks for all your help, Markus! I finished the project and figured a way out on my own, but this is incredibly helpful too, will take a look! Can’t wait to explore more of Touchdesigner :))

Aylin

1 Like