Creating rectangles efficiently

Hi All,

Looking for the most optimized way to create a 1x36 rectangle and place it on top of a 1024x768 output. Eventually I would like to create a bunch of the smaller rectangles on the same 1024 output.

What’s the most optimal way to do this?

Thanks!

Do you mean something other than the Rectangle SOP (or Grid SOP)?

Yes,

Essentially I want to use the rectangle top, and only create a 1x36 pixel rectangle but hen I want to be able to place that in a specific place on a larger rectangle.

I don’t want to have to dedicate GPU memory to creating a bunch of rectangle tops that are 1x36 but live on their own 1024x768 frames (set in the common tab of the rectangle top) if I could just render the 1x36 and then use a chop or other method to arrange them I would be much better off.

Does that make sense?

Really what you’d need would be a Copy TOP, but there isn’t one. You might just have to a Rectangle TOP and feed it into a bunch of Transform TOPs and have each one look up its x/y coordinates in a CHOP (or something similar), and then feed them all into a Composite TOP in Over mode.

Or use instancing. Feed a CHOP with x,y,z positions as the channels, and each instance you want as a sample.

I think the goal was to avoid having to use SOPs and a renderer, though that does end up being a good option often, since there isn’t a Script SOP or anything like a Cairo-style API.

If I understand you right then just create your rectangle top with desired resolution (1x36). Then
wire it to over top with your background and set “pre-fill” overlay to “native resolution” + from there you can control the position of your rectangle too.

I think elburz’s suggested method might be most efficient.

edit

I’ve attached a super simple example of doing this with instancing. Hope this helps!
instancing_strips.tox (1.66 KB)