0
\$\begingroup\$

I am newbie in game development. I have read how many shader effects are implemented usually, and I have implemented msot of them by myself. However, now, I have the situation when I have to program my post process pipelines and so is the question: in what order should I do post process effects? Mostly I ask about: SSAO, blur, motion blur, chromatic abberation, fog, shadows... Actually, I am curios about all of them. So, the basic idea of my engine is:

  1. Always draw everything to the texture.
  2. Apply (so called by me - "prePostProcess") effects (lighting, for example).
  3. Apply post process fx (blur and so on).

I understand that as I change the texture sequentially then the result will be different if I change the order in which programs are used to change the texture. Like: chromatic aberration and then blur is different between blur and then chromatic aberration.

I code my game with opengl 4.4 at this moment, so I tagged it so.

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

First of all, you can't list all of the available post processing effects, because only some of them are pre-defined algorithms.

Second, some shaders aren't used in a combination with others. For example, an outline shader would look strange with an SSAO one.

Third, some of the things you mentioned aren't post-processing effects. Shadows are never created with post processing, blur is useless (if you don't use it in a depth of field for example).

Now to get to the actual order:

  • SSAO relies on changes in the depth of the fragments, so applying it after a blur would be pointless (for example depth of field, motion blur, bloom and lens flare counts as blur).

  • Chromatic aberration should happen after any kind of blur. A blur would just make the red and blue regions more smeared out.

  • The same problem occurs with lens flare, an additional blur would just make it worse.

  • Fog also operates in the depth buffer, so it should come before any blur. The order of SSAO and fog shouldn't matter.

  • Every film-like effect (like grain or dithering) should come at the end.

And if you need a different opinion, this is the order Unity does it in:

enter image description here

As a last note, stuff like chromatic aberration, lens flare, motion blur, depth of field, bloom and many others are usually not very welcome in games, especially the latter three. They create a layer of abstraction between the player and his/her character. Keep in mind, that most of these effects were created for movies and not for games (for instance chromatic aberration simulates a defected camera).

\$\endgroup\$
2
  • \$\begingroup\$ There are reasons to use the latter three effects you call out in games. Motion blur can reduce visual judder, strobe, or wagon wheel effects from fast motion rendered in discrete frames. Depth of field is often used to pull the player's focus to particular portions of the scene. And bloom, while certainly easy to over-use, improves the realism of scenes with a large dynamic range, like being in a dim room looking out a window at the bright outdoors — if the light stopped sharply at the window frame with no glare it would appear more artificial. \$\endgroup\$
    – DMGregory
    Sep 3, 2017 at 12:34
  • \$\begingroup\$ @DMGregory I'm not saying that these effects are useless (especially not in cutscenes where controlling the player's focus is key), they can make the game look a lot better, but they have a very bad reputation. The player should be able to turn them off if he wants to \$\endgroup\$
    – Bálint
    Sep 3, 2017 at 12:39
3
\$\begingroup\$

@Bálint's above answer is mostly correct, but you need to be aware Unity postprocess stack you see above is only editor display order. Unity handles it in pretty different order (which is actually objective - like pushing motion blur before colorgrading). In Unity's Postprocess stack (v1) the order is like this:

  1. Ambient occlusion
  2. Screenspace reflection
  3. Motion blur (input is HDR so bright reflections smear badly into solid bright streaks which doesn't look good)
  4. TAA (yes - for me it's weird to stabilize motion blurred, mostly noisy pixels)
  5. DoF
  6. Chromatic abberration
  7. Bloom
  8. Vignette
  9. Colorgrading (with tonemapping that brings values from HDR to LDR)

Next steps operates on LDR values:

  1. User LUT
  2. Grain
  3. Dithering (if grain is inactive)

Eye adaptation is different step which outputs auto exposure multiplier used then in bloom & colorgrading (they use compute shader for it).

Better order would be moving motion blur after colorgrading.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .