comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: semi-transparent IDLgrPolygon? alpha blending no good...
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: semi-transparent IDLgrPolygon? alpha blending no good... [message #30450 is a reply to message #30439] Tue, 23 April 2002 10:06 Go to previous messageGo to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
As David pointed out, you need to be aware of the order in which atoms are
added to your model when rendering scenes with alpha blending.


To put it simply, when IDL renders a transparent atom it calculates the
color of the atom's surface as a function of it's own color, your alpha
value, and the color of objects behind it. Much to my disappointment, atoms
in a scene aren't rendered magically all at once but are rendered in the
order that they are added to your model hierarchy. So in your case, if a
transparent atom is rendered before anything else in the scene it appears
"transparent to ITSELF". Adding the transparent cylinder after all of the
other atoms as David did corrects the problem by rendering the atoms that
appear behind the transparent cylinder first.


Of further note, the order that the transparent atom is meshed will affect
what you see as well. In your example program (with the correct ordering of
atoms in the model) the initial orientation of the model results in the
expected image. You see the back surface of the cylinder thru the front.
If you rotate the object 180 degrees about the Y axis, you will note that
you no longer see the back surface thru the front. This is due to the fact
that your cylinder is meshed from -Z to +Z and with the initial view when
the front of the cylinder is drawn, the back surface exists and the color of
the front surface reflects this. But, when you view your cylinder from
behind, the front surface is drawn before the back and you no longer see the
back thru the front.

This may not be an issue for you, but the solution is to break up your
transparent atom into a -Z to 0 and 0 to +Z pair and then manage their order
in your model (use mesh_clip and IDLgrModel's Move method). As long as you
know where the viewer's eye is, you can make sure the back is drawn before
the front.


-Rick


"Sean Dettrick" <dettrick@uci.edu> wrote in message
news:3CC5191F.F0951184@uci.edu...
>
> (apologies for the attachment)
>
> Hi,
>
> Does anyone have a way to make semi-transparent polygon
> objects with IDLgrPolygon?
>
> I would like to use IDL's fancy object graphics, but in my
> attempts so far, alpha blending using a monochrome image only
> makes a polygon object transparent to ITSELF, not to other
> objects. This is pretty useless.
>
> Here is my example code, where I have rearranged
> David Fanning's object_shade_surface.pro (thanks DF)
> to instead plot up four cyclindrical IDLgrPolygon objects.
> You can run it with:
> IDL> .r cylinder3
>
> I would like the red cylinder to be semi-transparent, so
> that I can see the black cylinder through it.
>
> I am away of Struan Gray's direct graphics tutorial,
> and guess one could do something similar with defining
> a z-buffer in the view object, but it is way above my head.
>
> Any assistance/pointers greatly appreciated.
>
> Thanks v much,
>
> Sean Dettrick,
> Physics Dept,
> University of California, Irvine
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Art and all that Jazz: we converse the weird fig
Next Topic: PPM image from IDLgrBuffer: top-bottom order

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 22:16:35 PDT 2025

Total time taken to generate the page: 0.16152 seconds