Graphics Reference
In-Depth Information
with
1
d
dz
=
2
2
dxxr dd
,
=
+
,
β
=
1
arcsin
x
x
c
x
y
x
ρ
2
2
+
x
d
1
y
d
= ′
yyyzr
,
=
2
r
2
,
β
=
1
arcsin
y
c
max
y
ρ
dz
2
+
2
y
Implement the spherical transformation and apply it to a grid image and
to a natural image. A good value for the refraction index is η = 1.8.
The next few exercises ask you to examine some operations on pairs of images
and see the results.
12. The screen operation is similar to the multiply operation, but you take the
complement of each pixel's color components, multiply the components
together, and take the complement of the result. Implement this opera-
tion. The result will be lighter than either original; explain why. As we
did in the multiply example in the text, use a luminance computation to
balance the screen operation results with the originals.
13. The difference, between two images is defined by the absolute value of the
color difference between the images' pixels. Implement this image opera-
tion.
14. Negation and exclusion are similar to difference, but treat the colors some-
what differently. For the negation operation, the color target is
vec3 target = vec3(1.,1.,1.) - abs(1. - argb - brgb );
while for the exclusion operation, the color target is
vec3 target = argb + brgb - 2.0 * argb * brgb;
Implement both the negation and the exclusion operations. The target for
the negation operation is automatically in the legal range for color, but
the target for exclusion may not be; you will probably want to clamp it
to [0., 1.].
15. Color burn and dodge are two other related operations. The color burn
operation is given by
vec3 target = vec3(1.,1.,1.) - (1.-argb)/brgb;
Since you are dividing by the value of color components that are no larger
than one, you may get results greater than one, so you may need to clamp
this result to [0., 1.]:
vec3 result = clamp( target, 0., 1. );
 
Search WWH ::




Custom Search