====== Description ======
FART was my semester project for the Computer Science 658 class at Grand Valley State University. My goal is for FART to be a distributed, object-oriented raytracer. The name is a [[wp>Recursive_acronym|recursive acronym]] taking inspiration from [[http://lame.sourceforge.net/about.php|LAME]]. It stands for Fart Ain't a RayTracer.
FART takes as input a scene-description file in an ASCII-based, hierarchical input file format. After the scene file is parsed, it will be raytraced (rendered) according to the render options. Some of these options can be specified on the command line and others can be specified in the scene description file. When a given option can be specified both places, the command-line options will override what is in the scene file.
Rendering can be done using the built-in distributed algorithm. Command-line options will be utilized to specify a "host file" which can contain a list of hosts to use while rendering the scene. The algorithm is fault-tolerant so that if one of the worker nodes goes down the work can be reorganized to complete that section of the image.
====== Code ======
===== Obtaining =====
You can retrieve a copy of FART from my Git repository using the command
$ git clone git://holtrop.mooo.com/fart.git
===== Dependencies =====
You'll need these packages to build:
* ''ruby''
* ''libfl-dev''
* ''libfreeimage-dev''
===== Building =====
$ ./configure
$ make
===== Executing =====
Example:
$ ./fart scenes/infinity.fart
Usage:
Usage: ./fart [options]
Options:
-o|--output-file
-w|--width
-h|--height
-m|--multisample
-f|--field-of-view
-d|--max-depth
-a|--ambient-occlusion
-p|--preview (means -w400 -h300 -m1 -d8 -a0)
--hosts
====== Documentation ======
See the [[.:fart:syntax]] page.
====== To Do ======
* High priority
* multi-core rendering in non-distributed mode (pthread)
* Medium priority
* add fog
* add spotlight and directional light types
* allow includes/modules in scene files
* allow textures in materials
* Low priority
* kd_tree optimization
* fix materials of boolean objects where transparency / refraction levels differ
====== Screenshots / Revision History ======
===== Revision 25 =====
I can write .bmp files but I'm not doing anything with scene data yet.
{{ :projects:fart:rev_25.png?nolink }}
===== Revision 43 =====
FART can intersect a ray with a sphere but doesn't have lighting/shading/material colors yet...
{{ :projects:fart:rev_43.png?nolink }}
===== Revision 45 =====
Cheap lighting based on implicit light source at the viewpoint
{{ :projects:fart:rev_45.png?nolink }}
===== Revision 46 =====
Multisampling is working (back to a flatly-shaded sphere to show the anti-aliasing effect on the edges)
{{ :projects:fart:rev_46.png?nolink }}
===== Revision 62 =====
Added a Plane shape type, I really need to get some better lighting working
{{ :projects:fart:rev_62.png?nolink }}
===== Revision 76 =====
Phong shading model working with ambient, diffuse, and specular light components
{{ :projects:fart:rev_76.png?nolink }}
===== Revision 121 =====
Added a Box object. No, it didn't take 45 revisions just for that. I've been working on the parser for the scene input files a lot as well.
{{ :projects:fart:rev_121.png?nolink }}
===== Revision 134 =====
Added a Cyl object. Cyl objects can be cones or cylinders - they have a bottom radius, a top radius, and a height.
{{ :projects:fart:rev_134.png?nolink }}
===== Revision 155 =====
Boolean intersections working. I had to rework the way I was returning intersections to also return a reference to the actual shape that was intersected with so that Intersect shapes would really return the child shape that produced the point.
{{ :projects:fart:rev_155.png?nolink }}
===== Revision 162 =====
A few bug fixes, and added Union and Subtract shape types.
{{ :projects:fart:rev_162.png?nolink }}
===== Revision 176 =====
More bug fixes, and reading the scene description from a file is finally working!
{{ :projects:fart:rev_176.png?nolink }}
===== Revision 180 =====
Material definitions working
{{ :projects:fart:rev_180.png?nolink }}
===== Revision 187 =====
Recursion working for transparent objects. Rays sent from surface point to each light source now intersect with other objects to produce shadows depending on the transparency of the objects between the surface point and the light source.
{{ :projects:fart:rev_187.png?nolink }}
===== Revision 196 =====
Added scenes/csg.fart as an example of doing [[wp>Constructive Solid Geometry|CSG]].
Also fixed a bug in the loading of boolean objects.
{{ :projects:fart:rev_196.png?nolink }}
===== Revision 202 =====
Changed intersection method to also return surface normals (instead of accessing them through a separate function, ''getNormalAt()''). This allowed Subtract objects to invert the normals obtained by the sub-object being subtracted out. This, in turn, allowed subtractions of subtractions to re-invert them, and so on and so forth...
{{ :projects:fart:rev_202.png?nolink }}
===== Infinity scene =====
Created from ''scenes/infinity.fart''
{{ :projects:fart:infinity-sm.png?nolink |Infinity}}
===== Die scene =====
Created from ''scenes/die.fart''
{{ :projects:fart:die2-sm.png?nolink |Die}}
===== Revision 211 =====
Light passing through transparent objects is colored by the objects
{{ :projects:fart:rev_211.png?nolink }}
===== Revision 251 =====
Exposure function replaced saturation model - thanks Nick!
| {{ :projects:fart:before-exposure.png?nolink |Before Exposure}} | {{ :projects:fart:after-exposure.png?nolink |After Exposure}} |
^ Before Exposure ^ After Exposure ^
===== Revision 258 =====
Soft shadows possible with "radius" and "jitter" keywords on light objects
{{ :projects:fart:rev_258.png?nolink }}
===== Revision 262 =====
Nick inspired me to add [[wp>Ambient Occlusion|ambient occlusion]]
| {{:projects:fart:ao-0.png?nolink|Before ambient occlusion}} | {{:projects:fart:ao-9.png?nolink|After ambient occlusion}} |
^ Before ambient occlusion ^ After ambient occlusion ^
===== Revision 281 =====
Added Extrude objects
{{ :projects:fart:rev_281.png?nolink }}
===== Revision 289 =====
Added shape definitions for easy shape reuse
{{ :projects:fart:rev_289.png?nolink }}
===== Revision 316 =====
Created from ''scenes/dw.fart''
| *** Beginning scene render ***
Parameters:
----------------------------------------
Width: 800
Height: 600
Multisample Level: 3
Ambient Occlusion Level: 5
Vertical Field of View: 60
Max Depth: 10
----------------------------------------
*** Ending scene render *** | {{ :projects:fart:dw.png?320&direct }} |
| ''Elapsed time: 28583.5 seconds (7 hours, 56 minutes, 23.4698 seconds)'' ||
===== Revision 351 =====
Added scene file scripting with variables, expressions, and control structures. Sample output showing result of a doubly-nested ''for()'' loop.
Created from ''scenes/for-test.fart''
| *** Beginning scene render ***
Parameters:
----------------------------------------
Width: 320
Height: 240
Multisample Level: 2
Ambient Occlusion Level: 0
Vertical Field of View: 60
Max Depth: 10
----------------------------------------
*** Ending scene render *** | {{ :projects:fart:rev_351.png?nolink }} |
| ''Render time: 156.877 seconds (2 minutes, 36.8771 seconds)'' ||
===== Revision 360 =====
Added ''if'' statements which can take optional ''elsif'' clauses and an optional terminating ''else''
Created from ''scenes/if-test.fart''
| *** Beginning scene render ***
Parameters:
----------------------------------------
Width: 320
Height: 240
Multisample Level: 2
Ambient Occlusion Level: 0
Vertical Field of View: 60
Max Depth: 10
----------------------------------------
*** Ending scene render *** | {{ :projects:fart:rev_359.png?nolink }} |
| ''Render time: 17.8504 seconds'' ||
===== Revision 367 =====
More fun with ''for()'' loops... created from ''scenes/dw-circle.fart''
| *** Beginning scene render ***
Parameters:
----------------------------------------
Width: 800
Height: 600
Multisample Level: 3
Ambient Occlusion Level: 0
Vertical Field of View: 60
Max Depth: 10
----------------------------------------
*** Ending scene render *** | {{ :projects:fart:dw-circle.png?320&direct }} |
| ''Render time: 12750.7 seconds (3 hours, 32 minutes, 30.6948 seconds)'' ||
===== Revision 379 =====
I finally got around to implementing [[wp>Refraction]]. Equations for refracted rays derived from [[wp>Snell's_law]].
{{ :projects:fart:rev_379.png?320 }}