In contrast, image rendering works from a computer model of a scene, and produces a picture without the "real world" being involved at all.
Before we look at these two fields in more detail, lets look at what we mean by a computer image.
Each dot can be arranged on a 2-d grid:
Using the grid, each dot has a particular row and column coordinate. In Pascal, we could represent a small 40 x 40 picture as the array:
bw_pict: array[ 1..40, 1..40 ] of boolean;A boolean is a value that is either true or false. Since each dot in the picture is either black or white, we can use 'true' to mean 'Black' and 'false' to mean 'White' (or vice-versa; all that matters is that we are consistent). This is sometimes called a bit of information.
If we wanted a colour picture, we would need to more information in each dot. How much more information? Well, two booleans would give us 4 colours (we could code the colours as true-true, true-false, false-true and false-false). If we used three booleans, we could have 8 colours, etc. Eight booleans is a popular number (so popular is is universally known as a byte). This allows 256 colours. Another popular choice is 16 bits (=2 bytes), giving a choice of 65,536 colours. And if that's not enough, you can go for 3 bytes (=24 bits) with over 16 million colours. We could represent these colourful arrays in Pascal in a number of ways; here are some examples:
col16: array[ 1..40, 1..40 ] of (0..3); col256a: array[ 1..40, 1..40 ] of (0..255); col256b: array[ 1..40, 1..40 ] of char; {-- equivalent to col256a } col64k: array[ 1..40, 1..40 ] of integer; millions: array[ 1..40, 1..40 ] of (0..16777215);Now, pause for a minute and ask yourself: "But what are the colours"? This is a good question to ask. It shows you are thinking. You see, there are no colours inside the computer. Colours only come into it when we display the picture on a monitor, or print it on a colour printer. These output devices have their own interpretation of what values correspond to what colour. Thus, a number '205' might correspond to the colour 'red', '409' for 'blue', etc.
Ray tracing is a technique used to produce high-quality pictures from a
computer model of a scene. The basic idea is an extension of
The idea is to cast a ray from the "camera" through the view plane (ie,
following in reverse a ray of light from the final picture to the eye)
and testing the scene objects to see what object the ray strikes. A
simple test is then made to check that the object is not in a shadow at
that point.
The ray casting is repeated for each ray that passes from the camera
through a pixel in the viewing screen. For a 400 x 400 picture, this
will require 160,000 individual rays.
Ray casting is a very simple technique, but it cannot cope with
reflections from other shiny objects. The only parts of an object
deemed to be lit are those directly illuminated.
Ray tracing produces much more realistic images by allowing
secondary rays to be spawned when a ray intersects a reflective
or transparent object.
Since each ray can spawn one or more new rays, ray tracing involves much
more work than ray casting. It is not unusual for ray tracing to
require several million rays.
Issues