Skip to content

Post Processing

KilaBash edited this page Jul 25, 2022 · 5 revisions

Post-Processing allows you to render specifc fragments and apply vanilla's PostChain to the rendering result. It's essentially an extension of the minecraft pipline.

There seven buuilt-in effects. (v0.1.6)

  • bloom_unreal: bloom effect like the unreal engine
  • bloom_unity: bloom effect like the unity engine
  • warp: warp effect
  • vhs: vhs effect
  • flicker: flicker effect
  • halftone: halftone effect
  • dot_screen: dot screen effect

How to use

PostProcessing effect = PostProcessint.getPost("bloom_unreal");

PoseStack finalStack = RenderUtils.copyPoseStack(poseStack); // have to copy a finalStack for Postprocessing.
effect.postEntity(buffer->{ // rendering with a multibuffersource
  //.... use the buffer and the finalStack here
}); 

effect.postParticle(); // rendering for particles

Add effect for the specific particle via it's json file.

{
    "shimmer": {
        "effect": "bloom_unreal"
    }
}

Create a new Effect

First of all, you have to know how to use the vanilla's Post-Processing:

// to create a new effect, with its name and location of shaders.
static final PostProcessing NEW_EFFECT = PostProcessing.registerPost("new_effect", new ResourceLocation("namespace:effect_name"));
// "namespace:effect_name" requires a json file in the assets/namespace/shaders/post/effect_name.json

Expansions of the vanilla's post

Input target of the specific fragment result: shimmer:input. Output target: shimmer:output

Create a target with Bi-Linear texture sampling:

"targets": [
    {
      "name": "target",
      "bilinear": true,
    },
]

Create a target using a scalable size according to the Main Target, the size of the target will be (scaleSize.width * MainWidth, scaleSize.height * MainHeight):

"targets": [
    {
      "name": "target",
      "scaleSize": {
        "width": 0.125,
        "height": 0.125
      }
    },
]

Here is an example for the built-in bloom effect: Bloom Unreal

Clone this wiki locally