Skip some pixels index in mapping?

Hello !

I am making a wearable using Pebble leds mounted on the edges of a scarf.
In the “bottom”, the LED are crossing horizontally to go up on the next segment, but i don’t want to light them up in any case. Actually if I do a chaser, i’d like the index right after the last pixel of the strand going down to be the first led going up, skipping the “horizontal” segment.

Map2

I’d like to avoid cutting, putting a wire and and reconnecting if possible so my idea is to have “dead pixels” that are “skipped”.

I tried to map as below for example but it does not work. What do i do of the pixels between 87 and 88 (technically i have about 10 pixels there, so 88 is in reality 98 on the index…

function (pixelCount) {
  width = 4
  var map = []
  for (i = 0; i < 87; i++) {
    y = Math.floor(i / 87)
    x = 0
    map.push([x, y])
    }
  for (i = 88; i < 160; i++) {
    y = Math.floor((87-i) / 87)
    x = 0
    map.push([x, y])
    }
  return map
}


Thank you !

1 Like

Hello !

I bump this topic as i’m sttill struggling with this.
I understand I might not be able to skip some indexes, but do I really have to add code in each pattern that says:

if (AND(index >87, index<98) {
  v=0
}

I’d like to be able to do that in mapping because I expect to run the same pattern on different wearable sizes (hence difference LED indexes to skip…)

Thank you !

Why do you need to skip them in mapping? The PixelBlaze needs to know that those pixels exist - if you don’t map some pixels in the middle of the range then your patterns will illuminate the wrong pixels.

Instead I think you should skip these pixels in the render stage. The right way to do this is going to depend on how you structure your code. If you’re doing a simple linear chaser function using render() then call hsv(0, 0, 0) when render() is called for a “dead” pixel. If you’re doing 2d rendering with render2d() you’ll have to skip rendering for pixels that fall within the “dead space”.

Does that make sense? This approach will be more flexible in the long run (e.g. maybe you decide in the future that you do want to illuminate these pixels after all.

You could also consider making a 3D map and setting Z=1 for pixels you want rendered and Z=0 for these ones. Then you don’t have to bake the pixel numbers into the pattern. You just have to make the patterns with Render3D(index,x,y,z) and put if(z==0){rgb(0,0,0);return} right at the top. After that it can be a plain old 2D pattern only using x and y.

I do something like z = (atan2(y,x)+Math.PI)/(Math.PI*2) in some of my maps so I don’t have to do that atan2() pixelCount times per frame.

Ideally, mapping would support per-pixel vectors of arbitrary length!

2 Likes

I want to skip them in mapping because i want to be able to sync different pixelblazes together running the same pattern, and i don’t want to skip these pixels on all the installations.

Considering i never need a 3D mapping, putting the ghost pixels in a different Z plane is a great idea ! Thank you !

@sorceror i’m struggling with your atan, can you explain a bit ? Why would we call atan2() Pixelcount times per frame ? We’re just testing the current z at 0 or 1 no ?

1 Like

I’m not using the extra z coordinate to skip pixels. I’m using it record the angle (normalized to 0-1 because it’s a mapping) of each pixel, so I don’t have to calculate it for every pixel for every frame.

The idea for you was just “For a 2D pattern, use the z coordinate for extra data, and pretend it’s a 3D pattern”.

1 Like

Oooooh this is super smart, i never though of this. I could litterally use this to designate with a z ID different “areas” of the LED strip to allocate to it different patterns within a pattern. Amazing ! Thanks !

1 Like