# Dodecahedron Mapping

**URL:** <https://forum.electromage.com/t/dodecahedron-mapping/4197>\
**Category:** Troubleshooting\
**Tags:** mapping\
**Created:** [August 17, 2025, 11:40pm UTC](https://forum.electromage.com/t/dodecahedron-mapping/4197 "2025-08-17T23:40:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beat](https://forum.electromage.com/letter_avatar_proxy/v4/letter/b/35a633/32.png) [@Beat](https://forum.electromage.com/u/Beat)\
**Post date:** [August 17, 2025, 11:40pm UTC](https://forum.electromage.com/t/dodecahedron-mapping/4197/1 "2025-08-17T23:40:15Z")

</div>

Hi everyone  
I built a dodecahedron with half transparent mirrors. I have 23 pixels per edge and i have 5 led strips in total that i connected in serial with the Pixelblaze Output Expander. The first strip starts at corner 4 \> 8 \> 10 \> 6 then from 6 i just bring the data line back to 10 \> 2 \> 13 \> 15. Then from 15 the data line goes back to 8 but this is done with the Output Expander. Then from 8 \> 0 \> 16 and so on (see the Mapping Code provided).

 ![image](https://forum.electromage.com/uploads/default/original/2X/a/ae1f19db689eef9cbe7532495391dd718936d923.png)

Mapping:

```auto
function pixelblazeMapping(pixelCount) {
  var phi = (1 + Math.sqrt(5)) / 2;
  var a = 1;
  var b = 1 / phi;

  var verts = [
    [-a, -a, -a], [-a, -a, a], [-a, a, -a], [-a, a, a],
    [a, -a, -a], [a, -a, a], [a, a, -a], [a, a, a],
    [0, -b, -phi], [0, -b, phi], [0, b, -phi], [0, b, phi],
    [-b, -phi, 0], [-b, phi, 0], [b, -phi, 0], [b, phi, 0],
    [-phi, 0, -b], [phi, 0, -b], [-phi, 0, b], [phi, 0, b]
  ];

  // Single physical string, forward LEDs and cable-back segments
  var stringSegments = [
    {from:4, to:8, led:true},
    {from:8, to:10, led:true},
    {from:10, to:6, led:true},
    {from:6, to:10, led:false}, // data cable back
    {from:10, to:2, led:true},
    {from:2, to:13, led:true},
    {from:13, to:15, led:true},
    {from:15, to:8, led:false}, // data cable back
    {from:8, to:0, led:true},
    {from:0, to:16, led:true},
    {from:16, to:2, led:true},
    {from:2, to:16, led:false}, // data cable back
    {from:16, to:18, led:true},
    {from:18, to:3, led:true},
    {from:3, to:13, led:true},
    {from:13, to:0, led:false}, // data cable back
    {from:0, to:12, led:true},
    {from:12, to:1, led:true},
    {from:1, to:18, led:true},
    {from:18, to:1, led:false}, // data cable back
    {from:1, to:9, led:true},
    {from:9, to:11, led:true},
    {from:11, to:3, led:true},
    {from:3, to:12, led:false}, // data cable back
    {from:12, to:14, led:true},
    {from:14, to:5, led:true},
    {from:5, to:9, led:true},
    {from:9, to:5, led:false}, // data cable back
    {from:5, to:19, led:true},
    {from:19, to:7, led:true},
    {from:7, to:11, led:true},
    {from:11, to:14, led:false},// data cable back
    {from:14, to:4, led:true},
    {from:4, to:17, led:true},
    {from:17, to:19, led:true},
    {from:19, to:17, led:false},// data cable back
    {from:17, to:6, led:true},
    {from:6, to:15, led:true},
    {from:15, to:7, led:true}
  ];

  var ledsPerEdge = 23;
  var points = [];

  for (var s = 0; s < stringSegments.length; s++) {
    if(!stringSegments[s].led) continue; // skip cable-back segments

    var v0 = verts[stringSegments[s].from];
    var v1 = verts[stringSegments[s].to];

    for (var i = 0; i < ledsPerEdge; i++) {
      var t = i / (ledsPerEdge - 1);
      var x = v0[0]*(1-t) + v1[0]*t;
      var y = v0[1]*(1-t) + v1[1]*t;
      var z = v0[2]*(1-t) + v1[2]*t;

      points.push([x,y,z]);
      if(points.length >= pixelCount) return points;
    }
  }

  return points;
}

```

Everything looks pretty good in the Mapper:

 ![image](https://forum.electromage.com/uploads/default/original/2X/d/d8fbfd257a28530a24197555e62952ca09aeeb25.jpeg)

But in real life the mapping is not properly working. the 3D patterns do not seem to appear appropriate and i have no clue how to solve that problem. Any tipps and hints are much appreciated. Thanks Beat (yes it’s a real swiss name 😉

[Short video of the dodecahedron](https://youtube.com/shorts/EWnHpNuysV4?feature=share)

---

<div class="post-metadata">

**Author:** ![GeekMomProjects](https://forum.electromage.com/user_avatar/forum.electromage.com/geekmomprojects/32/749_2.png) [@GeekMomProjects](https://forum.electromage.com/u/GeekMomProjects)\
**Post date:** [August 18, 2025, 4:45am UTC](https://forum.electromage.com/t/dodecahedron-mapping/4197/2 "2025-08-18T04:45:23Z")

</div>

When I’m checking out a 3d pixel map, I make a stationary pattern that lights up all pixels with values of x \> 0.5 to see if that looks right, then check for values of y \> 0.5, then z \> 0.5 to see if the results look right in each dimension. E.g.

```auto
export function render3D (index, x, y, z) {
   r = 0
   g = 0
   b = 0
   if (x > 0.5) { // After checking x, check y and z
      r = 1;
   }
   rgb(r, g, b)
}

```

---

<div class="post-metadata">

**Author:** ![sorceror](https://forum.electromage.com/user_avatar/forum.electromage.com/sorceror/32/735_2.png) [@sorceror](https://forum.electromage.com/u/sorceror)\
**Post date:** [August 18, 2025, 9:27am UTC](https://forum.electromage.com/t/dodecahedron-mapping/4197/3 "2025-08-18T09:27:07Z")

</div>

You could consider

`rgb(x > 0.5, y > 0.5, z > 0.5)`

which tells you more but might be hard to interpret if the mapping is super wrong. ☺

---

<div class="post-metadata">

**Author:** ![GeekMomProjects](https://forum.electromage.com/user_avatar/forum.electromage.com/geekmomprojects/32/749_2.png) [@GeekMomProjects](https://forum.electromage.com/u/GeekMomProjects)\
**Post date:** [August 18, 2025, 8:30pm UTC](https://forum.electromage.com/t/dodecahedron-mapping/4197/4 "2025-08-18T20:30:38Z")

</div>

looking at your code to calculate the LEDs, it appears that you’re going to double or triple count LEDs at some of the vertices. The edges share vertices, but you count the pixel at the starting vertex for every edge you compute. How are your pixel strips laid out at the corners?

---

<div class="post-metadata">

**Author:** ![system](https://forum.electromage.com/uploads/default/original/1X/98123d16088a5451b5a585e24c0f2a40dd76061e.png) [@system](https://forum.electromage.com/u/system)\
**Post date:** [December 16, 2025, 8:30pm UTC](https://forum.electromage.com/t/dodecahedron-mapping/4197/5 "2025-12-16T20:30:52Z")

</div>

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.
