Class SeparablePostProcess<TShaderProperties>
- Namespace
- Gamelogic.Fx.BuiltIn.PostProcessing
- Assembly
- Gamelogic.Fx.BuiltIn.dll
Encapsulates a post process based on a separable filter, such as a box blur.
[Version(1, 1, 0)]
[ExecuteInEditMode]
public class SeparablePostProcess<TShaderProperties> : SeparablePostProcess, IPostProcess where TShaderProperties : SeparableShaderProperties
Type Parameters
TShaderProperties
- Inheritance
-
GLMonoBehaviourSeparablePostProcess<TShaderProperties>
- Implements
- Derived
- Inherited Members
-
GLMonoBehaviour.FindObjectsOfInterface<TInterface>()GLMonoBehaviour.FindRequiredObjectOfType<T>()GLMonoBehaviour.GetRequiredComponent<T>()GLMonoBehaviour.GetRequiredComponentInChildren<T>()MonoBehaviour.IsInvoking()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.runInEditModeComponent.GetComponent<T>()Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentsInParent<T>()Component.transformComponent.gameObjectComponent.tagObject.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.nameObject.hideFlags
Remarks
An effect is separable if it can be implemented as two passes, one in the horizontal direction and one in the vertical, such as box blur or Gaussian blur.
To implement a new separable post process effect
- Define a new class (for example,
BlurPropertiesthat extends from SeparableShaderProperties and override the relevant methods and properties. - Define
BlurPostProcessthat extends fromSeparablePostProcess{BlurProperties}
You can then use BlurPostProcess like any other post process.
Methods
OnDisable()
public void OnDisable()
OnEnable()
public void OnEnable()
OnRenderImage(RenderTexture, RenderTexture)
The function that performs the post process effect.
public virtual void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture)
Parameters
sourceTextureRenderTextureThe full screen source texture.
destTextureRenderTextureThe render target for the post process.
Remarks
A typical implementation uses UnityEngine.Graphics.Blit(UnityEngine.Texture, UnityEngine.RenderTexture, UnityEngine.Material) to perform the post-process effect.
OnValidate()
public void OnValidate()
SetMaterialProperties(Material)
Sets the shader-specific properties on the effect material before each pass.
protected virtual void SetMaterialProperties(Material effectMaterial)
Parameters
effectMaterialMaterialThe material to configure.
Remarks
Implementors should override this method to set the shader's specific properties.
The method is called twice, once for each direction.
The direction vector is automatically set to (1, 0) for the first pass and (0, 1) for the second
pass, and so are the kernel properties: KernelSize, KernelOffset, JumpSize.
Start()
public void Start()