1

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?

Anonymous Pi
  • 111
  • 5

1 Answers1

4

A simple approach:

i = Import["https://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}]
Simon Woods
  • 84,945
  • 8
  • 175
  • 324
  • 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? – Anonymous Pi Apr 12 '15 at 20:18
  • @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) – Simon Woods Apr 13 '15 at 17:32