views:

1134

answers:

4

Is is possible to load 3D objects in a Silverlight 3 or Silverlight 4 application? (3DS Max objects or other formats). Besides loading the object I also need some basic interaction - simple rotations, zoom in/out.

+3  A: 

Not really.

There might be some libaries out there that can bring some limit 3D-esq effects to SL (indeed SL 3 comes with a little bit of this itself). However SL doesn't really have good 3D support.

There is the old Kit3D project but don't where that is at now, it hasn't had an update in the last year.

AnthonyWJones
+1 for no real 3D support. Major limitation of SL IMHO.
Dave Swersky
+1  A: 

Of course it's possible. How much code do you want to write? How good does it have to look?

The idea of 3D in Silverlight is the same as 3D in Flash. You can do it, if you're up on your trigonometry and basic algebra. It's quite easy unless you're rusty.

First, you'll need to export your vertices into a format that can be read, or embedded directly into your project. Next, you'll need to spawn several triangles and shove handles to them into an array.

You can't do vertex lighting very efficiently, so you're probably stuck with flat shading. Before each frame you must:

  • Traverse your geometry
  • Apply your rotations & transforms (position, scaling)
  • Adjust one triangle in your array for each triangle in your geometry (with matrices applied)
  • Sort your triangles back to front
  • Adjust the color of each triangle (only once is best)
  • Etc.

You'd be hard pressed to exceed 1,000 triangles / 3,000 verts. You can do it, but not if you want to do other things at the same time.

So, yes. It's totally possible, but not something that's off-the-shelf nor integrated into Silverlight. For the time being, we have to resort to the way of doing 3D graphics like the old days... by hand.

Pestilence
A: 

Almost impossible to load 3Ds Max object in Silverlight 3/4.

Google o3D is probably your way to go.

Anwar Chandra
+4  A: 

I think the managed 3D engine Balder might be the right choice for you. It runs quite good in Silverlight and I've used it with Silverlight 3 and 4b. Balder supports the ASE format at the moment, but Einar and his contributors are working hard on the engine and they want to support more mesh formats in the future.

Rene Schulte