Download presentation
Presentation is loading. Please wait.
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 1.Building a 3D surface in the Direct3D environment (referred as “scene”). 2.The user view-port will be through a “camera” that will be moved around the scene. 3.A timer will schedule the movement of the plane.
5
Solution Overview (2) 4.Each quantum a few actions will be taken: 1.Checking for user keyboard interrupts. 2.Moving the plane forward. 3.Rendering the new scene seen. 4.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: 1.3D terrain object 2.Plane movement controller object 3.Managing the objects
10
Solution – 3D Terrain Like any 3D object in Direct3D, our terrain consists of vertices. The vertices are placed uniformly in the XZ plane: z x
11
Solution – 3D Terrain (2) Every 3 vertices are connects to form a triangle.
12
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 y 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: 1.Saving the plane location and direction, and updating them. 2.Calculating where to place the camera each quantum, according to plane position, direction and speed. 3.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
Solution – Managing the objects(2) After Initializing the objects the application waits for messages, from the user or the timer, and acting accordingly. אתחול המשטח אתחול משתני המטוס מחלקת המשטח מחלקת היגוי המטוס האם נלחץ מקש ? האם התרסקנו? קידום משתני המטוס יציאה האם נלחץ 'Q'? ציור המשטח render שינוי משתני מצב כן לא
18
Coping with Windows CE One should keep in mind when he transits Windows applications to Windows CE about some facts: 1.The Pocket PC is not a powerful machine and “heavy” effects (like texture, lighting…) might not work properly. 2.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) 3.There are some functions that does exist on Windows CE, but for different reasons, the parameters were changed slightly. 4.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: 1.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) 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) 3.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) 4.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.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.