Re: Translucent polygons [message #41146] |
Wed, 29 September 2004 10:11 |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
dteira wrote:
> Hello, I'm trying to draw 2 superposed polygons but I want to see the one
> in the back. I think I'm trying to make a traslucent polygon. Is this
> possible in IDL 5.6?.
Yes you can, in object graphics. It has been covered here many times
before in one way or another so you'll want to google this group for
more info.
In short you texture map your polygons with a 4 channel texture image:
R,G,B,A. The A is the alpha channel which denotes the transparency of
each pixel. 0 is clear, 255 is opaque. Note that you need to ensure
that your objects are drawn back to front.
Without getting into the details, say you have two planar polygons, one
near (translucent) and one far (opaque):
If you draw the near polygon first, IDL checks what is behind it which
at this point is just the background, and the polygon is rendered as a
mix of the polygon color and the background color. When the far polygon
is drawn, it is drawn behind the near polygon. Looking at the scene,
you see the near polygon is translucent, but it is a mix of the near
polygon color and the background. Not a mix of the near and far polygon
colors you would expect.
Reverse the drawing order. Draw the far polygon. Then draw then near.
When IDL draws the near, it checks what is behind it (the far polygon)
and draws the near polygon as a mix of the near and far polygon colors.
Just what you expected.
You'll want to check out the docs for IDLgrPolygon, especially the
TEXTURE_MAP and TEXTURE_COORD keywords.
-Rick
|
|
|