# [OpenSCAD] Problems, or maybe not, with transparencies. Some kind of magic!

Juan C.Cilleruelo juanc.cilleruelo at gmail.com
Tue Jul 30 15:06:54 EDT 2019

```I know, basically, two forms of make pieces transparent: applying alpha
to color -> "color("green", 0.3)" and using the modifier "%". First I
define a cube with six sides and empty in his interior. By another hand,
I define a little solid cube positioned exactly at the centre of the
first one.

And finally, by now, I make the big cube transparent with the color method.

translate([25, 25, 25]) cube([50, 50, 50]);

*color("green", 0.3)*

union(){

cube([10, 100, 100]);

cube([100, 10, 100]);

cube([100,100, 10]);

translate([ 90, 0, 0]) cube([10, 100, 100]);

translate([ 0, 90, 0]) cube([100, 10, 100]);

translate([ 0, 0, 90]) cube([100,100, 10]);

}

Our first alternative is to change the order of the drawing objects:

color("green", 0.3)

union(){

cube([10, 100, 100]);

cube([100, 10, 100]);

cube([100,100, 10]);

translate([ 90, 0, 0]) cube([10, 100, 100]);

translate([ 0, 90, 0]) cube([100, 10, 100]);

translate([ 0, 0, 90]) cube([100,100, 10]);

}

*translate([25, 25, 25]) cube([50, 50, 50]);*

Curiously the inner cube disappears, although the external cube is
transparent.

Now I try the other form of transparency.

*//color("green", 0.3)*

**

*%union(){*

cube([10, 100, 100]);

cube([100, 10, 100]);

cube([100,100, 10]);

translate([ 90, 0, 0]) cube([10, 100, 100]);

translate([ 0, 90, 0]) cube([100, 10, 100]);

translate([ 0, 0, 90]) cube([100,100, 10]);

}

translate([25, 25, 25]) cube([50, 50, 50]);

I lost the colour, but the result is more correct for transparencies.

But, like I need colour, I try a merge of both things:

*color("green", 0.3)*

**

*%union(){*

cube([10, 100, 100]);

cube([100, 10, 100]);

cube([100,100, 10]);

translate([ 90, 0, 0]) cube([10, 100, 100]);

translate([ 0, 90, 0]) cube([100, 10, 100]);

translate([ 0, 0, 90]) cube([100,100, 10]);

}

translate([25, 25, 25]) cube([50, 50, 50]);

All seems to be ok now. The order does not alternate the result.

And now the magic. I decide to make only one side transparent with
modifier %, but all of them transparent with the colour.

*color("green", 0.3)*

union(){

cube([10, 100, 100]);

*%cube([100, 10, 100]);*

cube([100,100, 10]);

translate([ 90, 0, 0]) cube([10, 100, 100]);

translate([ 0, 90, 0]) cube([100, 10, 100]);

translate([ 0, 0, 90]) cube([100,100, 10]);

}

translate([25, 25, 25]) cube([50, 50, 50]);

Copy the text and try it!!!

It's very curious seeing how the cube inside is only visible through the
side we make transparent with % modifier!

I don't know if this is a bug, a not possible capability, or a wrong
functionality. But, *sure all of you can agree that this is a
curiosity!!!! *

-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bmipkpddpnagdccf.png
Type: image/png
Size: 21170 bytes
Desc: not available
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plkpdjheiopdhhkk.png
Type: image/png
Size: 21220 bytes
Desc: not available
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dhlajkldbdkbjdkn.png
Type: image/png
Size: 21279 bytes
Desc: not available
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fbbkbfnjjaohmkio.png
Type: image/png
Size: 15747 bytes
Desc: not available