What’s new in Silverlight 5 beta? 3D graphics support!


Happy Silverlight 5 Beta day! The biggest additions to Silverlight 5 are certainly the support for GPU accelerated video and 3D graphics and the SDK team has been hard at work trying to get samples and documentation together for today. If you’re a developer, after downloading the Silverlight 5 beta runtime, SDK, and developer tools, you’ll probably want to start playing with the 3D features. In this blog post, I’ll point you to the resources we created to help get you started.

Get the Silverlight 5 Beta, Tools, and SDK Now

1) The XNA Math Helper DLL
We expect that the math functions from XNA will be integrated into the Silverlight namespaces in the future, but for Silverlight 5 beta, you’ll want to make use of this library instead. Add a reference to this DLL by right-clicking references in your Visual Studio project, clicking “Add Reference,” selecting the “Browse” tab and navigating to this DLL’s location. Then you can use the original XNA documentation to make use of the math functions contained within. These are a real lifesaver when doing matrix math, creating camera views, changing object positions, etc.

2) 3D Graphics Overview Topic
A high-level overview of the basics, explaining the capabilities provided in this beta release.

3) Textured 3D Cube Walkthrough and Downloadable Source Code
This walkthrough and sample demonstrates how to create a complete Silverlight 5 beta 3D application, including the use of textures, the use of shaders, integration with Silverlight UI elements, and cross-thread synchronizing (between the rendering thread and main UI thread). When completed, you will have created a textured cube that can be manipulated with ordinary Silverlight UI elements (in this case, sliders).

Already have the runtime installed? Here’s the Textured Cube sample running live!


4) Reference documentation for the new API areas: Microsoft.Xna.Framework (Silverlight Version), Microsoft.Xna.Framework.Graphics (Silverlight Version), Micrososft.Xna.Framework.Silverlight, and the appearance of DrawingSurface in the System.Windows.Controls namespace.

While XNA developers have enjoyed being able to use managed code to create and apply 3D effects for awhile now, in Silverlight 5 beta, effects are the purview of shaders. This is because the effects APIs from XNA haven’t been integrated yet. For now, just as you must workaround the limitations of the beta release by manually importing the XNA math library, so must you write and compile shaders to have effects in Silverlight 5 beta. A minimum of a vertex shader and a pixel shader is required, but as you will see in the textured cube sample, they need not do anything terribly fancy.  

We are working on posting some other samples that demonstrate 3D use, and look forward to posting them very soon. Hopefully you got to see the “Babylon” demo (showing the interior of a cafe) during the MIX presentation, featuring full-scene, full-screen, GPU-accelerated 3D. It is really amazing to have an in-browser experience that feels so much like a modern 3D game; truly an example of trailblazing plug-in technology at work!

Comments (11)

  1. jomul says:

    Note: In the Textured Cube walkthrough, it looks like the build system de-bolded a line I was trying to highlight (instructing readers to look for the bolded line in a particular code snippet). That line, a <param> tag that enables GPU support when embedding a 3D Silverlight application in a webpage, is as follows:

    <param name="EnableGPUAcceleration" value="true" />

    Sorry for any confusion. Will adjust the snippet and instructions to solve the ambiguity.

  2. Silverlight Developers says:

    For Silverlight developers, this new version includes XAML parser improvements that speed up startup and runtime performance.

    silverlightdevelopment.blogspot.com/…/silverlight-developers-use-cross.html

  3. sliverlight user says:

    I have install all tools(VS 2010 SP1, Silverlight 5 beta tools, directx sdk,

    and can not see the live sample.

    I am on a windows XP.

    Do I need to install any otherthings to see 3D cube?

  4. John Mulhausen says:

    @silverlight user: There could be incompatiblity with Windows XP (a question is out to the product team on that one). Other issues involve not having a supported video card, though most DirectX compatible cards with a GPU should be fine), and the fact that you don't actually list the Silverlight 5 beta RUNTIME (not just the tools) in the things you've installed so far.

    @David Catuhe: Thanks so much! The Babylon demo blew us away!

  5. Einar Ingebrigtsen says:

    Worth noting is that there is a library called Balder that provides an abstraction on top of this that lets you do everything in Xaml : http://balder.codeplex.com

  6. cherylws says:

    @silverlight user, per the product team, XP drivers are blocked for security and compatibility reasons.

  7. John Mulhausen says:

    @silverlight user: Got word from the PM:

    "XP drivers are blocked by default and require user consent. This was necessary for security and compatibility reasons. Check out my MIX session for more info:

    channel9.msdn.com/…/MED06

    "

  8. silverlight user says:

    Thank you,  John and Cheryl.

    I right-click the silverlight applicaiton and allow the 3D display.

    Now I see the 3D cube.

    Good job, silverlight product team!

    This 3D feature is what  I want for a long time.

  9. Torrence Pinetta says:

    Just installed Silverlight 5 beta on an Acer Revo R3610 PC, running Win 7 HP 64-bit and I.E. 9.  This system has an ION GPU.  When trying to play HD content on Netflix, still do not get smooth video and audio playback.  I was hoping that Silverlight 5's support of GPU accelerated video  would finally allow smooth playback of HD content, but that's not yet the case.  [Note: Adobe Flash Player 10.2, which supports the ION GPU, provides smooth 30 fps HD video playback on this system.]

  10. Tony V says:

    I think it may run even worse (stutters like crazy) than Silverlight 4 on my Lenovo Q150 with the latest NVIDIA drivers.  I tried Firefox 4 and IE 9. However, it does appear to be using the GPU according to GPU-Z.  It hovers around 50% usage.  And yes, I will point out like the many others that Flash runs in HD flawlessly.  I know Flash had a big head start, but come on Microsoft, you can do this! Be my hero!