[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: texture map irregularities OR pimento problems

The order in which the polygons are drawn is extremely important when using
alpha blending.

In the first case:

1) The red orb is drawn first without alpha blending.  So far, so good.

2) The green orb is then drawn with alpha blending.  You don't know
which polygons in the green orb draw first.  What is happening is that the
(pos z) part of the orb is drawing first.  This is the transparent part, and
after we draw
this part, we see the red orb and parts of the background, as we expect.

Now drawing these transparent
polygons also sets the Z buffer in this part of the screen.  So, as we draw
the rest of
the green orb, the bottom or -Z part, the Z buffer test fails and these
polys do not
draw.  The part of the screen where the transparent polys are does not
change, and
you end up seeing background and red orb where you instead
wanted to see the inside of the green orb.

In the second case:

- The transparent part of the green orb is drawn last, because you moved it
+z to -z, in terms of the orb coords.  (Assuming that you've spun it around
180 in xobjview)
So, the side opposite the transparent "hole" draws first since it is in the
part of the orb.  This parts makes it onto the screen and then the
transparent polygons are drawn on top, letting you see the inside.

Hope this helps.  The general point is that you really have to be very
careful in
layering primitives when drawing with alpha.  The layering may need to take
into account the viewing angle and the geometry of the primitives.

For example, in this case, you may have to rotate the orb so that it always
back-to-front and move the transparent part so that it is always "in front",
respect to the viewing direction.


"Rick Towler" <rtowler@u.washington.edu> wrote in message
> I have been experimenting using the alpha channel to represent confidence
> a data set.  I produce a polygon object representing the data and then
> texture map the polygon accordingly.  But, I have run into an issue that I
> can't resolve.
> I have attached a simple example (requires at least IDL 5 something and 24
> bit display).  I create 2 orb objects, one green (the olive) and one red
> (the pimento).
> At first I place the olive in front of the pimento, then I make the near
> surface of the olive transparent.  Rendering in hardware for the most part
> works except between the last opaque vertices and the first transparent
> vertices I get a white (background color) ring where you can actually see
> thru the entire olive to the pimento behind it.  If your imagination is
> failing I'll remind you that we are just supposed to be looking into the
> inside of the olive, we shouldn't actually see the pimento thru the olive.
> Rendering in software, things get even more wacky.  I don't see the inside
> of my olive at all.  Xray vision I guess.  What is interesting to note is
> that this ring I get when rendering in hardware renders just like the all
> the transparent vertices in software.
> I then flip the pimento and the hole in my olive.  The pimento now is in
> front of the olive and the "hole" is created on the back side of the green
> orb.  Now when I rotate the olive around so I can see in my hole, things
> look pretty good.  The astute observer will notice that the ring is still
> there (you will see a little red pimple if viewed from the right angle)
> otherwise things look good.  In software mode, things seem to work.
> What is going on in the first case?  Why does software rendering fail to
> render the inside of the olive?  What am I missing?
> I would be happy to provide images upon request.
> -Rick Towler