This project implements a basic raytracer that reads scene descriptions from XML files and generates images in PPM format. It supports features like:
- Parsing scene configuration (camera, lights, objects) from XML.
- Rendering images using raytracing.
- Experimental GIF animation and motion blur demonstrations.
-
main.cpp
Entry point of the program. Handles user input, loads scenes, and triggers image generation.- Commands:
- Enter an XML filename (with or without
.xml) to render the scene. - Type
gifto create an animated GIF. - Type
motionBlurto apply motion blur. - Type
exitto quit.
- Enter an XML filename (with or without
- Commands:
-
readXML.cpp
Responsible for parsing XML scene files using RapidXML. Extracts:- Camera settings (position, look-at, FOV, resolution).
- Lights (ambient, parallel, point, spot).
- Surfaces (spheres, meshes) and their materials (solid or textured).
- Background color and output filename.
-
Scenes/...
Contains 8 example scenes defining camera, lights, and objects. Use these as a template for creating custom scenes.
- RapidXML (for XML parsing)
- LodePNG (for texture loading)
- gif-h (for GIF creation)
Ensure these libraries are available in the project directory.
- Compile the project:
g++ readXML.cpp main.cpp lodepng/lodepng.cpp -fopenmp -o raytracer.exe- Parameter
-fopenmpenables parallel processing for faster rendering. Can be omitted if not supported.
- Parameter
- Run the executable:
./raytracer.exe- Enter
example6to render the provided scene. - Output will be saved as
<output_file>.ppmin the output-subdirectory.
- Enter