Programming help (or collaboration) for the Portland Winter Light Festival

I’m creating a glass and LED sculpture for the Portland Winter Light Festival this February 4-12, 2022. I will be assembling pieces of common household glass objects and illuminating them with strings of colored LED’s and programmed, of course, with Pixelblaze. I’ll have no problem with the physical construction and wiring, etc., but I’m looking for a collaborator who would be interested in programming, or helping me to program the lights.

I posted a small scale concept of the piece here (with random programming). The final piece will use larger glass objects and be about 60" wide x 18" deep and 30" tall.

Here’s a description:
“Skyline” will be an assemblage of 3 dimensional forms and shapes, made primarily of second hand or recycled household glass objects collected over time. The objects range from transparent and smooth, clear and faceted, to some having frosted or diffusing areas. Each element of the scene will incorporate colored and/or white LED lighting which will be programed to change over time and move throughout the piece. “Skyline” comes alive with the way the elements are lit, and how it changes over changes over time. Similarities of the glass forms to architectural shapes, seen commonly in an urban environment, evoke memories of a city and the life within. I see the elements of light as loose metaphor for the people and pace of life within a bustling metropolis. I hope to convey that activity by the way the lighting is programmed, starting with slow, colorless and sparse, building in intensity, movement and color as the “city” comes alive. It peaks at “mid-day”, followed by the energy and colors of “night-life” only to fade into the darkness before the “dawn” of a new day. While the lighting is moving throughout the “city”, the glass itself adds texture and surprise to the light altering it with reflections and refractions and adding to the magic. I aim to have a similar, pattern occur about every 15 mins., but it will not be identical, but rather evolve to keep the viewer’s attention engaged beyond just one “night & day” cycle.

Anyone interested?

1 Like

Neat idea.

I’d suggest breaking this into pieces as a way to simplify coding:

Define different types of buildings, based on index number of the led. So LEDs 0-4 are building type 1, 5-9 are building type 2, 10-20 are building type 3, maybe LEDs 21-25 are type 1, etc.

So now your types are essentially each a group of LEDs, and you can decide to different things with each, in each phase of the time. So type 1 does something at dawn, something different as the morning progresses, something as the dusk approachs… And then something in the evening.
You can define time(s) slices. I do like the idea of a sunrise and sunset, but up to you of course.

So now, once you’ve defined buildings and times, you just need to have code for each combo…

Seems daunting until you realize that we have a lot of pattern code out there, and this is really just a bunch of segments (types). See also original multisegment post. So most of code is done, just a matter of picking the right bits, adding some time changing logic (for each phase of time) and maybe lots of tweaking and small improvements.

1 Like

I had a feeling you were going to chime in with some great ideas again. Makes a lot of sense and makes it seem doable to me as I had no idea how to approach the basic structure of the programing. I did have a feeling that the multisegment example posted by ZRanger1 was going to be very informing. I love your idea of a sunrise and sunset, so consider it added!

Now I’m going to have to dial in my “buildings” and plan the lighting moves over time and place more precisely.

I always enjoy reading your posts…thanks for contributing.

1 Like

Here’s some “Crystal Skyline” work-in-progress pics. Experimenting with glass arrangements, and lighting techniques. Getting some wonderful and surprising results.


Here we have four vases, two glasses, a candy dish, a couple of candle holders and a salt shaker…or is it a urban fantasy dreamscape about to be inhabited by dancing sparks of light?

Video of the one above in action found in link below.

Crazy internal reflections on this one.


Here's links to a few short lighting experiments with random programming.
  1. Cut crystal candle holder lit with simple ring: Prototype 8978 - YouTube

  2. Glass arrangement with simple ring between base and cylinder, plus internal lighting in structural core.: Prototype 9181 - YouTube

  3. Glass arrangement lit with circular Matrix: Prototype 9083 - YouTube

BTW, what’s the easiest way to post video clips on this forum?

2 Likes

You should be able to embed YouTube just by posting the link. Might need to be correct url for forum to recognize it.

Nice videos.

My suggestions:

  • slower speeds, especially starting with just a few or even one pixel lit and increase.

  • Light one pixel and then move which pixel is lit, for “fairy light” effect… Like something is trapped inside.

  • With glass diffusion, and mirroring, less is usually more, and if you have set “looks” a fade from one to the next is often interesting to watch, depending on the endpoints and how much variation between them. So going red to blue thru the spectrum looks good, but going green to yellow is pretty simplistic.

  • Watch Koyanisqatsi movie, I suspect you’ll see a few patterns to try and emulate.

Great suggestions…I really like the “light, then move one pixel as if something is trapped inside”. That’s exactly the feeling I want to convey and then slowly build as more “fairys” wake up. So far, I’ve been focused on the build and not on the programming; the videos just used whatever program happened to be playing in rotation from a stock Pixelblaze. But, I really appreciate your comments as I inch forward.

1 Like

Any ideas on how to create the kind of program described above? It is very different from most of the patterns here which use math to create awesome effects. What I am looking for is a program that “evolves” over 3-5 minutes, going slowly from darkness to light, from white to vivid colors, from just a few pixels lit, to many pixels lit, from stationary pixels to movement, slow to fast, and then returning to darkness with similar effects in reverse order. The metaphor is a metropolis waking up, slowly filling up with people who interact a few at a time till the whole city is bustling through the day and then dispersing into the night as darkness descends. In an ideal world, the underlying patterns would change with each cycle, but still be affected by the variables described above, such as brightness, saturation, hue_range, %_pixels_lit. I’m not using that many lights, maybe 3 to 4 clusters of a dozen LEDs in each of 3 “buildings”; the underlying animation of the pixels could be simple and somewhat random.

Although I’ve been playing with PB for a couple years now, I’m not a programmer. I’m more of a craftsman (or maker) mostly focused on the objects I create to light. So I have NO IDEA how much of a challenge this is. I was hoping some of the generative patterns some of you were exploring, like Pixie, might offer a framework, but I’m not sure. @zRanger1’s, Superformula pattern or Perlin Noise might have possibilities. With Perlin noise, maybe I could simply use code to ramp the UI variables up and down. And ramping brightness or saturation of a pattern up and down just before output, or in render itself. That seems very doable to me, and Perlin noise might be enough for all or most of the animation.

If this turns out to be too complicated, I’ll probably just revert to a simple playlist of patterns which have been modified so that each one successively represent a part of the day/night cycle. But I’d love some suggestions about how to think about creating a pattern like this.

Here’s a couple more prototype shots of my glass “buildings”.






Actually, I’d do it this way anyway. Building it as one monolithic program versus building it in steps, you’re better off as steps. You can make each phase a step (so dawn, morning, noon, afternoon, dusk, evening, midnight, late night)

Once you have a step working, you can always merge into a monolithic program.

But the breakdown will make programming and design easier, and people can contribute to a piece.

Thanks. Sounds like a good strategy and I can see the wisdom in that. I’m prone to making things complicated so encouragement towards simplicity is always welcome.

Ok, so regardless of the phase, let’s see the common elements:

  1. phase lasts 3-5 minutes. Since we have a likit of 32767 milliseconds that’s only 30 seconds of timer, so we’ll need to count both millis and a larger values like seconds. 3 minutes is 180 seconds, 5 is 300… So this will be part of our generic phase code.

  2. each “building” is independent and consists of some number of pixels. So we don’t want pixel bleed from one to the next. For instance a KITT style movement (back/forth, up/down) shouldn’t go from one building to the next, but do each building as it’s own KITT movement. So some way to limit to a building, and do multiple buildings is needed. For all phases, maybe not, but some likely will.

So building these two ideas into code are likely.a first step.

Let’s define Dawn:
Start with all lights off… Lights slowly come on, in a pleasing sunrise manner.
So good example of each building being needed as independent. You don’t want one building lighting up before the next starts and so on. You want each building to have a glimmer and then more glow.

All make sense so far?

If so, please define (don’t fret the code now) for us what each phase looks like? And provide some building examples (how many pixels and layout of pixels)

My first instinct is to use math of course. :slight_smile:
If you want something to gradually go from one thing to another, thats perfect for triangle or wave (depending on the kind of easing you want). Then you just need an input that goes from 0 to 1 over 5 minutes.

I imagine you want this to run continuously, so you don’t need to worry so much about having it be in the middle of that transition when you start the pattern, right? Then you can use time() for that source!

Try this for a day/night feel over 5 minutes:

export function beforeRender(delta) {
  dayTimer = time(4.5) //almost 5 minutes
  
  dayOrNight = sin(dayTimer * PI2) //use sin to get a -1 to +1 range
  brightness = clamp(dayOrNight, .05, 1) //instead of negative, make it darkish
}

export function render(index) {
  if (dayOrNight > 0) {
    //day! go from blue to purple to red to yellow, and back again at dusk
    h = .6 + clamp(dayOrNight, 0, .5)
  } else {
    //night! blues
    h = .6
  }
  s = 1
  v = brightness
  
  hsv(h, s, v)
}

@Scruffynerf I’m with you and I can provide more descriptions of the phases. The buildings aren’t all lit yet, but that does’t matter, I have a general idea and I can assign placeholder numbers which I can change later.

If I run each building on a separate channel from an output expander, I can assign starting index’s for each one, yes? One stream of of data being assigned to each building from pixel x to pixel y each frame. Do I have that right? I’m not so comfortable putting them all on one long serial data line as you had suggested at first.

1 Like

Of course you went o Math…it’s one of your strong suits. And I think it’s one of the strong points of learning on Pixelblaze. You’ve taken away the drudgery of animation and opened up the magic and beauty of mathematical expressions. I’ve been playing with this all evening…and it’s beginning to come together. The is probably my third foray into learning how to code this puppy over the last 2 1/2 years. Unfortunately, I have forgotten much of what I learned earlier, but its coming back…in spades. I came up with a list of questions as I was experimenting, but I think I have answered them all myself! Exporting variables helps so much to get an understanding of what’s going on. I even stumbled using the cosine function to create a wave 180 degrees offset from the sin function. Math is not high on my skill sets, but I do love solving problems. I know that one of your goals was to make programming more intuitive and I think you have succeeded in a big way.

Thanks to everyone for making this forum such an awesome place to explore and learn and so darn friendly as well!

Yes, each channel has a start index and pixel count. If you configure them contiguously they could have the same kind of pixel index addresses as if you had wired everything in a single string. The wiring might be easier and/or more robust with an expander, and you can detach any given piece without disturbing the others.

Thank you for the kind words!

Regardless of using an expander or not, you still need to define each building as a set of pixels.

You have a variety of different designs, and I’d suspect each isn’t exactly the same # of pixels, right? The idea of heights is a factor but that’s actually pretty easy to map for. The XY matters much less in this case, unless you wanted some sort of movement between buildings (or maybe roads would be a better use case)

If you could list some of the above building and how many pixels each has, that would be a good start. Maybe name them, so we all have the same reference in mind.

I’m not using very many pixels…and there are multiple formats. I wasn’t expecting to really map it it out other than account for the number at each level.

I have 5 or 6 buildings in various states of completion. I’ll be choosing three for the show, and hope to have a backup in case something gets broken or goes amiss. I’ll be making that choice this week.

Setup: I have a table, about 18 x 60 x 28” tall, which I can drill holes in so wiring connections can be made underneath it, and I’ll have good access to it. Running it on one v3 standard PixelBlaze plus output expander with each building on it’s own separate channel. The buildings will all have their own power feed and I don’t expect the distances to be great enough to inject power other than at it’s base. All the lights are ws2812’s and I’m using 22 awg wire to connect it all up. Once I get a better feel, I’ll figure out what size transformer I’ll need. I’m good with all of that.

Here’s pics of a few, partial assembled

:



Here’s an outline of my crazy project. This is just one idea it’s very detailed, but nothing is set in stone. Since I’m not a programmer (yet), I can’t really tell which ideas are complicated and which are easy, so I just threw them all out there. I’m good with simpler. I’m just grateful for the help to make it more interesting then I could do alone.

What I’m ultimately looking for is a feeling of interaction , a program that evolves, preferably organically…from dead asleep to awakening…and then back again reverting to darkness over a period of a few minutes. I suspect that is too complex for the short time we have. A series of discreet phases simply butted up to each other sounds very doable and the way to go.

I know these are not pixelBlaze like patterns, they have much more intention, but that’s just because I am trying to tell a “story” and I don’t know how think in terms of letting the math reveal something surprising. The story can be much looser and more metaphor. And I am wide open to creative input, so let those ideas fly.

Having spent the day with this, I realize that the low number of pixels use, coupled with their varied orientation and wide spacing between them doesn’t really support or even require many of the ideas I wrote for phase 3, but I left them in anyway. I think everything else should work just fine.

If the format above is too hard to read, here’s a link to a pdf which should be better.

Lighting outline.pdf (502.4 KB)

After phase 4 will follow 5) winding down, and 6) Sunset which I see as if phase 2 and 3 were played in reverse. Maybe it’s changed up somehow… and then the whole cycle repeats every 3 1/2 mins.

Thanks to everyone reading this for taking an interest in it. I’m just happy, as many of you are, to make this world a little more colorful and fun. Jump in if you like, I’m happy to credit any contributions. Go Team PixelBlaze!

OK, hours of experimentation tonight, getting more facile but not neccessarily more successful. Once I understand the strategy, then I get hung up in the math, and if I understand the math, then I get foiled by syntax…it’s a lot of things to be learning at once. We all have to start somewhere and that’s usually right where we are!

It’s the simplest experiment, but simple doesn’t always mean easy. I’m just trying to set a solid color for a period of time, followed by a ramping changing hue for another period of time. Here’s where I left off:


export var t1
export var h
export var sunrise

export function beforeRender(delta) {
  t1 = time(.5)  //shooting for about 30 seconds
  sunrise = triangle(t1)
}

export function render(index) {
  if (t1 < .8) { 
    //  30 sec * .8 of Dark Blue I'll add some twinkly stars to this later
  h = .66  //t1 + index/pixelCount
  s = 1
  v = .05
} else {
  h = .66 + clamp(sunrise, 0, .5) //going wrong way and clamp does not seem to be working the way I expected.
  
    // v = ?    I'd like the brightness to go up pretty quickly to 1 as the colors move from purple to yel
   hsv(h, s, v)
}


My “Sunrise” gradient is going the wrong way and I see why. By the time “sunrise” becomes trending in the right direction (higher) I’m back in the blue period. So the timing is offset from what I need. So I guess I need another separate variable to represent that hue change that’s moving in the right direction and in the right range From the dark Blue (h=.66) I want it to go to bright yellow (.2 ish). As it becomes yellow, I’d like to add a fast subtle variation of brightness from maybe .85-1 to give the yellow a sort of a glimmer. No idea how to do it and whether it would look good…I’ll just have to try. Any suggestions?

As always, I appreciate the help.

I’ll poke at your code when I have a bit of time, but paper and pencil are my go-to tools for this sort of thing. Draw the sawtooth t1 ◢ and the triangle sunrise ▲ and then draw the curves you want and … well … furrow your brow and make it into math. :relaxed:

You don’t have to stick with straight lines! Take a look at some easing functions: easing demo these show you little graphs of the function from 0 to 1, just like our ‘t’ variables.

2 Likes