Sunday, July 3, 2011

Forever young

Easy, the second part of the water tutorial will come. Got to finish some more rooms first... Last week I spend most programming-time on adding motion blur on rotating objects (see bottom), improving Cascaded ShadowMaps for long-range lights such as the sun, and a fancy loading-screen system! We programmers all know debugging means changing 2 letters, recompile, and run the program again for the 1235th time. When having long loading times (10 seconds or more), this can get quite annoying. So here a little tip to make all the waiting a little bit more bearable; show your concept art!

Concept artists do their best making teasing images or good reference work. By now, we got a whole truckload of old-flat photographs and the likes. So why not showing a few random pictures while waiting? Just to bring you in the mood, and to make sure all that hard work won't be forgotten.

See? There are still parts missing. And the brown chunks on the water should be ice...

Boy, all that talk about games. How old are you? I’m 27, and could become a grandpa within 13 years in theory already (didn’t count the 6 year old moms). Well she’d better not, but what I’m trying to say is: aren’t we a little bit too old for playing games? Or like me, spending thousands of hours trying to make one? Uhm… although I’m not playing that often anymore, and although the impact and charm isn’t the same as ten years ago, I still enjoy them. Mom cooking, little daughter drawing “things”, daddy shooting cowboys in Rockstar’s Red Dead Redemption. Which is an absolute masterpiece by the way, way deeper than the GTA series.

Yet, when someone asks about my hobbies, game-programming is often replaced with “doing creative stuff” (or sporting, yeah right). When colleagues at work ask “how did you learn all that stuff huh?”, I answer with “School and a little bit fooling around at home”. While the fact is that most of the experience comes from the endless attempt to make games. It’s just not cool to admit you’re doing kiddy things against a bunch of non-digital workers smeared in oil, even not when having a cigarette in the corner of your mouth.

Needless to say, openly telling your exciting Super Mario adventures and your boy dreams of being a muscular Doom Space Marine is not exactly what you tell the girls either. Grown men drink beer, demolish things, drive motorcycles and shit without toilet paper. Ok, the modern metro-man shaves legs, knows everything about expensive perfume and hits the club every Tuesday. But neither of them plays games. Not done. Just like you shouldn’t play with Lego, read superhero comics, draw bad monsters, or enjoy Commando with Arnold Schwarzenegger at my age.

Talking about action movies. This is the Radar-Station (work in progress), our test playground map for the object Editor I mentioned a couple of times last posts.

Of course, many people do have a secret Marklin modeltrain platform on their attic (where the wife doesn’t come). Oil platform workers play Pokémon on the pink NDS of their girlfriend. And just look how excited all the boys are when the word “Lego” falls. Tssssk, bet what happens if you throw a box of Lego between a bunch of full-grown drunk men on a party. Happy like never before. Being full-grown sucks, but we have suppress our feelings anyway. Otherwise the guys at the office will laugh, and your wife is too ashamed to walk in public with you.

Basically, “growing-up” means throwing your fantasy overboard. Because that’s what really happens. And whether you like it or not, sooner or later you start noticing Rambo III isn’t as funny as it used to be. Superheroes are kind of lame, Duke Nukem isn’t real, and instead of imagining your own action-packed stories, you lazily let the TV do all the work. Or maybe you read a book. Just as long as you don’t have to surrender yourself to your own fantasies, because that’s childish.

Some give a brave struggle, others fall quickly. But we all get old sooner or later. And for what? Give yourself a pat on the back. Because you didn’t only grow up(7 years after your girl, as she claims), you also got officially boring due the lack of fantasy an impulsive thinking. Perhaps resulting in the so called midlife-crisis, ten years later, as you finally realize you did nothing but working, watching TV and adapting yourself to age, wife, kids, environment, and the “norms”. Shit, you could have played Counterstrike for at least five more years, or maybe still even drink beer and laugh about farts every Saturday with fellow 40 year old childish friends! Now you suddenly got to compensate with parachute jumps and climbing a mountain.



Now seriously. Isn’t it a pity we hide or even discard our hobbies, loves and fantasies just to prove our maturity? When looking at my little daughter, it reminds me how special little things once were. Every year I hope to catch that nostalgic feeling when setting up the Christmas tree, but after two days I’m not even looking anymore. But as a kid, I was fascinated just by the red and green colors of those tree lamps. The whole atmosphere could become exciting, just by adding some colors, sounds, a specific smell or event. Kids are still unbiased, open for everything. Life is a big adventure, and when they play they live their fantasies, unashamed, pure. Doesn’t that make you jealous sometimes? At least they are still happy with everything they see and do.

I’m Goddamn happy with my game-programming hobby. Childish or not. As you may guess, my grownup girlfriend doesn’t really understand either why I’m wasting so much time behind the computer. Programming a game… ok… But for me, it feels like the last station between childhood and maturity. Already lost a lot of luggage when it comes to absurd humor, farts, partying and building fantasy cities on the attic. So please! Let me be young and dream away in my fantasy for a little longer! And if you think that’s childish, maybe. But at least I’m happy with it! Touché.

If fantasies about old barracks in spooky environments are already childish, then how the hell could a man think of Mushroom Kingdom, Harry Potter, Star Wars, or Family Guy? Exactly. Screw them, just use your fantasy and be proud of it, no matter what they say!


Motion blur on rotating objects?
---------------------------------------------------------------
Not a very high quality blur, but at least it’s cheap and easy. For a good description, check this link:
GPU Gems 3: Motion blur as a post effect
In turbo-short, perform this post-effect on the whole screen as follow;
- Calculate the previous (screen)position of each pixel by using the preview modelview matrix
- Calculate the 2D motion vector by subtracting the previous position from the current pixel position
- Create a blur-streak, using the motion vector to offset the texcoords.

This creates a blur while (quickly) rotating the camera. However, it does not make fast moving/rotating objects blur by itself. Got to give a helping hand. In the earlier passes, I also store the motion vector in one of those buffers. Just like you can store depth in a texture, you can also store a 2D or 3D velocity. Calculating this velocity is easy. For each object, store the previous matrix. You know, the position / rotation matrix you would set with glLoadMatrix before rendering your object. In the (vertex)shader, use the current and previous matrix to calculate 2 world positions. Subtract them to get the velocity.

Although somewhat more work, you can do the same trick for animated characters if you pass all previous bone matrices as well. This allows to blur fast moving limbs, such as E.Honda's Hundred-Hand-Slap. Now back to the final step. Just sample the motion vector and add it to the camera motion. Done. Burp.


We still have to produce more textures, and then fill the rooms with objects. But it is a start.

2 comments:

  1. I think you're quite right. Adults follow a (rather false) image of perfection just to get accepted by others. When i look at children i can clearly see that i lost something precious.
    BTW I'm following your blog and believe it or not you're my idol in game development. Keep on rocking man.

    ReplyDelete
  2. Hehe, glad you enjoy it. Feedback, certainly the positive ones, make it worth to keep reporting!

    ReplyDelete