This project implements a simple ray-tracer in x86-64 assembly language using NASM (Netwide Assembler). The ray-tracer generates a BMP image file displaying three spheres.
To compile and run this project, you'll need:
- NASM (Netwide Assembler)
- A Linux environment or Windows Subsystem for Linux (WSL)
- A linker (ld) and basic build tools
On Ubuntu or Debian-based systems, you can install the necessary tools with:
sudo apt update
sudo apt install nasm build-essential
To compile the ray-tracer, follow these steps:
- Clone this repository.
- Open a terminal and navigate to the project directory.
- Run the following commands:
./r # or ./rd if you want debug info as well
This will create an executable named raytracer
.
Use gdb -slient ./raytracer
to debug. I certainly had to.
To run the ray-tracer and generate the BMP image:
./raytracer > output.bmp
This command will create a file named output.bmp
in the current directory.
You can view the generated BMP file using any image viewer that supports the BMP format. On most systems, double-clicking the file should open it in the default image viewer.
If you're using WSL without GUI support, you may need to copy the file to your Windows file system to view it:
cp output.bmp /mnt/c/Users/YourWindowsUsername/Desktop/
Replace YourWindowsUsername
with your actual Windows username.
main.asm
: The main assembly source code for the ray-tracer.vector.asm
: A basic 3d vector using MMX and SSE.sphere.asm
: Ray/sphere calculations.constancts.inc
: Global constants.README.md
: This file, containing project information and instructions..gitignore
: Specifies intentionally untracked files to ignore.
Contributions to improve the ray-tracer are welcome. Please feel free to submit pull requests or open issues to discuss potential changes or enhancements.
MIT. See LICENSE