Class SeparableRendererFeature<TShaderProperties>
- Namespace
- Gamelogic.Fx.URP.PostProcessing
- Assembly
- Gamelogic.Fx.URP.dll
Implements a separable post-processing effect for the Universal Render Pipeline using two render passes.
public class SeparableRendererFeature<TShaderProperties> : ScriptableRendererFeature, IDisposable where TShaderProperties : SeparableShaderProperties, new()
Type Parameters
TShaderPropertiesThe type that defines the shader properties and kernel configuration for this separable effect.
- Inheritance
-
ScriptableRendererFeatureSeparableRendererFeature<TShaderProperties>
- Implements
- Derived
- Inherited Members
-
ScriptableRendererFeature.isActiveScriptableRendererFeature.OnCameraPreCull(ScriptableRenderer, in CameraData)ScriptableRendererFeature.Dispose()Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)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
This renderer feature is the URP counterpart to the built-in
SeparablePostProcess<TShaderProperties>.
A separable effect is executed in two one-dimensional passes:
- A horizontal pass with direction
(1, 0). - A vertical pass with direction
(0, 1).
This reduces the cost of filtering operations such as box blurs and Gaussian blurs compared to a full two-dimensional kernel.
The feature creates two materials from the same shader and enqueues two render passes at the configured UnityEngine.Rendering.Universal.RenderPassEvent. Kernel parameters and other shader properties are applied automatically before each pass.
To implement a new separable URP post-process:
- Create a subclass of SeparableShaderProperties defining the kernel and shader parameters.
- Create a concrete renderer feature inheriting from SeparableRendererFeature<TShaderProperties>.
- Add the renderer feature to a URP renderer asset.
Methods
AddRenderPasses(ScriptableRenderer, ref RenderingData)
Injects one or multiple ScriptableRenderPass in the renderer.
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
Parameters
rendererScriptableRendererRenderer used for adding render passes.
renderingDataRenderingDataRendering state. Use this to setup render passes.
Create()
Initializes this feature's resources. This is called every time serialization happens.
public override void Create()
OnValidate()
public void OnValidate()