Skip to content

Salominius/RayTracer

Repository files navigation

Raytracer

Overview

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 Files

  • 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 gif to create an animated GIF.
      • Type motionBlur to apply motion blur.
      • Type exit to quit.
  • 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.

Dependencies

  • RapidXML (for XML parsing)
  • LodePNG (for texture loading)
  • gif-h (for GIF creation)

Ensure these libraries are available in the project directory.

How to Run

  1. Compile the project: g++ readXML.cpp main.cpp lodepng/lodepng.cpp -fopenmp -o raytracer.exe
    • Parameter -fopenmp enables parallel processing for faster rendering. Can be omitted if not supported.
  2. Run the executable: ./raytracer.exe
    • Enter example6 to render the provided scene.
    • Output will be saved as <output_file>.ppm in the output-subdirectory.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published