1 / 25

3D Flight Simulator for CE

3D Flight Simulator for CE. Balaban Nir Lander Shiran Supervisor: Futerman Yan. The Problem. Building a 3D Flight Simulator for iPaq computers based on Direct3D. Performance optimization – the iPaq is not a powerful graphic machine because lack of proper hardware,

walker-clay
Télécharger la présentation

3D Flight Simulator for CE

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 3D Flight Simulator for CE Balaban Nir Lander Shiran Supervisor: Futerman Yan

  2. The Problem • Building a 3D Flight Simulator for iPaq computers based on Direct3D. • Performance optimization – the iPaq is not a powerful graphic machine because lack of proper hardware, therefore, the application must be efficient. iPaq H3975

  3. Project Goals • Checking the performances of the iPaq computer • Picture quality • Speed • Memory • Optimize the above • Acquaintance with the Direct3D Windows CE environment

  4. Solution Overview • Building a 3D surface in the Direct3D environment (referred as “scene”). • The user view-port will be through a “camera” that will be moved around the scene. • A timer will schedule the movement of the plane.

  5. Solution Overview (2) • Each quantum a few actions will be taken: • Checking for user keyboard interrupts. • Moving the plane forward. • Rendering the new scene seen. • Checking whether or not a crash happened.

  6. The Direct3D Enviroment The Direct3D enables the developer to a build a 3D object easily. Direct3D doesn’t require some special hardware but it is "device independent", means it works the same way with any hardware given. Because of this property we found it best to use Direct3D for this project.

  7. The Direct3D Environment (2) The Direct3D environment is made of a group of 3D object in a 3D world, which we call a “scene”, a camera which represents the point of view for the scene. The 3D objects are made of vertices in the 3D World that build a solid model by connecting the vertices with triangles shape.

  8. The Direct3D Environment (3) The Direct3D handles most of the mathematical and algorithmical requirements for building a 3D scene. Some of them are listed below: • Z-Buffer • Shading • Clipping and Transformation • Projections • Etc…

  9. Solution The application consists of 3 main parts: • 3D terrain object • Plane movement controller object • Managing the objects

  10. z x Solution – 3D Terrain Like any 3D object in Direct3D, our terrain consists of vertices. The vertices are placed uniformly in the XZ plane:

  11. Solution – 3D Terrain (2) Every 3 vertices are connects to form a triangle.

  12. y Solution – 3D Terrain (3) Each vertex has its own height (Y value) and a feeling of mountains is formed. The heights are chosen with a mathemetical formula. the vertices are samples of the mathematical mountains.

  13. Solution – 3D Terrain (4) In order to achieve an infinite terrain, we created it cyclically so when the plane gets to the edge of the cycle it just “hops” to the other edge. Every terrain cycle is divided to 4 parts in order to create a richer terrain.

  14. Solution – Plane movement controller In order to create a feeling of flying, the camera moves along the terrain according to the user requests. For that, an object that control the plane movement is required.

  15. Solution – Plane movement controller (2) The object handles 3 main missions: • Saving the plane location and direction, and updating them. • Calculating where to place the camera each quantum, according to plane position, direction and speed. • Cyclic movement – when the plane gets to the edge, the object is responsible to move it to the other edge.

  16. Solution – Managing the objects At first the objects must be built and given some parameters: • Creating the vertices. • Coloring each vertex by its height. • Pre Mathematical calculation. • Initializing the plane position at start.

  17. אתחול המשטח מחלקת המשטח מחלקת היגוי המטוס אתחול משתני המטוס האם נלחץ מקש ? כן לא קידום משתני המטוס האם התרסקנו? האם נלחץ 'Q'? לא כן כן לא שינוי משתני מצב ציור המשטח render יציאה Solution – Managing the objects(2) After Initializing the objects the application waits for messages, from the user or the timer, and acting accordingly.

  18. Coping with Windows CE One should keep in mind when he transits Windows applications to Windows CE about some facts: • The Pocket PC is not a powerful machine and “heavy” effects (like texture, lighting…) might not work properly. • There are function that exits in Direct3D for PC and doesn’t in Direct3D windows CE edition. Therefore, one must check every function he adds to the application.

  19. Coping with Windows CE (2) • There are some functions that does exist on Windows CE, but for different reasons, the parameters were changed slightly. • Not like PC computers, the pocket PC has other kind of hardware. There is no keyboard, and the presentation on the screen is different (full screen mode…)

  20. Optimizations As mentioned before, the greatest challenge is to optimize the application, so that it will run as fast as it can. In order to do that some actions had been taken: • Lighting – Adding lights to the scene result much calculations in real-time. To save these calculations, the lighting algorithms were disables, and each vertex got its own color in the initialization.

  21. Optimizations (2) • As mentioned, the resolution of the vertices building the mountain effects its shape and the duration of the rendering time. There is a trade-off between these two elements. As higher the resolution, the slower the application. There we must optimize the resolution so the speed will be reasonable and the terrain will look properly.

  22. Optimizations (3) The resolution in he application is represented by the variable DIF, which is the distance (in Direct3D units) between two vertices.

  23. Optimizations (4) • Shading – In Direct3D there are two possible shading modes: Flat and Gouraud. • Flat Shading –Color each polygon with constant shades • and intensities according to the polygon’s • normal. This is the most simple and fast shading because there are no calculations to make.

  24. Optimizations (5) • Gouraud Shading – Compute exact shading and intensity values for the vertices of each polygon, • using exact normals at vertices. • Interpolate (in image space) colors, for • interior pixels of polygon. • This is the most “expensive” way of shading but the results are much better.

  25. Optimizations (6) • Clipping – The fewer vertices we render, the faster the render is. Therefore distant vertices, that the user can slightly notice should be cut off the scene.

More Related