My project has a topto feeding into a constant.
The topto output is r, g, b, a (alpha=1) and the output from the constant is r, g, b, a(amber=0). I am trying to use a Chop Script to dynamically generate the proper output for the constant. I keep getting errors about how numChans is not available during cook.
I am not sure where (which function to do my work in) as well as I am unsure how to add labels to my output channels.
Ideally I would like to do something like this in my script.
video-in → resolution → topTo → THIS_SCRIPT → constant with proper data and labels
output[]
for(i=0; i < me.numChans; i+4){
output[i] = input[i] // r
output[i+1] = input[i+1] // g
output[i+2] = input[i+2] // b
output[i+3] = 0 // amber
}
Quick question here @phando - is there a reason you want to do this in CHOPs rather that in TOPs? You could also do this with a small shader, and skip the extra work in CHOPs. This will likely be a bit faster as well.
That being said… I think I misunderstood what you’re trying to do here. Both the lookup and shuffle CHOPs might be a better approach if your aim is to order your channels and samples for output. Another option is to feed your TOP to CHOP with uv coordinates for the pixels you want to sample. Op snippets for the DMX out CHOP have a good reference here.
Thank you for your help.
My goal is to set up two light bars on either side of a big projection screen. The light bars will project the colors found at ether edge of the screen into the real world.
The network is taking the video feed and dithering it down to a 32 x 8 image. 8 because my light bars have 8 zones.
I am using a constant to prepare the data to go to the dmx outs. The output to the light bars is 8 x r, g, b, amber. Then are also two extra channels, a strobe and dimmer.
This is my 1st time using a container, I exposed the crop section of the video to the container’s parameters. Since the crop section is dynamic, I was thinking I could write a script to make the appropriate number of channels in the constant object. This would also require making the right number of pixel and sub containers to the UI looks right.
The Crop Top looks cool, but when I try to output it to a Constant Top it is only showing one color.
The UV coords from a surface are used to sample from your image and pack all of your color vals into a single CHOP. From here it’s just a matter of shuffling the channels and samples in the correct order to send to your fixtures.
I like to use instancing to see how those pieces are going to look - so you should see the instances are representative of the light that will go to your lights.
@raganmd What a trick solution!
I don’t understand half of what you are doing but it is super cool. I have never used null nodes before, I need to read up on that. The bits pulled out to the sides of the frame are exactly what I want to send to the dmx bars. What part of your network should I tap into to get the values for my rgb values? It looks like I will be referencing the merge1 or null3 and passing a pixel location to get rgb out, is that in the ballpark?
Yep - exactly. You can use a shuffle CHOP to put these values in the right order for your DMX Out.
The big idea is that you can use the UV’s from the grid in order know which colors to grab. This kind of technique also works with more complex geometry and LED mapping - in more complex arrangements you sometimes need to do an extra preparation step, but this seems pretty straightforward.
@raganmd
All your chops were operating on the whole image. It wasn’t making sense till the shuffle came into play. Now the colors in my light bars are the same as the colors in your squares.
I do have one outstanding issue though. There are two additional channels per light bar. Strobe and Dimmer. I am including those in the output, but they are having no effect on the device. Do you have any thoughts on that?