Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6911 > unrolled thread
| Started by | Patrick Scheibe <pscheibe@trm.uni-leipzig.de> |
|---|---|
| First post | 2011-12-03 09:18 +0000 |
| Last post | 2011-12-03 09:18 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Transparent textures from images Patrick Scheibe <pscheibe@trm.uni-leipzig.de> - 2011-12-03 09:18 +0000
| From | Patrick Scheibe <pscheibe@trm.uni-leipzig.de> |
|---|---|
| Date | 2011-12-03 09:18 +0000 |
| Subject | Transparent textures from images |
| Message-ID | <jbcpgd$bjj$1@smc.vnet.net> |
Hi,
I sent this already to Wolfram, but maybe someone wants to try this on a
windows machine.
Starting from an image with alpha-channel
data = Table[{Sin[x], Sin[y], 1, Sin[x y]}, {y, 0, 2 Pi,
2 Pi/127.}, {x, 0, 2 Pi, 2 Pi/127.}];
img = Image[data, ColorSpace -> "RGB"]
AlphaChannel[img]
When I use this now as texture on a cube, I expect the walls to be
transparent according to the alpha-channel
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}}};
Graphics3D[{Texture[img],
Polygon[coords, VertexTextureCoordinates -> Table[vtc, {6}]]},
Boxed -> False]
This does not work here. I get a cube with a white painting where it
should be transparent. Using the pure {r,g,b,a} data I get the right
result:
Graphics3D[{Texture[data],
Polygon[coords, VertexTextureCoordinates -> Table[vtc, {6}]]},
Boxed -> False]
Can someone check this or give me a hint which part I understood wrong?
Cheers
Patrick
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web