IBMTextureGradientsInterpolation
IBMTextureGradientsInterpolation.mp4
Description
This test case demonstrates texturing effects that can produce gradients. For example a simple 2 pixel texture will
be rendered as a gradient going from the one pixel color to the other over the geometry being textured. Note, that
while this is the usual expected behavior some players may not interpolate the colors resulting in half the geometry
in one color and half in the other (pixel replication for scaling versus interpolation).
There are three rectangular shapes that are visible in the scene:
-
The upper rectangle shape has a color of Blue and is textured with a gray scale 2x1 PixtureTexture having a
value 255 in the pixel on the left and 64 in the pixel on the right. The gray texture pixels act as a
multiplier for the rectangles color, so once the PixelTexture is scaled to fit the rectangle we have values
from 255 down to 64 as a gradient. The net result is that the image is brighter on the left and gets darker
as you go to the right.
-
The middle rectangular shape is actually two rectangles, one on top of the other. The rectangle underneath is
a solid blue color, the one on top has an RGBA 2x1 PixelTexture with a fully transparent pixel on the left and
opaque green on the right. So the rectangle on top ends up being a gradient that goes from completely
transparent on the left progressively to solid green on the right. The net perceived result for the middle
rectangle is a gradient that goes from blue to green.
-
The lower rectangular shape is also two rectangles, one on top of the other. Like the middle one the
rectangle underneath is a solid blue color, the one on top has an Gray + Alpha 2x1 PixelTexture with a fully
transparent pixel on the left and opaque 255 on the right. So the rectangle on top ends up being a gradient
that goes from completely transparent on the left progressively to the solid color of the rectangle on top on
the right. The net perceived result for the lower rectangle is a gradient that goes from blue to yellow,
yellow being the initial color of the one on top.
At t=2.0s ColorInterpolators are started which changes colors for most of the rectangles. One
ColorInterpolator drives the upper rectangle's, the middle underneath rectangle's and the lower underneath
rectangle's colors all of which start out as solid blue. The second ColorInterpolator drives the lower top
rectangle's color (the one with gray+alpha PixelTexture). So the result of the interpolation is that:
-
The upper rectangle takes on different colored gradients as the gray texture acts as an intensity
modulator.
-
The middle rectangular shape appears to change colored gradients but always ending up in green on the right.
When the color is also green on the left, i.e, the rectangle underneath has had its color change to green,
then of course no gradient is perceived.
-
The lower rectangular shape appears to change colored gradients at both ends as it uses a combination of
techniques from the upper and middle rectangle.
All shapes should have the same color at all times on the left end since that is all driven via the first
ColorInterpolator. Its only the lower right hand side that ends up with different colors from the second
interpolator.
Note: a static color gradient can be simply done with two solid colors rather than using two rectangles one
on top of the other with transparency. See
IBMTextureGradientsSpinning for such examples.
Screenshot
Snapshot taken before interpolation which commences at t=2s.
Snapshot taken during interpolation.
Back to main index