3 replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/

Consider the following code:

g=Graphics[{EdgeForm[{Black, Thick}],
{Green,Opacity[0.5],Rectangle[{0,0.5},{1,1}]},
Red, Polygon[{{0, 0}, {1, 0}, {1/2, Sqrt[3]/2}}],
White, Disk[{1/2, 1/(2Sqrt[3])}, 1/(2Sqrt[3])]},
Background->None];
Graphics3D[{{Texture[g],
Polygon[{{0,0,0},{0,1,0},{1,1,0},{1,0,0}},
VertexTextureCoordinates->{{0,0},{1,0},{1,1},{0,1}}]},
{Texture[g],
Polygon[{{0,0,1},{0,1,1},{1,1,1},{1,0,1}},
VertexTextureCoordinates->{{0,0},{1,0},{1,1},{0,1}}]}},
Lighting->{{"Ambient", White}},
ViewPoint->{1,4,7}]


This gives the following graphics:

As you can easily see, the part outside of the figures is opaque white, despite of the Background->None option. Also Background->RGBColor[1,1,1,0] didn't help, nor did passing the Graphics through Rasterize with the option Background->None

Here's roughly what I'd want to get (any inaccuracies are caused by my lacking GIMP-fu :-)):

Looking for a solution I found this codethis code but couldn't get it work for my case. Also, if I understand it correctly, it doesn't derive the transparency from the graphics but just replaces a certain colour with fully transparent, which wouldn't work with the semi-transparent green rectangle.

Combining the 2D graphics with another one using Show does respect Background->None and Opacity on the green rectangle, so it's not a problem with the graphics itself.

Therefore my question: Is it possible to embed 2D graphics into 3D while keeping the transparency of the 2D image, and if so, how?

Consider the following code:

g=Graphics[{EdgeForm[{Black, Thick}],
{Green,Opacity[0.5],Rectangle[{0,0.5},{1,1}]},
Red, Polygon[{{0, 0}, {1, 0}, {1/2, Sqrt[3]/2}}],
White, Disk[{1/2, 1/(2Sqrt[3])}, 1/(2Sqrt[3])]},
Background->None];
Graphics3D[{{Texture[g],
Polygon[{{0,0,0},{0,1,0},{1,1,0},{1,0,0}},
VertexTextureCoordinates->{{0,0},{1,0},{1,1},{0,1}}]},
{Texture[g],
Polygon[{{0,0,1},{0,1,1},{1,1,1},{1,0,1}},
VertexTextureCoordinates->{{0,0},{1,0},{1,1},{0,1}}]}},
Lighting->{{"Ambient", White}},
ViewPoint->{1,4,7}]


This gives the following graphics:

As you can easily see, the part outside of the figures is opaque white, despite of the Background->None option. Also Background->RGBColor[1,1,1,0] didn't help, nor did passing the Graphics through Rasterize with the option Background->None

Here's roughly what I'd want to get (any inaccuracies are caused by my lacking GIMP-fu :-)):

Looking for a solution I found this code but couldn't get it work for my case. Also, if I understand it correctly, it doesn't derive the transparency from the graphics but just replaces a certain colour with fully transparent, which wouldn't work with the semi-transparent green rectangle.

Combining the 2D graphics with another one using Show does respect Background->None and Opacity on the green rectangle, so it's not a problem with the graphics itself.

Therefore my question: Is it possible to embed 2D graphics into 3D while keeping the transparency of the 2D image, and if so, how?

Consider the following code:

g=Graphics[{EdgeForm[{Black, Thick}],
{Green,Opacity[0.5],Rectangle[{0,0.5},{1,1}]},
Red, Polygon[{{0, 0}, {1, 0}, {1/2, Sqrt[3]/2}}],
White, Disk[{1/2, 1/(2Sqrt[3])}, 1/(2Sqrt[3])]},
Background->None];
Graphics3D[{{Texture[g],
Polygon[{{0,0,0},{0,1,0},{1,1,0},{1,0,0}},
VertexTextureCoordinates->{{0,0},{1,0},{1,1},{0,1}}]},
{Texture[g],
Polygon[{{0,0,1},{0,1,1},{1,1,1},{1,0,1}},
VertexTextureCoordinates->{{0,0},{1,0},{1,1},{0,1}}]}},
Lighting->{{"Ambient", White}},
ViewPoint->{1,4,7}]


This gives the following graphics:

As you can easily see, the part outside of the figures is opaque white, despite of the Background->None option. Also Background->RGBColor[1,1,1,0] didn't help, nor did passing the Graphics through Rasterize with the option Background->None

Here's roughly what I'd want to get (any inaccuracies are caused by my lacking GIMP-fu :-)):

Looking for a solution I found this code but couldn't get it work for my case. Also, if I understand it correctly, it doesn't derive the transparency from the graphics but just replaces a certain colour with fully transparent, which wouldn't work with the semi-transparent green rectangle.

Combining the 2D graphics with another one using Show does respect Background->None and Opacity on the green rectangle, so it's not a problem with the graphics itself.

Therefore my question: Is it possible to embed 2D graphics into 3D while keeping the transparency of the 2D image, and if so, how?

2 added image of what I'd like to get

Consider the following code:

g=Graphics[{EdgeForm[{Black, Thick}],
{Green,Opacity[0.5],Rectangle[{0,0.5},{1,1}]},
Red, Polygon[{{0, 0}, {1, 0}, {1/2, Sqrt[3]/2}}],
White, Disk[{1/2, 1/(2Sqrt[3])}, 1/(2Sqrt[3])]},
Background->None];
Graphics3D[{{Texture[g],
Polygon[{{0,0,0},{0,1,0},{1,1,0},{1,0,0}},
VertexTextureCoordinates->{{0,0},{1,0},{1,1},{0,1}}]},
{Texture[g],
Polygon[{{0,0,1},{0,1,1},{1,1,1},{1,0,1}},
VertexTextureCoordinates->{{0,0},{1,0},{1,1},{0,1}}]}},
Lighting->{{"Ambient", White}},
ViewPoint->{1,4,7}]


This gives the following graphics:

As you can easily see, the part outside of the figures is opaque white, despite of the Background->None option. Also Background->RGBColor[1,1,1,0] didn't help, nor did passing the Graphics through Rasterize with the option Background->None

Here's roughly what I'd want to get (any inaccuracies are caused by my lacking GIMP-fu :-)):

Looking for a solution I found this code but couldn't get it work for my case. Also, if I understand it correctly, it doesn't derive the transparency from the graphics but just replaces a certain colour with fully transparent, which wouldn't work with the semi-transparent green rectangle.

Combining the 2D graphics with another one using Show does respect Background->None and Opacity on the green rectangle, so it's not a problem with the graphics itself.

Therefore my question: Is it possible to embed 2D graphics into 3D while keeping the transparency of the 2D image, and if so, how?

Consider the following code:

g=Graphics[{EdgeForm[{Black, Thick}],
{Green,Opacity[0.5],Rectangle[{0,0.5},{1,1}]},
Red, Polygon[{{0, 0}, {1, 0}, {1/2, Sqrt[3]/2}}],
White, Disk[{1/2, 1/(2Sqrt[3])}, 1/(2Sqrt[3])]},
Background->None];
Graphics3D[{{Texture[g],
Polygon[{{0,0,0},{0,1,0},{1,1,0},{1,0,0}},
VertexTextureCoordinates->{{0,0},{1,0},{1,1},{0,1}}]},
{Texture[g],
Polygon[{{0,0,1},{0,1,1},{1,1,1},{1,0,1}},
VertexTextureCoordinates->{{0,0},{1,0},{1,1},{0,1}}]}},
Lighting->{{"Ambient", White}},
ViewPoint->{1,4,7}]


This gives the following graphics:

As you can easily see, the part outside of the figures is opaque white, despite of the Background->None option. Also Background->RGBColor[1,1,1,0] didn't help, nor did passing the Graphics through Rasterize with the option Background->None

Looking for a solution I found this code but couldn't get it work for my case. Also, if I understand it correctly, it doesn't derive the transparency from the graphics but just replaces a certain colour with fully transparent, which wouldn't work with the semi-transparent green rectangle.

Combining the 2D graphics with another one using Show does respect Background->None and Opacity on the green rectangle, so it's not a problem with the graphics itself.

Therefore my question: Is it possible to embed 2D graphics into 3D while keeping the transparency of the 2D image, and if so, how?

Consider the following code:

g=Graphics[{EdgeForm[{Black, Thick}],
{Green,Opacity[0.5],Rectangle[{0,0.5},{1,1}]},
Red, Polygon[{{0, 0}, {1, 0}, {1/2, Sqrt[3]/2}}],
White, Disk[{1/2, 1/(2Sqrt[3])}, 1/(2Sqrt[3])]},
Background->None];
Graphics3D[{{Texture[g],
Polygon[{{0,0,0},{0,1,0},{1,1,0},{1,0,0}},
VertexTextureCoordinates->{{0,0},{1,0},{1,1},{0,1}}]},
{Texture[g],
Polygon[{{0,0,1},{0,1,1},{1,1,1},{1,0,1}},
VertexTextureCoordinates->{{0,0},{1,0},{1,1},{0,1}}]}},
Lighting->{{"Ambient", White}},
ViewPoint->{1,4,7}]


This gives the following graphics:

As you can easily see, the part outside of the figures is opaque white, despite of the Background->None option. Also Background->RGBColor[1,1,1,0] didn't help, nor did passing the Graphics through Rasterize with the option Background->None

Here's roughly what I'd want to get (any inaccuracies are caused by my lacking GIMP-fu :-)):

Looking for a solution I found this code but couldn't get it work for my case. Also, if I understand it correctly, it doesn't derive the transparency from the graphics but just replaces a certain colour with fully transparent, which wouldn't work with the semi-transparent green rectangle.

Combining the 2D graphics with another one using Show does respect Background->None and Opacity on the green rectangle, so it's not a problem with the graphics itself.

Therefore my question: Is it possible to embed 2D graphics into 3D while keeping the transparency of the 2D image, and if so, how?

1

# How to get 2D graphics into 3D without background?

Consider the following code:

g=Graphics[{EdgeForm[{Black, Thick}],
{Green,Opacity[0.5],Rectangle[{0,0.5},{1,1}]},
Red, Polygon[{{0, 0}, {1, 0}, {1/2, Sqrt[3]/2}}],
White, Disk[{1/2, 1/(2Sqrt[3])}, 1/(2Sqrt[3])]},
Background->None];
Graphics3D[{{Texture[g],
Polygon[{{0,0,0},{0,1,0},{1,1,0},{1,0,0}},
VertexTextureCoordinates->{{0,0},{1,0},{1,1},{0,1}}]},
{Texture[g],
Polygon[{{0,0,1},{0,1,1},{1,1,1},{1,0,1}},
VertexTextureCoordinates->{{0,0},{1,0},{1,1},{0,1}}]}},
Lighting->{{"Ambient", White}},
ViewPoint->{1,4,7}]


This gives the following graphics:

As you can easily see, the part outside of the figures is opaque white, despite of the Background->None option. Also Background->RGBColor[1,1,1,0] didn't help, nor did passing the Graphics through Rasterize with the option Background->None

Looking for a solution I found this code but couldn't get it work for my case. Also, if I understand it correctly, it doesn't derive the transparency from the graphics but just replaces a certain colour with fully transparent, which wouldn't work with the semi-transparent green rectangle.

Combining the 2D graphics with another one using Show does respect Background->None and Opacity on the green rectangle, so it's not a problem with the graphics itself.

Therefore my question: Is it possible to embed 2D graphics into 3D while keeping the transparency of the 2D image, and if so, how?