How transparent can we go? Let's try to make a part of the monkey sphere disappear:
Back in
TexturesOpaqueTransparent.java
, add the following lines beforesphereGeo.setMaterial()
:sphereMat.getAdditionalRenderState().setAlphaTest(true); sphereMat.getAdditionalRenderState().setAlphaFallOff(0.5f); sphereGeo.setQueueBucket(Bucket.Transparent);
Run the code. The monkey sphere is partially gone!
A semitransparent material (such as the stained-glass window) lets you see through, but the geometry is still there—its color simply blends with what is behind it. For a stained-glass window, a slab of ice, or a bottle, this is just what you want.
Fully transparent materials, however, make part of their geometry disappear. Fully transparent textures are commonly used for foliage, flowers, or hair textures.
The background of Monkey.png
has an alpha channel of zero; this is why the background disappeared when you used it as DiffuseMap
and activated the...