Minko 1.2: Easier Post-Processing Effects

I’ve just pushed an update on Minko’s GitHub repository. It is tagged as version 1.3 1.2. This new version introduces new helper classes to make it easier to write post-processing effects.

The New Simplified Post-Processing API

Writing a single pass post-processing effect has never been easier, here is how to write a simple greyscale post-processing shader (go to the end of the post to see it in action):

And here is another example to create a “vignettage” effect (it darkens the corners of the viewport):

And then, where you initialize the Viewport:

As you can see, writing a single pass post-processing shader is really simple:

  1. Extend the PostProcessingActionScriptShader class.
  2. Override the getFinalColor() method to implement your shader.
  3. Set the Viewport.postProcessingEffect property to a new SinglePassPostProcessingEffect using your shader.

Multipass Post-Processing

If you need to write multipass post-processing effects, it’s just as simple as when you work with a rendering effect: implement the IEffect interface and create an IEffectPass class for each pass or reuse the provided SinglePassEffect class (because a single pass effect is… a single pass).

In Blacksun, we use this technique to create the HDR Bloom effect that uses 5 passes:

Single Pass HDR Bloom

I also tried to implement the HDR bloom effect in a single pass. I’m not sure about how well it performs compared to the multipass version, but it should be faster at least:

Demo

I modified the Gravity demo to use the greyscale post-processing shader above and see if it works well with the picking. Indeed, the picking renders directly to the backbuffer so I was affraid it might interfer with the post-processing. But there is no problem: the SinglePassPostProcessingEffect uses a priority of -1.0 to make sure the associated RendererState will be executed after anything else.

Click on the picture below to launch the application (press P to enable/disable post-processing):


The modified code looks like this:

If you have questions or suggestions, you can post on Aerys Answers. If you want to share post-processing shaders examples, please post in the AS Shader examples thread.

  • Pingback: Minko levels up to 1.2 | Aerys' Blog()

  • yonathan

    hey,
    first i have to say you are doing amazing job!!!!!

    i using the minko 2.0b version
    and i trying to reuse the code from “Single Pass HDR Bloom”

    but the method “blend” is undefined.

    i am new to shaders and i don’t know with what to replace the blend method.

    thanks!

    • Promethe

      Hi,

      first i have to say you are doing amazing job!!!!!

      Thanks 🙂

      but the method “blend” is undefined

      The blending method is now in the BlendingShaderPart class.

      Have fun!