[Coco] Raytracing on the CoCo

Mark McDougall msmcdoug at iinet.net.au
Thu May 16 06:46:19 EDT 2019

On 16/05/2019 2:08 pm, Walter Zambotti wrote:

> I've been playing with Joel Yliluoma' raytrace C++ for DOS and have
> converted it to the CoCo.
> It is designed to output to a 16 color palette with dithering!  Ok so might
> look good on the CoCo!!!
> On my i7-3740 2.7Ghz it produces a 320x192 frame every 2.8 seconds.  No GPU
> acceleration. With acceleration 18+ frames per second.
> On OVCC running at 184.16mhz it takes 9.3 seconds to draw one pixel.
> Times that by 320x192 pixels and that blows out to 6.67 days to draw one
> On a 1.8mhz CoCo that would be 675 days.

Back in the mid-80's before every man and his dog was doing raytracing, 
we had to write a simple renderer in the Computer Graphics course at 
uni. We had to share access to the computer in the lab which had hires 
colour graphics, so it was prudent to prototype code at home where 
possible (not that half the class had a computer at home!)

I don't know if Pascal was mandated but the lectures used Pascal example 
code snippets so for the assignment itself, Pascal it was.

Although I had a CoCo 1, my father had bought me a TRS-80 Model 4P to 
use specifically for uni work, and at the time having used the rather 
excellent Turbo Pascal on Montezuma CP/M 2.2 on the 4P for earlier 
assignments - besides not having Pascal for the CoCo - the choice was 
clear. Although the 4P only had monochrome graphics, I had the Grafyx 
Solution hires board for it and used dithering in lieu of different colours.

The assignment required the implementation of just spheres and an 
infinite checkerboard. For the 4P prototype I reduced the number of 
reflections to (IIRC) just 2, mainly because of the dithering and set it 
off. Some 30+ years later I can't quite recall how long it took to 
render a single scene, but it was in the multiple of hours if not 
overnight. It certainly wasn't several days (4MHz Z80), though of course 
the code was much simplified and nowhere near 500 lines long!

I am surprised at how slow Joel's code is on the CoCo, but then again 
the complexity of the scene and the objects it can handle could blow out 
the calculations by orders of magnitude quite quickly I suppose! OK so I 
take it back - I'm not surprised.

Has there ever been any other raytracing (rendering) attempted on the 
CoCo that anyone knows of? I wonder how my simple assignment would 
perform? I think many, many years ago I rescued the floppy, if not the 
code, from that assignment but these days I'd have no chance of locating 
it. Not that it would be difficult to re-code from scratch with a bit of 
a refresher!

Interesting stuff!

Has anyone got a spare CoCo3 they can set aside for a couple of years to 
render a scene and save it for prosperity? Would be cool to know that it 
took 2 years to render - without cheating on an emulator!!! You'd want 
to make sure there were no bugs in the save code first though... ;)


Mark McDougall

More information about the Coco mailing list