viewing source for "README"
last commit
commit 9eac72393135c49d4d4adcb74bc12968ad2647c3
Date: Mon Jan 14 06:49:57 2008 -0800
source code
01: # crt - the C raytracer #
02:
03: Raytracing is just one technique used in generating realistic images using a
04: computer. In the real world, what we see is a direct result of light photons
05: being emitted from a source (such as the sun, a light bulb, etc), bouncing off
06: objects, and eventually being collected by our eyes. As simple as this is, it's
07: still a lot of work for a computer to do.
08:
09: This is because many of the photons aren't actually percieved by us. Raytracing
10: greatly simplifies the way lighting works by viewing light in the opposition
11: direction. Instead of tracing photons from the sources, we trace a ray from our
12: eye through the scene. This means we only calculate the rays of light that
13: matter to us.
14:
15: The raytracing algorithm itself is relatively simple. For each pixel in the
16: image, we trace a ray through that pixel and into the scene. We then check for
17: an intersection with any of the objects in the scene. If the ray hits nothing,
18: then that pixel becomes black. If the ray does intersect an object, that pixel
19: becomes that objects color.
20:
21: After that, the pixel's color can be modified based on various other algorithms,
22: such as lighting algorithms, reflections, etc. Reflections can easily be
23: calculated by using the ray tracing algorithm recursively. Essentially, the
24: reflective object becomes the "eye", and the scene is re-traced from that view
25: point.
26:
27: ## scene files ##
28:
29: crt uses a modular scene input scheme to allow scenes to be loaded from a
30: variety of sources. Currently crt uses an XML plugin to load scene definition
31: files from an XML file. An example of an object's XML:
32:
33: <sphere x="1.0" y="2.0" z="0.0" radius="1.0">
34: <material r="1.0" g="0.0" b="0.0" diffuse="1.0" />
35: </sphere>
36:
37: ## image output ##
38:
39: Again, crt uses a modular image output scheme to write images. Currently crt
40: supports writing directly to a bitmap image.
41:
42: ## features ##
43:
44: Currently crt features the following:
45:
46: * 3 different shapes: spheres, axis-aligned boxes, and planes
47: * Point and Area light sources
48: * Shadows
49: * Anti-Aliasing
50: * Reflections
51: * Refractions
52:
53: ## generated images ##
54:
55: <div class="image">
56: <img alt="scene1" src="/code/crt/images/scene1.png" />
57: <div class="image_footer">Scene 1 (<a href="/code/crt/images/scene1_1920x1200.png">1920x1200</a>)</div>
58: </div>
59:
60: <div class="image">
61: <img alt="scene2" src="/code/crt/images/scene2.png" />
62: <div class="image_footer">Scene 2 (<a href="/code/crt/images/scene2_1920x1200.png">1920x1200</a>)</div>
63: </div>
64:
65: <div class="image">
66: <img alt="scene3" src="/code/crt/images/scene3.png" />
67: <div class="image_footer">Scene 3 (<a href="/code/crt/images/scene3_1920x1200.png">1920x1200</a>)</div>
68: </div>
69:
70: ## GIT ##
71:
72: You can checkout a bleeding-edge version of crt with git using the following
73: command:
74:
75: git clone http://voidsplat.org/code/crt/crt.git