First Avalon 3D Demo…

Having my roots in the Amiga platform it should be no surprise that my first Avalon 3D demo would be inspired by the famous demo by RJ Mical.


(As a historical note, the first draft of this demo was written while waiting on a code review for the checkin which finally brought together the pieces to enable 3D. I wrote it to have a pretty screenshot to email to my team to announce that 3D support was now in Avalon. So, when I say “first Avalon3D demo” I really do mean the first… 🙂

Over the extended weekend I found some time to scrub the code a bit and post the binary (runs on Longhorn build 4074) and source. There are a few things I really like about this demo (aside from the excuse to link the Amiga History Guide).

  • It is a great illustration of the usefulness of multiple parenting.
  • It demonstrates some of the 2D/3D integration GregSc blogged about recently.
  • It shows Xaml being used as a general persistence format.

This demo actually uses two Viewport3Ds as shown in Figure 1-1 below. The top viewport displays the scene normally while the bottom viewport renders the scene inverted on the Y-axis. Rather than replicate the entire Model3D hierarchy between the viewports instead the same subgraph is added to the Viewport3D.Models collection of both viewports. The Visual/Model3D hierarchy is shown in Figure 1-2.


Because of the shared portion of the scene graph we conveniently only have to only worry about animating one spinning ball (which just happens to be rendered from two different views). In general, reusing portions of the scene graph them when possible is a best practice. There are some limitations to multiparenting, however. First, cycles are not allowed in the scene graph for obvious reasons. Second, in order to be shared across UIContexts the Model3Ds will have to be unchangeable. It is also worth mentioning that multiparenting is applicable to Model3Ds only. The Visual/UIElement/Control portions of the scene graph must be trees.

2D/3D Integration
Basic 2D/3D integration is illustrated by the fact that the viewports do not take over the rectangles they occupy. You can still see the blue gradient background of the Window through the Viewport3Ds. If you were to place a button behind the viewport input would still be routed through the unpainted portions to the underlying button just like any other UIElement. The bottom viewport is particularly interesting because we have set it’s Opacity causing it be rendered semi-translucently as it is composed into the scene. (To be clear, it is not the ball which is translucent, it’s the Viewport3D we are using to display this projection of the 3D scene). This is a minor example of the rich 2D/3D intergration story.

Xaml as a general persistence format
One challenge with working with Avalon 3D is that there is no way to import models… or is there? Because Xaml is a general persistence format loading a Model3D from .Xaml is as simple as:

Model3D myModel = (Model3D) Parser.LoadXml();
That is exactly what this demo does in Window1’s Loaded handler to load the embedded Ball.xaml. The challenge right now is not importing, but creating content as Xaml is not yet a widely supported 3D model format. In my case I wrote a small console app to generate the geometry and then used Parser.SaveAsXml. (BTW – If anyone would be interested in working on a .xaml exporter for their favorite 3D tool, ping me and I’ll help where I can.)

Comments (33)

  1. denny says:

    Very Cool!

    I had an AmigA 500 back in the day…

    it’s taken so long to see the PC catch up to some of the BASIC AmigA Tech!

    Copper, Blitter, FAT Agnes, Paula, Daphine…

    for readers who never used an AmigA the above were the chips that made the machine work.

    it was in many ways a multi-cpu system, dedicated graphics processors, sound processors

    and it had an advanced "DLL" system …. and only one fixed address 0004 was the entry point that you called to get a handle on a DLL, all DLL addresses were "Base Relative" code so when a DLL loaded there were not issues with "Base Address fixups" that was by design…. just a few of the things they got right in that one machine…

    what they got wrong was selling it to Jack Tarmel…. now if they could have gotten Gates and Balmer to bought them?? Hmmmm we’d all be using an AmigA based OS today and .Net would have been created 5-6 years sooner I bet!

  2. felix says:

    That is really cool. Is build 4074 available for subscriber download? I’ll go check. I love Avalon.


  3. danlehen says:

    denny – You are so right that it was the dedicated hardware that made the Amiga. For the longest time the issue with the PC was hardware, but these days we have a 350mhz GPU sitting there idly while we struggle to scroll a window smoothly. My team is dedicated to ensuring that applications built on the Avalon platform will fully utilize the hardware on the machine.

  4. danlehen says:

    felix – It should be available. It was the build of Longhorn we gave out at WinHEC.

  5. B.Y. says:

    Put the source somewhere you don’t have to sign in with .NET passport and then register.

  6. denny says:

    "denny – You are so right that it was the dedicated hardware that made the Amiga. For the longest time the issue with the PC was hardware, but these days we have a 350mhz GPU sitting there idly while we struggle to scroll a window smoothly. My team is dedicated to ensuring that applications built on the Avalon platform will fully utilize the hardware on the machine."

    Well good to hear….

    try this one on: the X-Box, in a way is like an AmigA 500… small board, dedicated chips etc….

    and as for Avalon 3D I for one am looking forward to having a system that uses the power of the GPU, I’m planning a new system sometime soon…. possibly a P4 Ex and a new nVidia card, still looking at when PCI Express gets out Vs. standard mobo….

  7. Joku says:

    I second, put source along with the binary.

  8. Just curious, for those of use that don’t have the resources to install a build of Longhorn, is there anyway you can get a movie capture and post that?

  9. CharlesP says:

    FYI Amiga fans. A native PowerPC build of Amiga OS4 was just released to developers. See the URL link on this post. 🙂

  10. stavros says:

    That is truly one of the most amazing things I have ever seen a computer do. Praise the Almighty that Avalon will be brought to us, enabling such wonderous technology. danlehen, I salute you and when I look at that bouncing ball, I don’t just see a ball, I see your hope, your determination, your drive and, yes, even your fear, the fear that we all share when laying our eyes upon the visual feast and technical marvel that is this bouncing ball. May God have mercy on us all. Some may even be concerned about the ethical ramifications of this bouncing ball. Are we, as humans, pushing technology too far? Is Avalon actually the tool of the devil? Who knows, but come my friends, let us rejoice in the bouncing ball on the new Windows version, for it speaks to us in more ways than we can imagine.

  11. Paul says:

    How about antialiasig those jaggies next time 😉

  12. Ghost says:

    It’s dosen’t works. 🙁 Wkat I must do?? 🙁

  13. danlehen says:

    Ghost – Can you describe the failure a bit more? Note: It only runs on Longhorn build 4074 (i.e., the build we gave out at WinHEC, not the build we gave out at the PDC).

  14. Kleptomaniac says:

    Awsome! what about smoothing the edges (antialiasing) of the ball? Can it work on other versions of windows it looks great as it is the first Avalon 3D demo hope it would get better and better and better 🙂

  15. Harlow says:

    Don’t forget "Super Agnes" and "Alice!" Sadly, the world just wasn’t ready for the Amiga… But I’m glad I was fortunate enough to have one! Someday the world will catch up…

  16. simon says:

    i dont know much about longhorn but what use will a 3d desktop environment actully have accept for it looking good is this just get back for expose

  17. Justin says:

    how do you download the source code? that download site is confusing as hell.

  18. andrew says:

    I think the sides need a bit a smoothing! good start!

  19. Well, well – there are still many active Amiga users (eg. demosceners) and all of them have an new toy ->

  20. myriadnz says:

    Windows Lovers are Drooling over the proposed Longhorn Technology adn also the Avalon 3D Development Architecture for GUI development. And writers who adore microsoft have been boasting about longhorn for a while but tell me is the User Interface really that much more advanced? I think the Apple Mac guys did a reasonable job of putting together an advanced 3D type interface with a powerful core operating system. Longhorn is gonna have to look outstanding and far superior to Windows XP in order to get praise from the purists!