다음을 통해 공유


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.

Multiparenting
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

  • Anonymous
    June 01, 2004
    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!

  • Anonymous
    June 01, 2004
    That is really cool. Is build 4074 available for subscriber download? I'll go check. I love Avalon.

    felix

  • Anonymous
    June 01, 2004
    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.

  • Anonymous
    June 01, 2004
    felix - It should be available. It was the build of Longhorn we gave out at WinHEC.

  • Anonymous
    June 02, 2004
    Put the source somewhere you don't have to sign in with .NET passport and then register.

  • Anonymous
    June 03, 2004
    The comment has been removed

  • Anonymous
    June 03, 2004
    I second, put source along with the binary.

  • Anonymous
    June 03, 2004
    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?

  • Anonymous
    June 08, 2004
    FYI Amiga fans. A native PowerPC build of Amiga OS4 was just released to developers. See the URL link on this post. :)

  • Anonymous
    June 10, 2004
    The comment has been removed

  • Anonymous
    June 10, 2004
    How about antialiasig those jaggies next time ;-)

  • Anonymous
    June 11, 2004
    It's dosen't works. :( Wkat I must do?? :(

  • Anonymous
    June 11, 2004
    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).

  • Anonymous
    June 11, 2004
    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 :)

  • Anonymous
    June 11, 2004
    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...

  • Anonymous
    June 11, 2004
    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

  • Anonymous
    June 18, 2004
    The comment has been removed

  • Anonymous
    July 02, 2004
    I think the sides need a bit a smoothing! good start!

  • Anonymous
    July 04, 2004
    Well, well - there are still many active Amiga users (eg. demosceners) and all of them have an new toy -> http://www.pegasosppc.com/

  • Anonymous
    July 18, 2004
    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!

  • Anonymous
    January 04, 2008
    PingBack from http://birthdays.247blogging.info/?p=27

  • Anonymous
    June 12, 2009
    PingBack from http://greenteafatburner.info/story.php?id=2875

  • Anonymous
    June 13, 2009
    PingBack from http://barstoolsite.info/story.php?id=1500