Hi!
I just got done with a 5-PB firestorm-coordinated display, so I have a some opinions on how to go about this!
I’m not sure I totally understand the final output, but I’m envisioning it as 8 matrices (so, an 8-letter word could be displayed across them all), and you want to play any pattern such that it “fills” the pixels for the letter on each matrix. But then I got a little confused about what you meant in your example for N… I understand N is the 13th letter of the alphabet, but I don’t think you want to send each Pixelblaze a letter like “N” then have just the 13th pixel on the matrix light up…
Knowing the index of each Matrix
You could duplicate your pattern to all the PBs manually, and then set a variable like “matrixNumber” differently on each Pixelblaze to values from 0-7. But I think your plan, of trying to store it in the map, is ultimately more convenient. More on why later.
The mapper will rescale all values to 0-1, so if we wanted to use the third dimension, Z, to store the matrix number, this is possible as long as you include two non-pixel points at Z extremes. For example, if each matrix was an 8x8, the map could use the default matrix map, but add a third dimension to each point for the matrix number (0-7), as wel as two additional points, as shown here:
Map
function (pixelCount) {
let matrixNumber = 2
let width = 8
var map = []
for (i = 0; i < pixelCount; i++) {
y = Math.floor(i / width)
x = i % width
x = y % 2 == 1 ? width - 1 - x : x // zigzag
map.push([x, y, matrixNumber])
}
map.push([0, 0, 0], [0, 0, 7]) // Add bounding Zs for 8 total matrices
return map
}
Pattern code - recover matrixNumber
Remember, the 0…7 we pushed into z will come into render3D scaled to 0…1, so we need to multiply it back up.
matrixCount = 8
export function render3D(index, x, y, z) {
matrixNumber = floor(z * (matrixCount - 1))
}
Why?
The benefit of pursuing this strategy over, say, creating a variable on each PB that you assign the matrix number, is that that as you debug and perfect your patterns, you can just re-clone your improved patterns to all 8 PBs without having to go back in and copy-paste snippets or re-set the matrixNumber variable.
Setting globals from Firestorm
For sending variables from Firestorm, I wanted this too, but It’s not built into the UI yet. You can set them via websockets. I made a video showing this (setting a particular ascii letter on a matrix) here.
If you wanted to contribute to Firestorm, that’d be awesome too.
Bitwise operations
Since all values in PB are 16.16 fixed point numbers, and the mapper dimensions are scaled to 0…1, you can see how you’ll have access to the lower 16 bits to the right of the fixed point (but my example above sidesteps this).
Pixelblaze has a bunch of bitwise operators. Two patterns I know of that use them are the excellent “Pew Pew Pew” by Scott Balay, and my “Scrolling Text Marquee” for matrices, which I think you might find useful for this project.
Both are in the pattern library, but since it can be a bit unwieldy at the moment, I’ve attached them here as well:
Pew-Pew-Pew!.epe (15.8 KB)
scrolling text marquee 2D.epe (12.3 KB)
Hope this helps!