Monday, November 1, 2010

A long time ago


Hey, soft particles. Where did they come from?

Thanks to the profiles from the followers here, I noticed there are quite a few blogs that tell a fictional (game) story. Like a book, adding a new chapter each week(or month). Or like Halflife2, adding a new episode each... hundred years. Come on man, hurry up already. Anyway, how about this? Put on your pyjama’s, grab some hot chocolate milk, and ensemble around the fireplace. Grandpa is going to tell.

---------------------------------------------------------------------
Day 7, Sunday 05:01 AM
---------------------------------------------------------------------
Didn't forget to turn off the alarm, but I woke up anyway. Normally I would feel relieved and turn around with a little smile. “Just a mistake, it's weekend", that wonderful feeling. But I stood up and left bed. Sleeping here doesn't feel comfortable. There is no light in the bedroom, it's warm, moist, oppressive. Even after a week the whole apartment still feels strange. Not hostile, but certainly not like home either.

Weekend, Sunday, my day off. Maybe some relaxation will break the tension. Not that my new job has been hard on me though. Mopping some floors, painting a wall, replacing a light bulb, locking the hall doors at 23:00. Or delivering post. As a caretaker of this building, I make long days, but there is no pressure. So far I haven't seen a chief or boss anywhere. Only a few instruction letters and a couple of calls from the... boss. Don't know his name really.


Thinking about it, I haven't seen a single soul the entire week at all. No co-workers, no residents. No elevators going up or down. No one looking in his mailbox, no one going to work. Nobody. The apartment at the right from me seems to be uninhabited. And the apartment on the left... well there is none. There is no door where it's supposed to be.

Now maybe my floor just isn't really occupied. I haven't been at the lower floors yet. There should be a few shops and small restaurants there. Yet, strange enough I smell, see and even hear traces of life. No matter how many times I clean up, there is new litter every day. In my own hall, the "old woman" painting has been replaced with a windmill. And even my own mailbox gets filled by... some one. But more than that, I can hear them. Television shows behind locked doors, gramophone music, whistling kettles, creaking pipes, footsteps. Ironically, all the silence makes you hear the smallest details, giving a whole new world of noise.


Yes I could use some distraction before I start seeing things. A walk in the park maybe. If there is one nearby. Didn't have a proper look from my balcony yet, but I can't see the streets. Too dark and too much fog this autumn. To be honest, I have no idea how high I really am. The stairway shows a number '1' at my floor, but two floors lower it's number '12' again. All I can see from here are the upper-floors and rooftops of other apartment blocks. And come to think of it, I haven't seen much of living there either. As I write, I'm looking right now through the kitchen window. The only lights that shine in that building across are the cheap corridor chandeliers...
Then again, it's Sunday 05:12 right now.
------------------------------------------------------------------------------

Excuse me for the writing style, English is hard enough already, let alone writing a story. But it should give a few details about the game story / setting. Hope you like it.



See that? This cloud of crap is just a bunch of quad-sprites. Nothing fancy, however, see the difference? In the left picture the quads clearly intersect with the environment (floor, walls, ceiling). In the right one they still do, but a little trick hides this ugly artifact.

Now the technical portion for this week. Although this isn't really urgent at the moment, it has been added anyway; Soft Particles. All the cool kids in town already have them, Unreal5 has Soft Particles?! No way! See? Can't do without.

Luckily, implementing this technique is as easy as smearing peanut butter on your head. For a change, you won't need 6 different passes, new types of geometry data, or complicated shaders. The only thing you need is a depth-map. If you are using DoF, SSAO or other (post)effects, chances are very big you already have such a texture. If not, you should really start making one. A depthMap rendered from the viewer perspective is like potatoes or rice, a basic ingredient for many dishes.

How does it work? Just render your sprite as usual, but include the depthMap. At the end of the pixel shader, you compare the scene depth with the particle depth. If the difference is small, it means the particle pixel is about to intersect the environment. If so, fadeout that pixel with

< vertex shader >
Out.vertPos = mul( modelViewProjMatrix, in.vertPos );
Out.projCoords = (Out.vertPos.xyz + Out.vertPos.www) * 0.5f;


zScene= tex2Dproj( depthMap, in.projCoords );
float difference = saturate( (zParticle - zScene) * factor );
// The smaller the factor, the bigger the fadeout distance.

// Now the nVidia paper I read about this adds a little more juice with this // smoothing function:
float softF = 0.5f * pow(saturate(2*(( difference > 0.5) ? 1- difference: difference)), curveStrengthFactor );
softF = (difference > 0.5) ? 1-softF : softF;
result.alpha *= softF;

And that's pretty much it. Not a next-gen graphic blaster technique, then again it comes at a cheap price, and obvious intersecting particles is so 2006...


Movie? I need 3 more sounds, make one shader, and tweak the camera. But more difficult is getting the damn thing recorded. FRAPS is a little bit slow, and the recorded sound is even more crunchy than your grandma’s unshaved legs. You'll be updated soon.

America's funniest home videos

3 comments:

  1. The Story is awesome, I like how surreal the situation is for the caretaker, also the engine is looking Amazing, you seem to be making great leaps and strides every week! I wish I had a quarter of your productivity.

    ReplyDelete
  2. Now that is positive feedback :) Maybe once in a while, I could make some more little stories like this. Pretty quite difficult though. Not only writing proper English, but also keeping it mysterious. I shouldn't spoil things at this stage!

    ReplyDelete
  3. I agree with Julian. The story is really great. You get the feeling that something's wrong, but you can't tell exactly what.

    ReplyDelete