Graphics Reference
In-Depth Information
Figure 16.29. Three examples of images generated by the Circle 2 algorithm, with uSIDE = .875 (left),
uSIDE = 1.00 (middle), and uSIDE = 1.08 (right).
float t = dot( xy, xy );
int c = int( t );
if ( (c % 2) != 0 ) discard;
t = float( c%360 )/359.;
vec3 myColor = GetColor( t );
fFragColor = vec4( myColor, 1.);
}
Some sample images from this shader are shown in Figures 16.29 and
16.30. Figure 16.29 shows three views with the algorithm above and three dif-
ferent values of uSIDE , showing how much this small change affects the images.
(When you try this for yourself, you may find different results for these values
of uSIDE ; the algorithm is sensitive to the resolution of your
image. These were done for a 1200 × 1200 image.) Note the
very subtle rainbow circles with center at the lower left of
the image with uSIDE = .875 and the very strong Moiré circles
in the image with uSIDE = 1.08. These secondary effects are
common in the images and make them more interesting.
In Figure 16.30, we look at an image that uses the object-
side coordinates, and in order to increase the brightness and
the effect of this image, we did not use the pixel-discard
logic. Since we are working on the object side rather than the
screen side, we can manipulate the object; in this case, we
rotated the quad a bit so that we are geting an oblique view
of the quad instead of a straight-on view. This makes a strik-
ing difference in the image, as you can see.
Figure 16.30. The Circle 2 algorithm
used on the object side, viewed
obliquely, with uSIDE = 1.00.
Search WWH ::




Custom Search