In 3d programming there are several different types of blending and
transparency which you can use, all with different effects and all with
different strengths and weaknesses.
Using the alpha channel as a mask is the most efficient since this is done
during rasterization and is a simple test which compares the alpha value of
the pixel against a threashhold and then either writes it or doesn't write
it. Because of this binary operation there is no *blending*, but the
adventages is that the order of rendering is insignificant since the zbuffer
is used to handle depth collisions. To do that in java3d, just use the
RenderingAttributes alpha test function. For example if you are loading a
GIF texture you can set the function to NOTEQUAL and use the default
threshhold of 0. This will render only the unmasked portions of the object.
Remember that vertex colors, materials, modulations and texture units can
all effect the alpha channel, and its the ultimate combination of these that
will control the alpha test.

To *blend* a polygon with the background, you need to use transparency
attributes. This lets you define the method by which polygons are blended
(function). Its also lets you define an overall transparency modifier, like
rendering your shape at x percent transparent. Transparency blending is the
nicest loooking, even for masking since texture magnification will
interpolate the fringe of your masked shape from fully transparent to fully
opaque. Problem is that you have to render your transparent polygons from
front to back, and break down any self-intersecting polygons into
non-intersecting pieces. This is a performance hit and extremely difficult
to do in Java3d.  There are two functions which define how the blending is
going to occur, the source function and the dest function.  These functions
operate on the alpha component of the source pixel and the dest pixel
respectively.  Remember the alpha component of the source pixel is
calculated as part of the process of rasterization and it would be a mistake
to think of it as the alpha component of your texture, or the vertex alpha.
By modifying your source and dest functions, you can achieve different kinds
of effects.  For example particle systems often use a blending method which
causes overlapping alpha objects to become brighter, while vegetation
usually would not use that blending method.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to