Fastest Method for Accessing CHOP Samples

Hello, all-

I’m working on an LED mapping project and I’m attempting to translate pixels in a TOP into values that can be sent out via python. The gist of the technique I’m using is TOP->TOPtoCHOP->Evaluate DAT to look up where each LED should sample from on the texture.

I’ve got the system working, but there seems to be a massive CPU bottleneck in the Evaluate DAT. I have to look up five values (XY coords from a DAT, RGB from the TOPtoCHOP) for each LED each frame. Is this just too heavy for python? Is there a better technique?

Thanks!

: j

Post the function in your Execute DAT for better idea of what it’s doing.
If its all numeric values, can you convert to CHOPs, and Lookup CHOP?

But generally, its better to stick to operators for maximum speed, even a custom shader for some intensive processes.

Cheers,
Rob.

Hey, Rob-
Thanks for the reply! Here’s the function getting fed into my Eval DAT:

op('/LED_Map/colorGrabber/topto1')['r' + str( int(op('selectPos')[me.inputRow,'y']) ) ] [int( op('selectPos')[me.inputRow,'x'])

I’ve got three cells of this, one for R, G and B. the ‘selectPos’ op is the dat containing the coordinates for the pixel to be mapped.

I’ll look into doing this with a Lookup CHOP when I get a chance!

: j

Hey yo.

I usually do this a bit differently.

If you first use a “remap” top you can get an output TOP that is exactly in the correct order of the pixels you are outputting.

This way you don’t need a top-to-chop for the whole image, just the pixels you need.
And you won’t need to look up the DAT and then the CHOP for your python script. Just loop the chop and know they are in the correct order.

Here is an example TOX
pixelmapper.tox (5.68 KB)

What pixel driver are you using? the TOX I uploaded works on the pixlite on Artnet, my new favorite driver.

Yeah if you’re using a controller that you can only send data to via python (UDP or serial OUT for example) then you are going to hit some bottlenecks. If this is a teensy with OctoWS2800, then this is well travelled ground and I would recommend looking at GeoPix where there is already code for getting thousands of pixels worth of data to said device over the USB connection.

github.com/EnviralDesign/NodeMC … xel-Driver

Otherwise I second Harveymoon’s suggestion and go for something like the advatek that can be controlled by the DMX Out CHOP. I’ve driven tens of thousands of pixels with that method and also making sure to do as much in TOP land as possible before your TOPto CHOP.

That being said, Harveymoon’s method could be even more optimized by using the remap TOP to pre-arrange your pixels into columns of 170 pixels each (every column will become another DMX universe starting at the bottom) and then a single Shuffle CHOP set to “Swap Channels and Samples” would be all you need before the DMX Out CHOP to get a bunch of channels with 510 samples each already arranged in RGB order. Then it’s just a matter of filling out your Routing Table DAT to direct each TouchDesigner multi-sample “channel” to the proper Art-Net or sACN “net, subnet, and universe”.

1 Like

Awesome- Thanks, Harvey and Peeet!

I’ll take a look at your patch this weekend!

Driver is still TBD, possibly FadeCandy. Not trying to drive too many- approx 512 at a time. I figured it wouldn’t be too bad, but maybe it’s too much for py.

Thanks for the advice- I’ll let you know how it goes!

: j