# 3d video mapping

**URL:** <https://forum.electromage.com/t/3d-video-mapping/1282>\
**Category:** Patterns and Code\
**Created:** [June 4, 2021, 7:57pm UTC](https://forum.electromage.com/t/3d-video-mapping/1282 "2021-06-04T19:57:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [June 4, 2021, 7:57pm UTC](https://forum.electromage.com/t/3d-video-mapping/1282/1 "2021-06-04T19:57:12Z")

</div>

Continuing the discussion from [Blinkfade in Cube Frame](https://forum.electromage.com/t/blinkfade-in-cube-frame/1280/4):

Porting the .ino code is pretty simple:

it’s a 5 second of doing nothing, then it lights up each pixel, in order, for X milliseconds.

```
// 3d video processing v0.1 alpha by ScruffyNerf

export var seconds, pixel

// This part is not in millis, but seconds to avoid 16bit overflows
var initial = 5; 
// initial pause in seconds 
// How many Seconds each pixel is shown for?
// you will need to multiply by 1000 to convert to milliseconds
var speed = .2;

export var loopTime = initial + (pixelCount * speed);

// In millis, this would be 1000 times larger
// and go past the 32767 limit for even 200 pixels...

export function beforeRender(delta) {
  seconds += delta/1000
  if (seconds > loopTime){
seconds = 0
  }
  pixel = floor(( seconds - initial ) / speed )
}

export function render(index) {
  if ( (seconds > initial) && (pixel == index) ) {
    rgb(1,1,1)
  }
  else {
    rgb(0,0,0)
  }
}

```

I’ve stuffed a bunch of fairy lights into a big mason jar. No way could I easily build a map for this, it’s just a bunch of wires. More results and some video later.

---

<div class="post-metadata">

**Author:** ![wizard](https://forum.electromage.com/user_avatar/forum.electromage.com/wizard/32/4_2.png) [@wizard](https://forum.electromage.com/u/wizard)\
**Post date:** [June 4, 2021, 9:54pm UTC](https://forum.electromage.com/t/3d-video-mapping/1282/2 "2021-06-04T21:54:45Z")

</div>

Here’s the context / tool from the other thread, for anyone starting here.

> [@Blinkfade in Cube Frame](https://forum.electromage.com/t/blinkfade-in-cube-frame/1280/4):
>
> [https://led3dmap.lights0123.com](https://led3dmap.lights0123.com)
> 
> This one is a web app you upload video to…(and the web stuff is [open sourced](https://github.com/lights0123/LED3DMap)) and it uses an Arduino program to generate the led pattern (just a run thru each led) which you then video. SO… If someone ports that [super simple .ino](https://github.com/lights0123/LED3DMap/blob/main/static/LightMapper.ino) pattern code into a PB pattern, then with just that pattern and two self recorded videos, you’d be all set.  
> Right now that is the method I’d prefer to see us flesh out. I think we can make this into a PB recommended solution.
