So it’s been a pretty crazy week! My group’s been accepted to Level Up and I’m super excited! It seems like the past couple weeks have been purely dedicated to improving Titanum, and — honestly — I’m not complaining. On Tuesday night I implemented controller support to our game through an API called XInput. It was really straightforward to add, and I feel it actually makes the game a bit more fun! This is mostly because I was able to make use of my Xbox controller’s vibration feature, so shooting feels really satisfying now! On top of this, the Xinput API opened up the possibility of multiplayer… I thought it would be too much work… but the idea kind of got stuck in my head. Needless to say, we now have multiplayer! There’s still a couple problems that I need to fix up (namely how we’re going to handle one player dying) but it works really well.
Here’s a video showing off controller switching and multiplayer. (Unfortunately, since I’m visiting my parents this weekend, I’m doing the multiplayer test by myself)
For the lecture this week we covered motion blur. In terms of photography, motion blur is the result of taking a picture of a moving object. The amount of blur is dependent on the camera’s shutter speed — otherwise known as exposure time. This basically determines the amount of time that the camera’s shutter is open for when taking a picture. The longer it is open, the more blurred a moving object will become.
Motion blur is useful for still photography, as it is an easy way to suggest movement for an object in your photo. In games however, motion blur can be useful for different things. Since games are (usually) already in motion, we can use motion blur instead to emphasize specific actions. In racing games specifically, motion blur is very useful for conveying a greater sense of speed.
Of course, conveying speed through motion blur can also add to the impact of an attack in a fighting game
But mostly, motion blur is used to invoke motion sickness…
In order to achieve the effect of motion blur in games, we can use a pre-made function within openGL called the Accumulation Buffer. How this works, is that the accumulation buffer stores in the current frame (or at least part of the current frame). From here we can then draw the previous frames on top of the current frame. It’s an easy to use effect, however when applying the accumulation buffer to multiple objects it can get very slow. This is because it’s rendering the same scene multiple times. A better alternative would be to use Motion Vectors.
With Motion Vectors, we look at individual “blocks” (or pixels) of the screen. From here we look at adjacent frames (for games, we look at the previous frame) and we determine the velocity between the current and the adjacent (reference frame), where the velocity is just “a-b” or “current – adjacent”
This gives us an approximation of the direction of each pixel on the screen. This way each pixel now stores its own screen space velocity! Aside from motion blur, we’re also able to use this technique for effects like Light Rays!
In the game Dark Souls 2 we can see the use of BOTH Light Rays and Motion Blur in the same scene.
The light rays really add to the serenity of the environment, while the motion blur (which is only applied to the player’s weapon and shield) helps to emphasize the urgency of the player’s attack. It’s interesting to see that the developers must have had multiple motion vector FBO’s for both the player’s weapons as well as the environment’s lighting.
Before I end this post, I was wondering if I could get my updated blog post marks? Wasn’t sure if this will be my last post or not!