BERTO is an experimental ray tracer implemented in the OCaml programming language. The latest public snapshot of the source code of BERTO can be found in the corresponding GitHub repository. The source code documentation is based on the OCamldoc tool; the online version is usually created from the doc branch. BERTO is work in progress, so the code (and the documentation with it) are likely to change in the future. Some demo renderings are shown in the Gallery.
Ray tracing is a technique of computer graphics to generate a digital image of a virtual scene. The term 'virtual scene' refers to the representation of a real-world scene, i.e., an arrangement of real-world objects, in a computer program. The basic idea of that technique is to follow a light ray that reached the aperture of a camera (or an eye) backward into the scene and find the surface point from where it emanated. The procedure can be continued recursively until a light source has been reached (or no further intersection exists).
The representation of a primitive (i.e., a 3D object of the scene) in the program must permit intersection calculation with rays and must encode information about the interaction of the primitive's surface with light rays. While the former is merely a (possibly cumbersome) problem of geometry, the latter requires a theory about the interaction of light and materials. Such a theory is provided by physics, namely through radiometry and geometrical optics. Thus, BERTO is physically based meaning that it uses techniques motivated by a physical consideration of problems. BERTO is very strongly inspired by the Physically Based Ray Tracer (PBRT) of Pharr and Humphreys.
The implementation language of BERTO is OCaml. Ocaml is a dialect of the ML family of computer languages; it has been developed by the Institut National de Recherche en Informatique et en Automatique (Inria). OCaml supports the functional programming paradigm but does not enforce it, that is, it also has features supporting the imperative paradigm. The 'BERTO experiment' addresses the question if and to what extend a real-world ray-tracer implementation can benefit from functional language features. To this end, usually only those language features of OCaml are used that can be found in other ML dialects (e.g. Standard ML or F#), too. The only exception to that rule are objects and classes. OCaml has an object oriented layer that is well integrated into the functional language core. (F# also provides object-oriented features that are - however - not compatible with OCaml.) Some parts of a ray-tracer can naturally be implemented using object oriented techniques, such as the scene model. Nevertheless, object oriented techniques are only employed when there seems to be a benefit in terms of readability or extensibility of the program.
BERTO is distributed under the terms and conditions of the GNU General Public License.
Features of the current version of BERTO include (some only available in the dev or doc branch of the repository):