Table of Contents

Class PostProcessRunner

Namespace
Gamelogic.Fx.BuiltIn.PostProcessing
Assembly
Gamelogic.Fx.BuiltIn.dll

Runs all post-processes found in children of a given root on the Camera this script is attached to.

[ExecuteInEditMode]
public sealed class PostProcessRunner : GLMonoBehaviour, IPostProcess
Inheritance
GLMonoBehaviour
PostProcessRunner
Implements
Inherited Members
GLMonoBehaviour.FindObjectsOfInterface<TInterface>()
GLMonoBehaviour.FindRequiredObjectOfType<T>()
GLMonoBehaviour.GetRequiredComponent<T>()
GLMonoBehaviour.GetRequiredComponentInChildren<T>()
MonoBehaviour.IsInvoking()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.runInEditMode
Component.GetComponent<T>()
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentsInParent<T>()
Component.transform
Component.gameObject
Component.tag
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.name
Object.hideFlags

Remarks

Intended for the built-in render pipeline.

This script should be placed on a Camera. It calls OnRenderImage(RenderTexture, RenderTexture) on all children with components that implement IPostProcess of the postProcessRoot configured in this inspector. This allows you to have post-processes in separate objects and make it easier to manage if you are experimenting with many processes at the same time.

So to add a post process to your camera:

  1. Add this script to the camera.
  2. Add an empty GameObject in your scene and call it PostEffects (or similar).
  3. Add a child object for each post process you want to add (e.g. AdjustGammaPostProcess), and add the post process script to it. Any script that implements IPostProcess will work.

This class can also be used to group a stack of effects as a single IPostProcess, so it can be used by effects that require an IPostProcess. In this case, you need not add the script to a camera (an empty game object will do fine). In this case, the OnRenderImage method will be called by the effect that requires this IPostProcess.

Methods

OnRenderImage(RenderTexture, RenderTexture)

The function that performs the post process effect.

public void OnRenderImage(RenderTexture sourceTexture, RenderTexture destinationTexture)

Parameters

sourceTexture RenderTexture

The full screen source texture.

destinationTexture RenderTexture

Remarks

A typical implementation uses UnityEngine.Graphics.Blit(UnityEngine.Texture, UnityEngine.RenderTexture, UnityEngine.Material) to perform the post-process effect.