Skip to content

glassworks/course-optimisation-sample

Repository files navigation

Optimisation sample - inefficient raytracer

A basic unoptimised ray-tracer to be used as an example for Optimisation.

This project can be most easily executed on any platform using Docker and VSCode DevContainers.

VSCode DevContainer

  1. Install Docker
  2. Install VSCode
  3. In VSCode, install the extension Dev Containers
  4. Open this project inside VSCode (the .devcontainer directory must be at the root of the project for the Dev Container to be recognised)

  1. Press F1, in the context menu type Dev Cont... and in the proposed options, choose "Rebuild Container".

  1. VSCode will restart, building the Docker Image and starting the container.
  2. If the build fails, you may need to : 7.1 Consult the error logs to resolve the build problem on your platform 7.2 Switch to a different network (the school's network might be blocked or limited)
  3. If all goes well, you can open a new terminal in VSCode. The prompt should read root@....:/app:

Build and run

Navigate into the build directory:

cd build

Run cmake to create the build configuration:

cmake ..

Build the raytracer:

make

Run the raytracer:

./raytracer 

Adding/modifying the project

Each time you modify the project structure by adding a new class to compile, adding a compile option, etc. you need to update the build configuration by running:

cmake ..

Running the raytracer

The raytracer uses an input JSON file (as the first argument) to specify the scene to be rendered.

You can either specify the path of the output file as the second argument. Otherwise the generated file is image.png.

The following examples are provided in the the folder scenes.

Two spheres on a plane

./raytracer ../scenes/two-spheres-on-plane.json 

Two triangles on a plane

./raytracer ../scenes/two-triangles-on-plane.json 

Sphere galaxy on a plane

./raytracer ../scenes/sphere-galaxy-on-plane.json 

Sphere mesh on a plane

./raytracer ../scenes/iso-sphere-on-plane.json    

Monkey mesh on a plane

./raytracer ../scenes/monkey-on-plane.json     

Combined scene

./raytracer ../scenes/all.json   

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages