I want to draw a cube with a specific opacity and an Image placed inside it. My plan was to use those cubes as building blocks of a 3 dimensional representation of a 3 rank tensor ( more or less like this http://staff.itee.uq.edu.au/janetw/cmc/chapters/Hebbian/ten3.gif).

I can easily draw the cubes in the right spots but placing the images inside them is beyond my ability. how can I achieve the result I want?

  • $\begingroup$ There was a useful question about placing text in fixed positions in 3d in a non-rotating manner, and taking into account the distance from the observer, but I cannot find it :( $\endgroup$
    – corey979
    Commented Nov 6, 2016 at 9:46
  • $\begingroup$ damn :-(. if i could insert a plane in the cuboid and draw the 2d image on that plane i could use this trick to solve the problem $\endgroup$
    – Alucard
    Commented Nov 6, 2016 at 14:38
  • $\begingroup$ Why not to use something like Graphics3D[Cuboid /@ Position[BoxMatrix[All, {5, 5, 5}], 1]]? Do you really need Raster? $\endgroup$ Commented Nov 7, 2016 at 21:02
  • $\begingroup$ well i need to place numbers on the boxes and make them transparent otherwise i can't see the numbers in the central part of the cube $\endgroup$
    – Alucard
    Commented Nov 7, 2016 at 23:09

1 Answer 1


Try to use something like this:

g1 = Graphics3D[{Opacity[0.02], 
    Map[Cuboid, Position[BoxMatrix[All, {5, 5, 5}], 1]]}];
pos1 = Position[BoxMatrix[All, {5, 5, 5}], 1];
pos2 = ({0, .75, .25} + #) & /@ pos1;
g2 = Graphics3D[{Text["A", #] & /@ pos2}];
Show[{g1, g2}]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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