Silverlight 5 brings XNA 3D to the web

Silverlight 5 brings XNA 3D to the web

  • Comments 21

I have been remiss in not mentioning this on my blog before, but if you are an XNA developer who hasn't been paying attention to Silverlight 5, now might be a good time to start!

A quick history:

  • At the MIX11 conference in April, we announced that Silverlight 5 was adding a new 3D API.  This is based on XNA, so included familiar types such as GraphicsDevice, VertexBuffer, and Texture2D, but it was not a full port of XNA.  In particular it did not include many of the higher level helper features, so there was no BasicEffect, no SpriteBatch, no math library, and no Content Pipeline.  It did support custom shaders, but using a low level DX9 style constant register API as opposed to the friendlier Effect system used by XNA.  This beta release made it possible to use high performance 3D in a Silverlight web app, but it wasn't exactly easy to do so!

  • In September, the Silverlight 5 RC added new features including the same five built-in effects as XNA 4.0, plus an XNA compatible math library.  David Catuhe writes about these changes.

  • Now, the Silverlight Toolkit provides vastly improved XNA compatibility, including ContentManager, Model, SpriteBatch, Mouse, Keyboard, custom effects, and new Visual Studio templates for getting started with Silverlight 3D.  Again David has a great intro.

This is still not all of XNA (for instance there is no Game class) but with this new toolkit, enough pieces are the same that porting existing Xbox or Windows Phone games to the web can be quite easy.  It took us just a few hours to port several existing XNA samples, which are included in the toolkit (Toolkit/Sep11/Source/Sample source


If you want to use the Content Pipeline in a Silverlight 5 app, you will also need to install XNA Game Studio 4.0 on your development PC.  But don't worry, this doesn't mean you will have to redistribute XNA to your web clients, or have it installed on every computer that runs the app.  Remember this diagram from an old article about the Content Pipeline:


The way this works with Silverlight 5 is that the blue boxes, which run at build time on your development PC, use the original XNA Game Studio 4.0 Content Pipeline assemblies.  Only the red boxes, which execute at runtime on the client machine, use the new code from the Silverlight Toolkit.  This is similar to when you build an XNA game for Xbox or Windows Phone, but the remote device is now a web browser.  If you are extending the Content Pipeline to add new types, you will need to provide both an XNA version of these types for use at build time, and also a Silverlight version for runtime.  Check out the Silverlight port of the Skinning sample for an example of how to set this up.

I don't normally name names, as I'm lucky to work with so many talented people and this blog is my chance to take credit for all their hard work :-)  But in this case I want to give a shout out to Aaron Oneal and David Catuhe, who went above and beyond to pull all the pieces together and make this happen.  Nice job guys!

  • Is this more secure than WebGL?

  • Considering the experience you give the users for enabling the DrawingSurface, I would go as far and say Silverlight did NOT bring 3D to the browser. I get the security Implications that needed to be addressed, but the experience is so poor most people people would never figure this out. I mean its easier to install the app in full trust! More on this here

  • Oops wrong link. Trying again :

  • SilverLight 5 is fantastic because of XNA features, but will 3D Permissions be change in future? is very hard for user to add permission in order to see 3D content.

    also i have question from Mr.Hargreaves...why silverlight is still a third plugin, on the other hand webGL needs no plugin.

    best regards.

  • When will Silverlight support UDP so we can make SL5 multiplyer games with XNA???

  • I agree with @Morten.

    Those features are wasted since SL5 failed to provide a solid web experience.

    A much better choice would be to drop custom shaders and other features that pose a security thread. Is it not possible to sandbox  GPU effectively?

    "Possible solution to horrid 3D User Experience?"

Page 2 of 2 (21 items) 12
Leave a Comment
  • Please add 4 and 3 and type the answer here:
  • Post