Friday 27 September 2013

Game Engine Design & Implementation - Blog#2

There was one class we got the Doom engine and we tried to see how they do things in a game engine. Later on that day, I was hoping to see how it would work and how is it different from the game that we are making for GDW. So I started to discuss it with my fellow team member, Michael(@MikeDaProgramma). One thing he brought up was the culling function.

Culling function have impact on the efficiency of the game as it determines what is going to be drawn on the screen. Whether it is a first-person shooting game(eg: Quake) or third-person view(eg: GTA), many objects are loaded to screen and ready to be drawn. But how do we know what objects need to be drawn on the screen? A first-person view and a third-person view may use different culling methods. For example, a game like Doom may use portal culling and a game like GTA may implement occlusion culling.

Last year GDW, we did it by setting a radius around the character. Anything within the radius will be drawn and anything outside of it will be remove from the screen. This worked for us because we had a top-down view; this will not work for a third-person view.
As the person moves to the left, the chair disappears, apple stays on the screen, and the kitty enters the scene.


This year, we want to make a big city involves with many geometries in the environment. So what would be an ideal way of doing it? We discussed that it could be done using occlusion culling, described in the following diagrams.
Since the building is in front of the camera, it is going to be drawn, but not the tree that is being cover at the back.
Although the building blocks most of the tree, part of it can still be seen on the camera, therefore, the tree will be drawn too.

Since we are building a city, there will be lots of tall building that will cover many other objects behind it that does not need to be drawn. Therefore, if we can decide what should be drawn and what does not, we can definitely optimize the system and speed of doing things(eg: rendering). There are third part libraries that are dedicated to solve this problem, for example, Umbra 3 (http://www.youtube.com/watch?v=bYZqlBzt_dU). However, since it costs thousands of dollars, it is not an option for us. By culling geometry that cannot be seen, we can signifcantly lessen wasted GPU usage allowing us to put more effects(eg: more lights, particles).

No comments:

Post a Comment