1
$\begingroup$

This question already has an answer here:

A simplified specification of what I am trying to accomplish would be to construct a cube each face with a different color and each face having a text label that can be seen only when viewing from the front direction of the face (I do not want the labels on the back and side faces to show through the cube.) I also want the labels to be in the plane of the face and to remain in the plane of the face as I rotate the cube.

$\endgroup$

marked as duplicate by Artes, Sjoerd C. de Vries, m_goldberg, Jens, rm -rf Jul 16 '13 at 3:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3
$\begingroup$
Graphics3D[
 GraphicsComplex[
  Tuples[{0, 1}, 3],
   MapThread[
    {Texture[
       Graphics[ImportString[ExportString[#1, "PDF"], "PDF"][[1, 1]], Background -> #3]],
     Polygon[#2, VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]} &,
    {Characters["ABCDEF"],
     {{1, 2, 4, 3}, {1, 5, 6, 2}, {1, 3, 7, 5}, {8, 6, 5, 7}, {8, 7, 
       3, 4}, {8, 4, 2, 6}},
     Table[Hue[i/6], {i, 6}]}
    ]
   ],
 Lighting -> "Neutral"]

Mathematica graphics

Note that this extracts a FilledCurve from the list of Graphics returned by ImportString (see also this question):

ImportString[ExportString[#1, "PDF"], "PDF"][[1, 1]]
$\endgroup$
  • $\begingroup$ +1 Very clean. The use to which Tuples was put was especially clever! $\endgroup$ – DavidC Jul 14 '13 at 6:44
0
$\begingroup$
vtc    =  {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
coords = {{{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}}, 
          {{0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {0, 0, 1}}, 
          {{1, 0, 0}, {1, 1, 0}, {1, 1, 1}, {1, 0, 1}}, 
          {{1, 1, 0}, {0, 1, 0}, {0, 1, 1}, {1, 1, 1}}, 
          {{0, 1, 0}, {0, 0, 0}, {0, 0, 1}, {0, 1, 1}}, 
          {{0, 0, 1}, {1, 0, 1}, {1, 1, 1}, {0, 1, 1}}};

tt = Table[Texture@Image[Rasterize@Style[RandomInteger@10, 30]], {i, 6}];
Graphics3D[Table[{tt[[i]], Polygon[coords[[i]],
           VertexTextureCoordinates -> vtc]}, {i, 6}]]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Thank you for the example. As posted vtc is not defined, but I am beginning to get the idea anyway. $\endgroup$ – Ron Burns Jul 14 '13 at 4:57
  • $\begingroup$ @RonBurns Sorry, I forgot to paste it. Corrected $\endgroup$ – Dr. belisarius Jul 14 '13 at 5:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.