Thursday, June 30, 2011

Modeling the Real World with Silverlight 5 3D

Late last year Esri’s Applications Prototype Lab published a Silverlight-based web application that could render a small area of the Earth’s surface in three dimensions. This app used Einar Ingebrigtsen’s graphics library called Balder and referenced imagery and elevation services from arcgis.com.

This year at MIX11, Microsoft released the beta of the Silverlight 5. Probably the most important improvement is the added support for GPU accelerated 3d graphics. This means Silverlight apps with 3d content will be rendered by a computer’s graphics card rather than dominating the CPU. It is now conceptually possible to develop Google Earth-like applications using Silverlight 5 3d!

Creating a virtual globe is a rather daunting project. However, inspired by Andy Beaulieu’s physics sample and associated blog post I decided to explore the possibility of modeling real world data in a browser.

Nicknamed “project alpha”, the prototype shown in the video above used the following pieces:

  1. Esri Silverlight SDK 2.2 (link)
    Mapping
  2. Microsoft Silverlight 5 beta (link)
    RIA
  3. Balder 0.8.8.9 (link)
    3D graphics engine
  4. JigLibX 0.3.1 (link)
    3D physics engine

Displaying a 3d world using streaming imagery and elevation data is not new. What is interesting about this prototype is the inclusion of a physics engine. Objects such as cars, people, tanks, planes can interact with each other and the Earth’s surface. Additionally, this prototypes shows that any location, and at any scale, can be modeled completely within a browser.

Whilst dropping hundred of tennis balls on Mount Ruapehu might seem a little fanciful, there are many practical uses of combining a 3d physics engine with mapping data. For example, an engineer may want to test drive a proposed road to examine it drivability and view. In defense, this technology can be for modeling and simulation of the battlefield.

Unless there is significant interest, the app and source code will be published once Silverlight 5 goes final.

12 comments:

  1. Could you publish the source code of this example. It is excellent!!

    ReplyDelete
  2. @anonymous. Yes, the source will be published soon. Just waiting for stability in balder and SL5.

    ReplyDelete
  3. It is geat. Now that SL5 is in the market, when are you planning to upload it?

    Thanks!!

    ReplyDelete
  4. Hi!!

    I just saw your prototype and looks very good. Could you share your code?

    Thank you!

    ReplyDelete
  5. Hi Everyone,

    The source code for this application is now available from this link:
    https://skydrive.live.com/redir.aspx?cid=dd16c3f34f4d913e&resid=DD16C3F34F4D913E!3457&parid=DD16C3F34F4D913E!3159
    (see "ESRI.PrototypeLab.Alpha.20120306.zip")

    Please note that whilst I able to successfully port the code from SL5-beta to SL5-final the app fails at runtime. This is due to the Balder engine using GPU loops, a capability unsupported in partial trust. I was unable to avoid this exception even in an out-of-browser app.

    I am hoping that a new release of Balder will correct this issue.

    Please let me know if you are successful getting this code to work!

    Thanks,
    Richie

    ReplyDelete
    Replies
    1. I couldn't get it to run. It complains in the PhysicsHeightmap constructor about a Geometry error...

      Delete
    2. Correct. If you examine the stack trace you will see the GPU exception mentioned above. Good luck.

      Delete
  6. Has anyone figured if the Geometry error exception has been fixed yet?

    ReplyDelete
  7. where is your code, i can't import 3d model(with full data .mtl etc) in to silverlight. Pls help me. So i don't know how to do it.

    ReplyDelete
  8. how to overcome of the geometry error coming while running the sample. pls let me know

    ReplyDelete
  9. Dear Richie, is there a way to overcome the geometry error coming while running the sample. pls let me knoe

    ReplyDelete
  10. Hi Anon, unfortunately I was unable to resolve the issue with SL5. Microsoft intentionally or unintentionally broke 3d in the final release of SL5. The security additions added to the final release make 3d unusable and restrictive. If you have existing XAML/C# assets consider a WPF-based solution. If you require a browser based solution then perhaps webGL. You may want to consider Esri's CityEngine product, 3d scenes can be exported to standalone webGL documents. Please see the following link for details.
    http://www.esri.com/software/cityengine

    ReplyDelete