The Science Elf Writes — Another — Raytrace Engine for the TI-84, Offering a Dramatic Speed Boost
from hackster.io
Pseudonymous educator The Science Elf has put Texas Instruments' TI-84 graphic calculator work on an somewhat unusual project: Raytracing.
"Most people familiar with my older catalog of videos probably know that a while back, I already wrote a raytracing program on a graphing calculator," the Elf explains. "But that one had a few limitations that I’d like to address."
The biggest: Speed, with the original engine taking six hours to render a single image. "The reason everything is so slow is because TI-BASIC, the built-in language I used, is interpreted. In short, the processor in the calculator doesn’t run my program, it runs a program that runs my program."
The solution: A new raytracer, this time written in a combination of C++ and assembler. Switching away from the old renderer to the new one has a dramatic impact in performance: What took the BASIC version six hours can now be completed in just 12 minutes.
Despite running on a calculator — which, the Elf points out, has a higher-resolution display than some classic games consoles — the resulting raytracer offers a surprising number of features: Support for arbitrary sphere and plane primitives; diffuse and reflective shading; texture-mapping; dithering; gamma-correct rendering with high dynamic range (HDR) tone-mapping; and global illumination via radiosity."Ti-84 calculators can now do raytracing faster, and with more photorealistic results," the Elf says. "I don't know about you, but I for one am excited that we're now one step closer to real-time raytraced Minecraft on a calculator..."
The source code and a binary file for the project has been published to GitHub under the permissive MIT License; those looking to try it for themselves, however will need a TI-84 Plus CE or later, and to use version 9.1 of the CE Programming toolchain rather than the latest release.
Leave a comment