1
0
Fork
You've already forked GBA-Raytracer
0
Raytracer for the GBA, written in rust, designed to be performant while still looking nice.
  • Rust 98.9%
  • Python 1%
  • Makefile 0.1%
Find a file
2026年03月29日 20:48:34 +02:00
.cargo Shrink iwram 2025年01月29日 14:08:33 -08:00
readme_assets Some changes to test materials more easily and debug dielectrics 2025年02月17日 12:30:59 -08:00
resources Fix the speed issues, remove music 2025年01月29日 21:21:55 -08:00
src Re-implement based on the opengl implementation... what the hell is broken 2025年02月26日 11:24:51 -08:00
.gitignore continuted testing..... 2025年02月15日 23:58:33 -08:00
Cargo.lock swap to tinyvec- fixes previous bug caused by arrayvec. dielectric calculations are entirely screwy. 2025年02月16日 12:57:37 -08:00
Cargo.toml swap to tinyvec- fixes previous bug caused by arrayvec. dielectric calculations are entirely screwy. 2025年02月16日 12:57:37 -08:00
gba_new.ld Crashes on text write (invalid address), but working glass 2025年02月15日 12:17:08 -08:00
LICENSE Public Domain Dedication (unless otherwise specified) 2024年12月30日 15:16:55 -08:00
make.bat continuted testing..... 2025年02月15日 23:58:33 -08:00
Makefile continuted testing..... 2025年02月15日 23:58:33 -08:00
README.md Update README.md 2026年03月29日 20:48:34 +02:00
rust-toolchain.toml Working screen test. Need to work on custom fixed point math lib 2024年12月11日 13:14:22 -08:00

GBA RT

Raytracing for the gba. to compile you just need cargo with the nightly compiler installed via rustup, as well as agb-gbafix (cargo install agb-gbafix)

Preview image

A note before we continue

This project is an implementation of "Raytracing in one Weekend", it is not a world-class raytracer nor am i trying to be the Heaven Seven demo. The primary goal is not to have perfect rendering or blow people's minds beyond "oh that's cool".

With that said, i am trying to keep it high quality, so for an faq:


Q: BVH?

A: At some point, i am largely following the order of the book


Q: Importance sampling?

A: Maybe some day but not right now.


Q: Realtime?

A: If you make a realtime raytracer with good quality you are a better dev than i


Q: Meshes?

A: Some day, when i add triangles, it will not be soon.


Q: Why are you not using X method?

A: Likely either memory constraints, or the fact that this was a project for fun, not a project for reading 500 page research documents and learning 4th year college math to understand them so i can make a slightly nicer raytracer on a gba.


Q: Rom?

A: My applications are not intended for use in regions requiring any form of age verification, and due to those laws I will not be providing premade builds. For more info see this page

Compiling

on linux you can use the makefile to compile with make fix assuming make is installed as well

you can also use make run to run in mgba-qt or make run_mesen to run in mesen2

Compiling on Windows or without make

cargo build --release
agb-gbafix target/armv4t-none-eabi/release/gba-rt -o gba-rt.gba

then run in your favorite emulator (i recommend mesen2)

A note

While this is a CC0 project, i do kindly ask you add attribution. I cannot force you of course, but i will trust you to make whatever decision you see fit. If this helps you, consider making a pr with your improvements, to keep this a free resource for everyone!

Some Credits

  • Zesterer for helping with finding inefficiencies as well as pointing out helpful libs and pushing me to better my code, as well as helping with a few implementations and some bug fixes
  • gbadev (mainly the discord) users for helping with some bugs

Old readme

AGBRS template

A basic template example for agb projects

This makes getting started with a new project for the Game Boy Advance in rust really simple, by providing all the boiler plate files for you.

Building

Prerequisites

You will need the following installed in order to build and run this project:

  • A recent version of rustup. See the rust website for instructions for your operating system

You will also want to install an emulator. The best support in agb is with mgba, with println! support via agb::println! but any emulator should work. You'll get the best experience if mgba-qt is in your PATH.

If you want to run your game on real hardware, you will also need to install agb-gbafix which you can do after installing rust with the following: cargo install agb-gbafix. This is not required if you are only running your game in an emulator.

Running in an emulator

Once you have the prerequisites installed, you should be able to build using

cargo build

or in release mode (recommended for the final version to ship to players)

cargo build --release

The resulting file will be in target/thumbv4t-none-eabi/debug/<your game> or target/thumbv4t-none-eabi/release/<your game> depending on whether you did a release or debug build.

If you have mgba-qt in your path, you will be able to run your game with

cargo run

or in release mode

cargo run --release

Starting development

You can find the documentation for agb here.

You may also want to change the package name and version in Cargo.toml before you start.

Shipping a .gba file for real hardware

To make a game run on real hardware, you will need to convert the built file into a file suitable for running on the real thing.

First build the binary in release mode using the instructions above, then do the following:

agb-gbafix target/thumbv4t-none-eabi/release/<your game> -o <your game>.gba