|
|||||||||||||||
| Ray
Tracing
Ray Tracing is a more time-consuming, but more accurate method of rendering scenes, that doesn't require that objects be built out of polygons. So a sphere can actually be 'modelled' and rendered as a sphere, not just a bunch of triangles approximating a sphere. The ray tracing process also solves the hidden surface removal problem automatically, without it needing to perform an extra step. OpenGL - Blending Chapter 10.3 (pages 543 - 549). Blending allows you to draw a partially transparent image over another image. This is done by adding a fourth component to colour values, an alpha value. The alpha value specifies the opacity of the pixel/object to be drawn, with 0 being completely transparent, and 1 being completely opaque. A weighted average is then found of the source and destination pixels where D = aS + (1-a)D. a = alpha, D = Destination, S = Source. (The source is the "incoming primitive" and the destination is that which is already in the frame buffer. The alpha value can be varied for different pixels. To use blending in OpenGL, you need to do three things:
For the blend mode, you define the source and destination scaling factors. The most common (and useful) is perhaps to use: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); This sets OpenGL to do blending based on the function above - D = aS
+ (1-a)D.
|
|
||||||||||||||