Skip to content

A simple raytracer written in 64-bit assembly (NASM) for Linux, rendering spheres with basic shading into a BMP image.

License

Notifications You must be signed in to change notification settings

cschladetsch/AsmTracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assembly Ray-Tracer

License

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.

Sample

Image

Prerequisites

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

Compiling the Project

To compile the ray-tracer, follow these steps:

  1. Clone this repository.
  2. Open a terminal and navigate to the project directory.
  3. 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.

Running the Ray-Tracer

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.

Viewing the Output

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.

Project Structure

  • 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.

Contributing

Contributions to improve the ray-tracer are welcome. Please feel free to submit pull requests or open issues to discuss potential changes or enhancements.

License

MIT. See LICENSE

About

A simple raytracer written in 64-bit assembly (NASM) for Linux, rendering spheres with basic shading into a BMP image.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published