COLORSPACE TOOL

I mentioned this tool in Chapter 2. I've included it so that you can play around with it and see how you can get some unexpected results when adding colors. ColorSpace lets you interactively add two colors together and see the effets of the vaious strategies for handling oversaturated colors. Figure 6.6 shows a yellow and a bright red. Since the color that you get when you add these two colors together has a red value of 510, it's impossible to display this color either on a color monitor or in a shader.

click to expand
Figure 6.6: ColorSpace lets you see the effects of clamping vs. clipping vs. scaling when two colors oversaturate.

A shader will automatically clamp the color for you, which can dramatically alter the color. Other alternatives are to multiply all the rgb values by a scale factor so that they all fit in the color range—this has the effect of darkening the color. The other step is to clip the color—that is, maintain the brightness by proportionately taking away some of the oversaturated color and giving it to the unsaturated color. The three button colors show you the results of the different strategies for handling oversaturated colors.



Real-Time Shader Programming(c) Covering Directx 9. 0
Real-Time Shader Programming (The Morgan Kaufmann Series in Computer Graphics)
ISBN: 1558608532
EAN: 2147483647
Year: 2005
Pages: 104
Authors: Ron Fosner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net