3D Capabilities in Silverlight 3
page 2 of 5
by Sergey Zwezdin
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 36609/ 119

Work with 3D-projections

As it has already been said, Silverlight platform has essential limitations on execution environment. Well, there are serious restrictions on work with 3D in Silverlight. Unlike WPF, in Siliverlight there is work with 3D-projections of 2D-objects organized. Actually, in Silverlight 3 there are no full 3D objects and scenes, and there are only 3D projections of 2D objects. It means that it is impossible to load 3D objects from (for example) 3D Max Studio in Silverlight applications. But this functionality is usually enough for most business applications.

As well as in any other 3D system, in Silverlight 3 there are three axes where you can rotate the two-dimensional objects. You can set the object centre that will be the start point of rotation and bias of the object. There are two types of object offset - local and global. Local specifies the positioning of an object in a container. Global offsets or sets positioning of objects on all windows.

The centre of rotation of an object is set with help of 3D-projection parameters. It is important to indicate that the centre of an abject is set in relative coordinates on axes X and Y (by default 0.5), and it is absolute on axis Z (by default 0).

It is possible to set transformations on several parameters for one object. Thus, it is possible to turn an object on coordinates X and Y and to set any global offset. Also, it is possible to transform an object at once on all three axes.

Figure 1: Direction of axes in Silverlight 3

Projection property is used to set 3D projections for Silverlight control elements. In Silverlight 3 all control elements have this property. If there is need to set a 3D projection for an object, you should initialize this property with PlaneProjection object. In object PlaneProjection 3D, there are transformations on all axes and also local and global biases are set.

Listing 1 - Button control with 3D-projection

<Button Content="Click me">
  <Button.Projection>
    <PlaneProjection RotationX="45"
             RotationY="15"
             RotationZ="90"/>
  </Button.Projection>
</Button>

Similarly to this, you can to set transformations to all control elements in Silverlight 3. And all control elements are still functional, i.e. we can enter a text, click them, etc. The following example shows the panel with several TextBox control elements. In this case, 3D transformations are applied to the root panel, instead of child control elements. But, if it is necessary, it is possible to apply transformations to control elements too.

Listing 2 - 3D-projection for StackPanel control

<StackPanel Margin="15">
  <StackPanel.Projection>
    <PlaneProjection RotationY="-50"/>
  </StackPanel.Projection>
  
  <TextBlock Text="First name:"/>
  <TextBox />
 
  <TextBlock Text="Last name:"/>
  <TextBox />
  <TextBlock Text="E-mail:"/>
  <TextBox />
</StackPanel>

In this case, we get the user interface as it is shown below.

Figure 2: 3D-projection for StackPanel control

In this example it is well visible that the controls are rotated on axis Y on 50 degrees.

PlaneProjection object can be used for appendix animation. Thus, it is possible to change rotation coordinates on axes or to change the rotation centre.


View Entire Article

User Comments

Title: Silverlight 3D   
Name: I. Ivanov
Date: 2010-07-21 8:15:25 PM
Comment:
Hello. You can try our new Silverlight component for 3D visualization. We support many features common to the modern 3D engines and the rendering is fast. You can load your 3DS files with a single step. If you are interested go to http://postvision.net/SilverMotion/Demos.aspx to see some demos ;)
Title: Software Engineer   
Name: Sai
Date: 2009-12-20 11:41:53 PM
Comment:
It really helped me a lot, Thanks for your effort.
Title: Iulian   
Name: Iulian
Date: 2009-10-21 2:33:26 PM
Comment:
Very good tutorial. Anyway I have a question. How can I combine the next scenarious: When the button is clicked then the grid will zoom in 10% and after is RotationY=180 after the rotation is complet the zoom is coming back from 90% to 100%. Do you have an example for this? Thank you
Title: Jeroen   
Name: Jeroen
Date: 2009-07-14 8:57:51 AM
Comment:
Thanks, was looking for this as a beginning in Silverlight since I found out that 3D Direct X programming (or even XNA) will consume to much time and will not produce a product which makes me happy since

I hope in the next Silverlight they also allow 3DMax/DirectX x objects and animation to it. That would make it very interesting for small game dev. For example a web remake of Doom.

Thanks for the article. It is good, solid an easy to read.
Title: Idea   
Name: Daniel
Date: 2009-07-13 4:31:24 AM
Comment:
Quick way to show 3d features in silverlight3. Quick, helpful and easy :)
nice!
Title: Good work!   
Name: Manish Kumar
Date: 2009-07-03 1:47:20 AM
Comment:
Great article and useful for me
Title: Nice work   
Name: Mohammad Reza Pazooki
Date: 2009-06-30 10:59:42 PM
Comment:
I think we will see a great enhancement in web graphic.

good job Sergey Zwezdin






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2018 ASPAlliance.com  |  Page Processed at 2018-10-20 10:16:35 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search