Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7011
| From | Barrie Stokes <Barrie.Stokes@newcastle.edu.au> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Transparent textures from images |
| Date | 2011-12-08 10:26 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jbq3d4$ij7$1@smc.vnet.net> (permalink) |
| References | <201112060812.DAA18391@smc.vnet.net> |
Hi Patrick, hi John
Intrigued by the results of John's fix, I played around a little with features I've never used.
Using some code form the Help for Texture[], I was delighted to come up with:
rose = Import[ "ExampleData/rose.gif" ];
roses = GraphicsGrid[ Table[ rose, {15}, {15} ] ];
ParametricPlot3D[ {1.16^v Cos[ v ] (1 + Cos[ u ]), -1.16^v Sin[
v ] (1 + Cos[ u ]), -2 1.16^v (1 + Sin[ u ])}, {u, 0,
2 Pi}, {v, -15, 6},
PlotStyle ->
Directive[ Specularity[ White, 30 ],
Texture[ ImageData[ roses ] ] ],
TextureCoordinateFunction -> ({#4, 2 #5} &), Lighting -> "Neutral",
Mesh -> None, PlotRange -> All, Boxed -> False, Axes -> False,
PlotPoints -> 50 ]
Beautiful, I think.
Barrie
>>> On 06/12/2011 at 7:12 pm, in message <201112060812.DAA18391@smc.vnet.net>, John
Fultz <jfultz@wolfram.com> wrote:
> Patrick,
>
> This is a bug in Mathematica. But, fortunately, it's a very easy bug to
> work
> around. Replace:
>
> Texture[img]
>
> with
>
> Texture[ImageData[img]]
>
> Sincerely,
>
> John Fultz
> jfultz@wolfram.com
> User Interface Group
> Wolfram Research, Inc.
>
>
> On Sat, 3 Dec 2011 04:14:01 -0500 (EST), Patrick Scheibe wrote:
>> 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 comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Transparent textures from images Barrie Stokes <Barrie.Stokes@newcastle.edu.au> - 2011-12-08 10:26 +0000 Re: Transparent textures from images JUN <noeckel@gmail.com> - 2011-12-24 12:08 +0000
csiph-web