Projects » Amiga OS 4 Projects » Composite3DDemo

Composite3DDemo

Composite3DDemo screenshot (small)Most people using AmigaOS 4.1 probably think of its hardware accelerated compositing feature as the technology behind transparent windows and drop-shadows. Whilst this is true, it is so much more powerful than that. A little known or used feature is its ability to render vertex arrays of 2D triangles. About the only software that I can think of that uses this feature would be AmiBoing's Swamp Defense game (and its sister game, River Pirates).

While Amiboing's games are nice, even they don't use everything that the compositing feature has to offer. The designers of the AmigaOS 4.1 compositing feature had the foresight to allow the vertex arrays to specify bitmap (texture) coordinates in homogeneous form. This enables all sorts of 2D warps, and even 3D perspective-correct texturing.

Composite3DDemo makes use of the advanced compositing features. It is a modern 3D remake of the original iconic boing-ball demo that uses compositing to render the graphics. That's right, hardware accelerated 3D using nothing but AmigaOS 4.1's 2D graphics libraries.** I chose to do a boing-ball demo remake in part as a tribute to the original Amiga designers, but also because its nice and simple geometry makes the demo relatively easy to implement. Here is the result (direct youtube link):

Special thanks once again to hostcove for helping to record the video at high quality. There are screenshots below for those who are unable to view the video. Or, you can download and run the demo yourself, if you have a suitable computer running AmigaOS 4.1.

NOTE: AmigaONE X1000 owners will find a copy of the demo in the media drawer on their AmigaOS 4.1 install CD.

About the Demo

The demo is built around a mini 3D engine (called C3D) that is responsible for sending vertices to the graphics card. While using compositing for 3D will never beat using true 3D drivers, the C3D engine nevertheless manages to deliver the following features:

  • Perspective-correct texturing,
  • Multi-texturing (faked using multiple passes),
  • Per-vertex lighting (white light only), and
  • Shadow mapping.

Lack of a z-buffer (used for handling occlusions) does require some creativity to get around. However, for this simple demo the so-called painter's algorithm works splendidly.

As with my previous demo, Composite3DDemo started out as a test tool for the Radeon HD driver. I needed to test the vertex array compositing functionality more deeply than any existing applications could, so I wrote my own. Indeed, it helped me to discover and fix a serious GPU lockup bug.

Controls

  • Arrow keys - Orbit the camera around the scene,
  • L - Enable/disable lighting (including shadow mapping),
  • S - Enable/disable shadow mapping,
  • T - Enable/disable projective texturing,
  • H - Show the help screen (containing this list of keys, and
  • Esc - Quit

Requirements

The demo has the following requirements:

  • AmigaOS 4.1+,
  • 64 MiB of RAM or more, and
  • A compositing capable graphics card with 64 MiB of VRAM or more (as at 21 January 2012 this means a Radeon or Radeon HD card).
    NOTE: Radeon HD card users should use RadeonHD.chip version 0.32 or better.

Acknowledgements

This demo includes the following third-party libraries/media:

  • LibAIFF - by Marco Trillo (http://aifftools.sourceforge.net/libaiff/),
  • OpenAL (http://connect.creativelabs.com/openal),
  • Audio derived from "Battering ram banging on a door" by schots (http://www.freesound.org/people/schots/sounds/134069/),
  • An old Amiga advertisement (http://www.geekrant.org/2005/10/19/commodore-amiga/), and
  • Amiga 2000 B.C. - Copyright (C) 2011 by Marcin Gruszczyk (http://coolvibe.com/2011/amiga-2000-b-c/). Used with permission.

Why Bother?

I'm guessing that some people will look at this and say: "So what? OpenGL can do so much more. Why bother?" True, using real 3D drivers does enable you to do more. However, it's fun to go beyond the limits of what something was designed for. It's fun to see how far you can push the boundaries of what is possible. What made Amiga demos such as Lapsuus so impressive was not having the best visuals, but how much they managed to get out of the classic Amiga despite its age and limitations. Besides, the goal was to demonstrate what is possible with the advanced compositing features.

A Challenge to Developers

I'd like to challenge developers to see what they can do with AmigaOS 4.1's compositing feature. Both 2D and 3D demos (or even a combination thereof) are fine, as long as it only uses AmigaOS' 2D graphics system; no 3D drivers allowed. See what effects you can create, and how far you can push the limits of what's possible. The Composite3DDemo source-code is available (below), and you are welcome to use it as a starting point. Or, create your own graphics engine from scratch. The choice is yours.

If anyone is serious about 3D demos, I suggest having a look at Warnock's algorithm. It should help give you ideas on how to work around the lack of a z-buffer. I also hope to write some tutorials/articles explaining how the Composite3DDemo was done. That does depend on how much time I have available, though.

I'll showcase the best demos here, if people are interested.

NOTE: If you do want your demo hosted here, keep the content family friendly. This means no gratuitous violence, nudity, obscene or offensive material ().

Download 

NOTE: AmigaONE X1000 owners will find a copy of the demo in the media drawer on their AmigaOS 4.1 install CD.

 Composite3DDemo screenshot 1

Composite3DDemo screenshot 2

Composite3DDemo screenshot 3

** If you don't believe me, run the demo yourself and use Snoopy to check which libraries it opens.





Projects » Amiga OS 4 Projects » Composite3DDemo