Chen Thread presents a 4K ST intro
"beginnings of a raytracer"
an incomplete entry by GreaseMonkey
for SillyVenture 2024

Press any key on your keyboard to exit. This should be a fairly OS-friendly demo, although I do bypass the OS for palette handling.

The goal was to write a raytracer so I could see how long it would take on a typical 68000 without using software floating point. However, I ended up getting stuck on trying to compute the distance to the floor. Fixed-point math can be quite cruel, and admittedly I'm not particularly used to the 68000.

Anyway, imagine that the floor extends a decent distance towards the horizon and is a chequerboard. Then imagine there's a reflective chrome sphere floating in the air. And that's what this was *supposed* to be. For good measure, time how long it takes to render now and multiply it by 3.

Either way the target was to write something that renders in a bit under a minute. At least on that front I was successful.

I was aiming for the 96 KB intro category, but then realised that this would fit nicely into 4 KB if I jettisoned the font I was putting together and also generated a few tables... and it turns out that at this stage of development it doesn't even need crunching, but I do have a fast and simple LZ-only cruncher which I would need to write a suitable decruncher for, and the initial test of the cruncher managed to get it down to about 3 KB so I would have a reasonable amount of headroom.

Ideally I'd also capture the RGB data and re-generate the pixels in a second pass with a more appropriate palette. The 8x8 dither that's applied to 1:1:1 RGB gives surprisingly OK results. It'd be nice to actually have that extra pass though.

Shoutouts to everyone in #atariscne on IRCNet, and the people hanging out in ggn's and gwem's livestreams and their respective hosts of course. You are what makes me want to make stuff for the Atari scene.

This demo was built using rmac.

Licence:

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <https://unlicense.org/>
