Skip to content

Postprocessing Pipeline

Compare
Choose a tag to compare
@avilapa avilapa released this 20 Dec 20:01
· 20 commits to master since this release
4730b1c

screenshot_147

Changelog at the end!

Post-processing (& PRE-processing!)

One of the key parts of building a PBR material model is being able to capture the environment and process it so that you can later use it to calculate indirect lighting, specular reflections, and others. In my case for example, I need to get irradiance maps out of a cubemap. This kind of process is quite expensive and cannot be done each frame (note: It can be done quicker using other methods involving Spherical Harmonics), that is why I need to have a way in the engine to handle pre-processing (at least that is what I call that!).

From my point of view, the kind of pre-processing I have in mind is very similar to a post-processing effect (in the way that both have to render a material, but they may need some textures to output the result, a framebuffer), only that the pre-process is done once (or once every a number of frames).

Render Pass

The last time I had to implement a post/pre-processing pipeline, I decided to make all of the actual post-process objects inherit from the Material object, as the only difference (mostly) would be the need to add a framebuffer object and some helper functions to retrieve the texture outputs.

This ended up creating some confusion, because even though they were so similar, you cannot replace any material with a post-processing material, it just won't work (and it does not need to either...) and vice versa. So this time I decided to make them different, unrelated objects: Material and RenderPass. They both implement similar functionalities, and they both use the Material / MaterialInstance workflow I wrote about in the last Release notes.

Camera Composer

The Composer is an object that I really like to have in an engine, but it can be tricky to make it properly (and properly flexible). It is still not finished, just a simple version of it is added at the moment, but the main idea is for it to be an easy-to-use post-processing pipeline organizer.

It has to be capable of receiving new RenderPass instances with an specified relation with each other and create a queue of execution that is updated automatically.

What I mean by specified relations is that each pass takes some input textures that have been previously set, but others will come from the actual scene, or other passes' results.

For example, you having this simple pipeline:

  1. SSAO-Compute
  2. SSAO-Blur
  3. SSAO-Blend

The SSAO-Compute pass needs receive the scene as an input, and it will output an ambient occlusion texture that the SSAO-Blur pass will process. But the SSAO-Blend needs to have not only the original scene texture, but the SSAO-Blur blurred SSAO texture as well in order to blend them in some way and output the final scene to the screen.

Apart from this basic concatenating stuff, it also manages the actual pipeline, so different composers can be created with relative ease to implement forward, deferred and other custom pipelines, and replace them with a click!

I am still not 100% sure how I will create this dependencies in an easy-to-expand, readable manner, but you will most likely know soon. Last time I did it, I managed to make it very readable and easy to configure, but no user-expansion was contemplated.

Coming (very) soon

  • RenderPasses to be able to render the scene instead of a quad?
  • Pre-processing effects for IBL components and environment mapping, as well as BRDF texture LUT creation.
  • Most post-processing effects (FXAA, SSAO, Blur,...).

Coming (not so) soon (but quite!)

  • First implementation of a PBR material model.
  • Procedural Sky material.

Changelog:

  • Added Camera Composer class and delegated all Camera System rendering methods to it. The Composer acts as a render pass organizer. Different passes are given in a specific order and they are concatenated and rendered automatically. Each camera can have different configurations.
  • Added Negative and Grayscale one-pass-filters.
  • Added IBL light component (still empty!).
  • Added Log in the Editor.
  • Added new UI for the Camera, and the Skybox.
  • Camera can now choose between rendering a solid color and a skybox. If no skybox is available, one can bre created from the Lighting menu.
  • Moved some files into folders for better organization.
  • Modified a bunch of include routes to do more forward declarations.
  • Added core_minimal.h include file for examples to have all general work includes.