Skip to content

RobbeDGreef/AsmRayTracer

Repository files navigation

RayTracer

Assembly programming project for university.

To run the raytracer

In dosbox execute the following command

RUN.BAT

Since the concept of a raytracer is inherently slow, it is adivsed to increase dosbos' cyles. This can be done by pressing CTRL+F12 multiple times or set it in the dosbox.conf file. Setting it to about 1MHz (1000000 cycles) should be enough to speed up the raytracer significantly.

To run the unit tests

In dosbox execute the following command

TEST.BAT

Build the ray tracer for linux (x86)

TASM assembly code doesn't normally run on linux, however since the instructions are more or less the same. We can use a different compiler (NASM) to compile the actual instructions. The only problem is all the TASM specific syntax. For this I wrote a small transpiler in python that converts the TASM code to NASM. This together with NASMs "tasm compatability mode" (very very minimal compatability but useful none the less). We can build the code for linux. Of course DOS specific syscalls had to be replaced with their alternatives but this is not a big problem, we can just use ifdef NASM <nasm code> else <tasm code> endif macros.

Requirements

You need to have make, nasm, ld and python3 installed. On top of that you need 32 bit linux C libraries and your operating system needs to be able to run 32 bit executables. For example if you want to run this on windows, WSL 1 is not able to do this you will need WSL 2.

make -f LMAKEFILE

The code currently contains a bug which doesn't show the ray traced ball in linux mode but this bug will soon be fixed

Current state of things

All materials render Glass ball render

Coding style

Line limit

No line should be longer than 80 characters. You can use a backtick '' to split a line up.

File names

All file names should be upper case.

Assembly instructions and directives

Assembly language is case insensitive but try to leave everything lowercase.

Todo

  • utility functions
    • print_float
  • Implement the vec class
    • struct implementation
    • getters and setters
    • vec-vec
    • vec+vec
    • vec*float
    • vec/float
    • length()
    • length_squared()
    • dot product
    • vector cross
    • vec_cpy
    • vec_eq
  • Frame buffer class
    • Essentially a large buffer that has a function to copy itself to memory
  • Ray class
    • struct implementation
    • getters and setters
    • at(float t) function (origin + t*direction)
  • Compatability mode for easier debugging and profiling
  • Multiple samples
  • Shading
  • Camera
    • Positioned
    • ViewAt
  • Materials
    • Diffuse materials
      • Simple perfect diffuse
      • Configurable diffuse
    • metallic materials
      • Simple perfect metallic
      • Configurable metallic
    • Unlit
    • UV
    • Dielectric (maybe)
  • Scene system
    • Simple linked list
    • BVH trees (maybe)
  • Objects
    • Spheres
    • Triangles
    • Loading wavefront OBJ files

Future improvements

  • Point lights
  • Glossy material
  • One large BSDF material

License

This project contains no license file for a good reason, this is not a mistake. ALL files in the repository are copyrighted to the authors of this repository.

About

VUB second bachelor assembly programming project

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published