Input the 3dmax model to WPF for running.

Source: Internet
Author: User

In fact, let's look at the authorArticlePreviously, you can search the Internet to enter the 3dmax model into WPF. Most of the results are in this article. What about this article? It is a little troublesome, that is, when we convert the 3dmax model to the blend model, only the model has no material or texture. We need to add the texture in blend3. The model is easy to add in blend. If it is complicated, it will be troublesome. I don't want to directly use blend to create a model! Another point I think it is too troublesome to control the plane with buttons. You can control the plane with the mouse. Therefore, this article focuses on these two points.

Download this example (Development Environment: 3DS MAX 9.0, Microsoft Expression blend 3, vs 2010)

In this article, the 3dmax model directly references wxwinter, but in 3dmax, I directly provided a texture map (File: helicopter. max) to the plane ). Open the 3dmax model, click File ==> export ==> save type (select. OBJ). Then, press set and click OK.

Two files (. OBJ and. MTL) are obtained)

Then, Microsoft Expression blend 3 is opened and a new WPF is created.ProgramIn the program, select project ==> add existion item(select the two files generated in the screenshot to fit the materials a.jpg and B .jpg), add them to the project, and double-click in the project. the OBJ file will automatically display the aircraft in the mainwindow. You can adjust the model size here. In this way, the data of the 3dmax model is successfully converted to the data in the XAML format.

Open the project just created by blend with vs, because the author uses vs2010, so there will beCodeConversion Problems. After the code is converted, double-click the mainwindow. XAML file. You can see that the 3dmax airplane model is successfully entered into WPF.

I believe the following is simple: Add mouse events (mousewheel, mouseleftbuttondown, mouseleftbuttonup, etc.) to gird ). Then there is the specific operation on the 3D object. viewport3d contains the 3D content, viewport3d. camera is like a camera that presents 3D objects in 2D form. Just like watching TV, 3D objects are actually displayed on a 3D plane. This attribute is very important. Its position attribute, lookdirection attribute, and updirection attribute directly affect the presentation of the viewed 3D content. Here, you can scroll the buttons in the middle of the mouse to trigger the mousewheel event, change the camera position, and move toward lookdirection. This gives people the feeling that the object is getting bigger or smaller.

In this example, the operations on the plane are as follows: Scroll the slider forward or backward, press and hold the left button, move the mouse to the left, move to the right, and right-click and move the mouse to rotate the plane.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.