1
$\begingroup$

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$
6
  • 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
    Commented Apr 12, 2015 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
    Commented Apr 12, 2015 at 18:58
  • $\begingroup$ @bbgodfrey Done. $\endgroup$ Commented Apr 12, 2015 at 19:16
  • 1
    $\begingroup$ It would be a good idea to include the Tube.png image in the question $\endgroup$ Commented Apr 12, 2015 at 19:17
  • $\begingroup$ @SimonWoods Thanks for the suggestion, also done! $\endgroup$ Commented Apr 12, 2015 at 19:20

1 Answer 1

4
$\begingroup$

A simple approach:

i = Import["https://i.sstatic.net/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$
2
  • $\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$ Commented Apr 12, 2015 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$ Commented Apr 13, 2015 at 17:32

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