Editing values after a certain range in mapper

Greetings all. TLDR: I’m looking to ‘black out’ some LEDs in my array.
I have a JSON array in mapper where it appears the first portion is for my lamb body and eyes, and the second portion (the beginning marked at the [0,0] value I think) is the outer portion and the face. Ideally, I’d like to ‘black out’ the second portion in the series, so that only the lamb body and the eyes show. If someone could bump me in the right direction, I’d be eternally grateful. I’m happy to try a manual JSON mapping, if that’s the best approach with my design needs, but I figured I’d check to see if there’s a way to work with the data set that I currently have. Thanks for reading/considering

Update: I brought a new set of eyes on the issue and he found this thread and we are digesting

Is this mapper snippet really the order they’re physically connected? It looks like a very custom soldering job to do it this way! If I were doing this project I might be laying out strips in rows or using a prewired matrix. The mapper’s order of coordinates must match the order they’re physically connected.

Assuming this map is accurate to the connection of the LEDs, I really like the idea of a separate snippet of code you use to black out the LEDs around the eyes and outside the body.

For example, if you just took any pattern, find where hsv(h, s, v) is called, and add something so it’s called like this hsv(h, s, v * (index <864), that should only light up the body and eyes.

Here’s the default new pattern rendered through your map. Please ignore the blanks; the preview window only live-renders 1000 sampled pixels (is this right, @wizard?).

Default new pattern rainbow:

export function beforeRender(delta) {
  t1 = time(.1)
}

export function render(index) {
  h = t1 + index/pixelCount
  s = 1
  v = 1
  hsv(h, s, v)
}

With the modification:

export function beforeRender(delta) {
  t1 = time(.1)
}

export function render(index) {
  h = t1 + index/pixelCount
  s = 1
  v = 1
  hsv(h, s, v * isBody(index))
}

isBody = (index) => index < 684

1 Like

Well then! You could consider adding a 3rd dimension, then using Render3D. Store a “which part of the picture is it” flag in the 3rd coordinate of the map, then:

export function render3D(index, x, y, z) {
  if (z == 0) {
    if (showLamb) {
     colorLamb(x,y)
     return
    }
  } else {
    if (showBackground) {
      colorBackground(x, y)
      return
    }
  }
  rgb(0,0,0) // default
}

I have a map in which I store θ (angle) in z so I don’t have to do trig at render time. Works great but looks a little funny in the map view!

2 Likes

Thank you Jeff, @wizard and @sorceror ! Nope, it’s not the real order. Apologies for not providing that detail. My matrix is actually just a plain old rectangle, 34x36LED, powered in parallel with the data line as serpentine. I have the board split up into 4 segments.

The array I shared in this thread is an output from Jason Coon’s LED Mapper, starting with the layout from this Sheet, realizing after the fact that it won’t work well for physical layouts without gaps. As Jason said, I tried mapping a logical layout that has actual gaps to a physical layout that doesn’t.

Which then brought me back to trying the FastLED XY Map Generator, and the output shared in this post. Thank you both for your time and thoughts—I’m at work now, but will get to work digesting these tonight. Thanks again

Hi @sorceror , I’m going to write out the JSON manually, and give this Z trick a shot. Before I begin, I’m hoping you can verify my method. The snippet below is for the top row, where the lamb pixels are between 12 and 23.

Would it look like this?

[0,0],[1,0],[2,0],[3,0],[4,0],[5,0],[6,0],[7,0],[8,0],[9,0],[10,0],[11,0],[12,0,0],[13,0,0],[14,0,0],[15,0,0],[16,0,0],[17,0,0],[18,0,0],[19,0,0],[20,0,0],[21,0,0],[22,0,0],[23,0,0],[24,0],[25,0],[26,0],[27,0],[28,0],[29,0],[30,0],[31,0],[32,0],[33,0],[34,0]

Or, does every single LED need a Z coordinate, like this? Here, I have the background (the part I want the lights to be off) as Z=1, and the lamb body as Z=0.

[0,0,1],[1,0,1],[2,0,1],[3,0,1],[4,0,1],[5,0,1],[6,0,1],[7,0,1],[8,0,1],[9,0,1],[10,0,1],[11,0,1],[12,0,0],[13,0,0],[14,0,0],[15,0,0],[16,0,0],[17,0,0],[18,0,0],[19,0,0],[20,0,0],[21,0,0],[22,0,0],[23,0,0],[24,0,1],[25,0,1],[26,0,1],[27,0,1],[28,0,1],[29,0,1],[30,0,1],[31,0,1],[32,0,1],[33,0,1],[34,0,1]

Thanks a lot. Assuming one of these methods is correct, my plan will be to write out the remaining rows, paste the total array in mapper, and then will move to adjust some patterns with the code you pasted.

For a 3d map, you’ll need Z coordinates ([x,y,z]) for every pixel.

3 Likes

Thanks @zranger1 . Going to get going on writing!