Hacker News new | past | comments | ask | show | jobs | submit login
A JavaScript Port of the 1986 Amiga Juggler Raytracer (comcast.net)
102 points by guru_meditation on April 9, 2015 | hide | past | favorite | 33 comments



For some context, this was the first raytracer that ran on any personal computer.

Some more context here: http://home.comcast.net/~erniew/juggler.html

and a bit more here: http://www.pouet.net/prod.php?which=10776

The source code is refreshingly simple and easy to read: both the original C code and the ported JS code.


I trust you are accurate because of your username.


You do? I think I see blinking red bars around his username...


Ah yes, I think this was one of the first things I looked for this in particular at the first run when I just got my first Amiga. Brings back good memories!


The Juggler showed off the Amiga graphic abilities. It is what helped sell some of the 1986 and 1987 Amiga computers.

Before that it was a bouncing checkered beach ball. Other computers did their own bouncing ball, but the Amiga could multitask and had multiple bouncing beach balls, each program running on its own. I think you could have multiple jugglers as well.


A few years later 1992 "State of the Art", Spaceballs demo shows off Amiga 500 pretty well. That whole thing fits on 880 kB floppy and it's rendered realtime.

https://www.youtube.com/watch?v=89wq5EoXy-0

A year later same group released "9 Fingers", also running on Amiga 500.

https://www.youtube.com/watch?v=PPoYzwib7JQ


9 Fingers "making of" video, where the Spaceballs dudes videotaped their highschool friends for the dance shots:

https://www.youtube.com/watch?v=WgriMuXZ3QY

I think Jannicke, the state of the art girl dated Paul (Lone Starr) at the time. They were all teens when they made this and Paul was one of the by far youngest democoders in the scene at the time.

Interview with Jannicke (look how young everyone is): https://web.archive.org/web/20050307132321/http://spaceballs...

More context in Borzyskowski's work: "THE HACKER DEMO SCENE AND IT'S CULTURAL ARTIFACTS" http://fullscream.com/wp-content/uploads/borzysko.txt

Raw #5 diskmag: http://janeway.exotica.org.uk/release.php?id=9511

One day I'll really take the time to write a properly researched history of this very unique era..


Did those run on a stock Amiga 500?


Yes, this ran on an 1987 Amiga 500 with the Commodore A501[1] 512K RAM expansion. This means:

  * 1MB RAM
  * 256K ROM
  * 7.16 MHz (yes, that's 0.007 GHz :)) Motorola 68000
plus a whole lot of custom chips [2]

There were different ways of expanding the Amiga RAM and the demo became so popular it was reverse engineered by a popular cracking group Skid Row[3,4]., patched and re-distributed

[1] http://amiga.resource.cx/exp/a501

[2] http://en.wikipedia.org/wiki/Amiga_500

[3] http://www.exotica.org.uk/wiki/Skid_Row_%28old%29

[4] https://www.youtube.com/watch?v=uqfcrViBGn8


7.16 MHz (NTSC) / 7.09 MHz (PAL), and what's worse, average instruction takes about 8 clock cycles. Fastest ones take 4 cycles. "move" (like mov on x86) takes from 4 up to 36 cycles depending on addressing modes. Multiplication is up to 70 cycles. Divide up to 140 cycles (unsigned) and 158 (signed).

In some sense it's really like a 1.7 MHz machine. And that's being generous.


This says 50fps, so I assume it was the 7.09MHz version...


Correct, just like with the Commodore 64, the CPU clock actually differed based on the graphics hardware output, which was back in the day adjusted for the household CRT TV sets.

The master clock crystal oscillator on the motherboard was set to be 2 clock cycles per pixel and other chips clocks were derived from that.

Hence the CPU was set to 1/4th of master clock, so the European PAL[1] machines (a 50fps TV standard) actually ran slightly slower than the American NTSC[2] machines (a 60fps TV standard with a smaller vertical resolution).

[1] http://en.wikipedia.org/wiki/PAL

[2] http://en.wikipedia.org/wiki/NTSC


Yes, the Amiga was a great piece of hardware.

I was the only one from my friends having a PC at home instead of an Amiga, but luckily we had lot of scener parties at their places so I got to learn lot about the system.

It was an environment ahead of its time with dedicated hardware for sound and graphics, pure multitasking even if lack of MMU meant occasional crashes and the whole libraries concept was great.


Some of the amazing capabilities of the Amiga were influenced by one of its architects: Carl Sassenrath. He has since gone on to create the Rebol language which is even more astounding once you begin to look into it.

He's currently at Roku where I can only begin to imagine what he's working on. My only wish is that they'd replace the horrific BrightScript with Rebol.


The hardware owes it all to Jay Miner and Ron Nicholson (rhn). Jay Miner passed a long time away from a long term kidney condition and is still out there doing lots of stuff:

http://www.nicholson.com/rhn/photo-cv.html

Notice how he was the guy behind the IWM (Integrated Woz Machine) for the Mac and the beautifully minimized Apple //c in addition to being one of the key persons in creating the essence of Amiga hardware magic: Denise, Copper and Blitter.

Carl Sassenrath and RJ Mical were super influential on the OS side, making a super lightweight preemptively multitasking OS with small components that messaged each other and the OS abstraction layers that the rest of the personal computing world will not see in the next 10+ years.


I don't know if he is still selling them, but: http://www.frogpondmedia.com/dbv/index.html

Dave Haynie, one of Commodores hardware engineers, films the last day at the Commodore plant. And the layoff party afterwards. Hilarious, informative, and sad at the same time.


I thought Wendell Sander did the IWM?

http://www.folklore.org/StoryView.py?story=Five_Different_Ma...

(and lots of other pages.)


I consider Andy Hertzfeld's site a very accurate reference as well as a patchwork of authentic fascinating stories that just draws you in.

However, Ron Nicholson (rhn) is on the Mac case signatures, he also did major work on Apple //, so I find it strange that he is not mentioned anywhere on folklore.org . I think this is something worth researching..


> Jay Miner passed a long time away from a long term kidney condition and is still out there doing lots of stuff

Like he'd let a little thing like death stop him! :)


Ha! :) Sorry, meant to write "rhn is still out there", but I dropped I replied to hastily and by the time I figured it out it was too late to edit my post..


It's pretty cool to click on the link and be able to run a ray tracer on your phone. Maybe more exciting because you get the drama of it taking a couple seconds to render.

Ironic that compute has come so far yet real time movie quality graphics are still only a dream.

We have GPU based ray tracing, and if you stuff a 44u rack full of them it becomes more tolerable, but still nothing approaching 24fps for complex scenes and effects,

This has a lot to do with the content being more complex compared to say, what was done for a movie like Tron. But it's more than that. How many other problem domains could eat 5 orders of magnitude of performance increases and easily make use of it for everyday consumer applications? That still might not even be enough to get us out of the uncanny valley.


Heh. I thought it was going to be animated.


This has nothing to do with the Amiga, but shameless plug for a cool in-browser ray-tracer we made for a school project http://camargo.github.io/tracejs/#/

Rendering times become exponentially slower with more objects in the scene (100% native Javascript, hence 0 hardware acceleration) but it's fun to play with if you're in the mood!


If you want the other extreme, these days you can do real-time raytracing entirely in an OpenGL shader:

https://www.shadertoy.com/view/XdfXDB

(There's no geometry in that scene --- the shader is run for each pixel independently!)


It's interesting that they chose to port the source to JS by hand, rather than compiling the C to asm.js with emscripten. It'd probably have been easier, and the resulting code faster, if this approach was taken.


They should have just taken a still of the original and pasted it as a png. Would have been easier, and requires less CPU. But I don't think that was the point of the whole exercise.


Multithreaded ray tracing C# version: https://github.com/wieslawsoltes/rt


Project Amiga Juggler: http://meatfighter.com/juggler/

Step by step tutorial in Java.


i'm surprised to see so much badness in the original code.

it kind of takes away from the rose tinted view i have of the past being dominated by awesome programmers who got the most out of the hardware...


I just realized I can't find the original code on this guy's website but I have the extracted Amiga disk image from a public domain disk circulated at the time... so, here's the annotated 1987 K&R C code on pastebin for comparison:

RT1.C http://pastebin.com/67KWYV3p

RT2.C http://pastebin.com/pc3Uq2Xd

RT3.C http://pastebin.com/v4Qx0gTD


For what it was aiming to do, I think it makes a lot of sense, albeit it might be a little bit too factored for the data(e.g. passing in the whole world to functions called only once).

You can kind of tell that this is more "proof of concept" than "artistic triumph" because the scene itself is relatively bland stuff, with its most impressive aspect today being that the juggler actually animates somewhat like a person. Everything else is just a straightforward demonstration of the Amiga's compute resources and display capability. Since the output was always going to be a single prerendered animation, deep optimization probably wouldn't be worth it.


i mean stuff like the wonky reflection code and checkerboard logic... its a bit 'special', even for a proof of concept.

its unexpected given the apparent intuition for rendering/geometry/maths from the simple, yet clever animation used.


I wish he hadn't made so many modifications.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: