Wednesday, January 25, 2012

Computer Graphics: Graphics in Games Week 3 - Them Crazy Glitches

Them Crazy Glitches

Instead of focusing one game like I did last week, this week I am going to try something different. How many times have you played a game, only for something ridiculously hilarious happening? The answer is most likely many times depending how much you play. I’ve been a victim of this and they can range from downright frustrating to absolutely laugh inducing. Now, pretty much every glitch that happens relates to the code used, but that doesn’t mean we can’t talk about it. Graphics is all about code as well and I will try and highlight some examples that I remember running into.

Exploding characters

Now we aren’t talking about exploding in a fiery ball of destruction, nor exploding into blood and such. We are talking about crazy exploding models that go practically insane. I can really explain this without showing it first.

You can see the character "Morrigan" causing some major issues.

Now, having watched that video, you can clearly see what I mean. The character looks exploded and now after some learning in my graphics course I can explain (partially) why that is. Now let’s start with the basics.

Every model in a 3D game is comprised of basic components known as vertexes (points). There can range from hundreds to thousands or even more of these vertexes depending on how complex the model is built. Now in order for games to properly read these models, these vertexes need to be converted into polygons. All that means is connecting these vertexes to form shapes, almost always triangles as they are the shape that computers can process the most efficiently.

A sphere compromised of vertices. I stretched out one face which made it change like this.

Those are the basics that comprise models. Vertexes and triangles, though of course we add in faces and normals which help to make up the surfaces of our model. Without the faces and normal, all you would see is a “wireframe” of a model. Meaning you only see a bunch of connected lines. Not as interesting. We add in texture coordinates next so that we can place textures onto a model, so that it isn’t just a bunch of gray, and now has color and even closer to what we want our final model to be, maybe it already is. Factor in bump mapping (mentioned in a previous blog) to define the shape of a model and we are pretty much set. That’s just a basic look on models, it is easier to understand than it is to actually implement, but enough about that.

Another example of a vertex being stretched too far in the Elder Scrolls 4: Oblivion

So we saw how Morrigan was exploding all around right? Well the reason for that is, though I am not sure WHY it happened, I do know what happened. In certain animations, due to some error in the system, Morrigan’s vertexes have been misplaced to strange places on the screen. Now, remember how we said we connected the vertexes to form triangles right? Well in each triangle, our faces and textures lie there, so to put it in perspective, normally we would see a triangle containing a part that represents what looks like a tiny portion of his face. Now if we position that triangle REALLY far away from its original position, and we are still calculating the face and textures based on that triangle’s position, whoa! Morrigan’s face now has a giant spike in it, and now it’s stretching off the screen!

So let me go over it one more time, some or many of Morrigan’s vertexes are out of place, going into strange directions or positions where they should not be. We connect those to form the triangles and therefore form the figure of our model with our faces, and then place textures with help from bump mapping to form the final look of the character. Result is, madness to say the least.

Another example of the madness of moved vertexes

Hardware Failure

Now Marvel vs Capcom 3 isn’t the first game to do this obviously, there are obviously many more games that have had this problem before and I will show you them!
Part of the reason that these glitches appear could be due to faulty coding, but the majority of the time it’s due to failing GPU (Graphics Processing Unit). The GPU is used in the majority of games now to render these vertexes and triangles, etc. If a GPU is failing, it won’t be able to properly render all the vertexes, or it could have errors such as reading in the vertex locations wrong, which is why we see the exploding in many directions. This is the case with Marvel vs Capcom 3 as well even though it’s on consoles. I personally have never ever run into this problem and neither have many others, while for specific users they have run into these issues.

An example in Rage by ID software, glitches due to improper drivers.

Another reason can be due to faulty drivers provided by the GPU card companies. Drivers that attempt to update and improve features but can often cause them to have issues rendering in certain games. There are many game engines out there, and many of them have different coding to read the vertexes and such. It becomes difficult for graphics cards to work with every single game if they attempt varied methods of rendering, which is why even the most up to date GPU cards can still be victims to these exploding vertexes.

But otherwise if it's not the hardware failing, it's the software failing. Improper calculations or algorithms, calculations that get thrown off by external factors. Using too much power on the GPU as to make it fail enough so that the calculations are thrown off. Many many things can occur and here are some examples of the results.

At first this looks like a simple physics glitch but then look again. The horse is melting…

Horses are the new see-saw

Texture coordinates are going in weird places, so now the foliage is everywhere.

A new breed of super soldier.

Though there are physics glitches, the state that models can be left in make the models look… hilarious.  That's due to the ragdolls not having realistic reactions, which can be very hard to program. Some companies just go for "Death" animations, or a combination of both. Some just go for pure ragdoll and here is the result in Skyrim.

Of course it doesn’t have to be only vertexes that are missing, it could just be textures that are missing. Again these are probably due to failing hardware.
Rainbow Gears of War 2

Model Replacement
Other glitches could be simple model replacement. The horse that is talking used to be a human model. Note how he is using human animations still!
A horse with dreams of flight.

I however have absolutely no clue how this one occurred, the particle effects coming out from the player’s weapon (Gravity gun) in Half Life 2 are for a lack of a better term, exploding like crazy. I must try and look more into this one.
Avert your eyes if it's too bright

Poll Time!
There are way too many glitches I would like to share but I will stop at here for now, these are just a few of them that I remember. I'd like to know what you all think about glitches in games, so I've decided to make a poll to go with it. Go look for more yourself and hope that you might run into them in a non-game breaking scenario.

No comments:

Post a Comment