1
$\begingroup$

This question already has an answer here:

I have the following image with transparency:

enter image description here which I want to paste repeatedly into a 3D space to make it like a tube, something like this (but denser):

Tube Test

I tried using the code from here but it tells me that "Image is not a Graphics3D primitive or directive", and although the code from the question works, it has the same problem as in the question, it is not transparent.

So what should I use to make the transparency render? Or is there a better approach to my problem?

This is the slightly edited code I used:

g = Import["C:\Users\Eric\Desktop\Tube.png"];
Graphics3D[
Table[{{Texture[g], 
Polygon[{{0, 0, z}, {0, 1, z}, {1, 1, z}, {1, 0, z}}, 
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 
1}}]}}, {z, 0, 1, 1/3}], Lighting -> {{"Ambient", White}}, 
ViewPoint -> {1, 4, 7}]

Edit: I need this to work on 8.0, although Image3D works it is not implemented there, what can I do then?

$\endgroup$

marked as duplicate by Jens, Karsten 7., Sjoerd C. de Vries, bbgodfrey, Michael E2 Apr 16 '15 at 12:12

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.

  • 1
    $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$ – bbgodfrey Apr 12 '15 at 18:54
  • 1
    $\begingroup$ Your question is unclear. What do you mean "paste repeatedly into a 3D space to make it like a tube"? Edit your question to include the code that you have written, even though it does not fully meet your need. $\endgroup$ – bbgodfrey Apr 12 '15 at 18:58
  • $\begingroup$ @bbgodfrey Done. $\endgroup$ – Anonymous Pi Apr 12 '15 at 19:16
  • 1
    $\begingroup$ It would be a good idea to include the Tube.png image in the question $\endgroup$ – Simon Woods Apr 12 '15 at 19:17
  • $\begingroup$ @SimonWoods Thanks for the suggestion, also done! $\endgroup$ – Anonymous Pi Apr 12 '15 at 19:20
4
$\begingroup$

A simple approach:

i = Import["http://i.stack.imgur.com/Jzimv.png"];  
i = ImageResize[i, 200];    

Image3D[Table[i, {200}]]

enter image description here

If it's just for display, there is no need to create multiple copies of the image - just make a 3D image one pixel deep and use BoxRatios to stretch it vertically:

Image3D[{i}, BoxRatios -> {1, 1, 1}]
$\endgroup$
  • $\begingroup$ Thanks! I think it works, but sadly I am stuck in 8.0 and Image3D was introduced in 9.0. Is there a similar function I can use? $\endgroup$ – Anonymous Pi Apr 12 '15 at 20:18
  • $\begingroup$ @AnonymousPi, AFAIK there is nothing similar to Image3D in version 8, so you will need to use Graphics3D in some way. I suggest you edit the question to state that you need a version 8 solution, and unaccept this answer (questions without an accepted answer tend to get more views) $\endgroup$ – Simon Woods Apr 13 '15 at 17:32

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