Post Fx

Having a background of working on some movie stuff I can't underestimate the way in which colors can affect the atmosphere of a scene, be it game or movie. Thus it was clear that color correction/manipulation functionality should also be available in the new engine.

Among that I added support for screen distortions which can be extremely useful when wanting to create a perception of glass, heat, explosion shockwaves or being drunk and many other things. The way in which the distortions work is pretty common and simple. Before rendering the actual scene  to the screen a texture is created which has it's base color as dull brown ( precisely RedGreenBlue 127, 127, 0 or 0.5, 0.5 ,0 ). Different sorts of psychedelically colored shapes are then rendered on the texture.

The color in the texture tells what is the relation between a pixel's position in the original rendering and when the rendering is shown on the screen. The red component of the color tells if the pixel drawn on the screen should be picked from left or right relating to the position of the current texture coordinate (sounds more complex that it is).  Accordingly the green component tells how much the position should be moved up or down. When the final image is drawn on the screen each pixel gets an offset based on the color in the texture.

The biggest benefit from that approach is the fact that the same normal maps that are used when calculating the lighting can also be used to distort the image. Thus the rock composed from the textures shown on the side could be made look glassy just by telling the game it should be rendered that way. No additional textures would be required.

Well, it's video time again:

Apr 2, 2010

Today I added functionality to use different sorts of post-fx shaders in the game. The only shader at the moment makes the image grayscale so there's not really anything to see yet.