Class PostProcessRendererFeature<TShaderProperties>
- Namespace
- Gamelogic.Fx.URP.PostProcessing
- Assembly
- Gamelogic.Fx.URP.dll
Implements a simple URP post-processing effect using a single shader and a single render pass.
public class PostProcessRendererFeature<TShaderProperties> : PostProcessRendererFeature, IDisposable where TShaderProperties : ShaderProperties, new()
Type Parameters
TShaderPropertiesThe type that defines and applies the shader properties for this effect.
- Inheritance
-
ScriptableRendererFeaturePostProcessRendererFeature<TShaderProperties>
- Implements
- Derived
- Inherited Members
-
ScriptableRendererFeature.isActiveScriptableRendererFeature.OnCameraPreCull(ScriptableRenderer, in CameraData)ScriptableRendererFeature.SetupRenderPasses(ScriptableRenderer, in RenderingData)ScriptableRendererFeature.Dispose()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.InstantiateAsync<T>(T, InstantiateParameters)Object.InstantiateAsync<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)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 class is the URP counterpart to the built-in
PostProcess<TShaderProperties> component.
It manages shader lookup, material creation, and render-pass injection, delegating all shader configuration to the associated ShaderProperties instance.
Only executes for cameras that passes the AllowedPostProcessCamera mask.
On Unity 6 and newer with render graph enabled, the pass uses
RecordRenderGraph and UnityEngine.Rendering.RenderGraphModule.Util.RenderGraphUtils.AddBlitPass.
On older versions or when compatibility mode is active, the pass uses
the legacy Execute path with CommandBuffer.Blit.
To define a new URP post-process effect:
- Create a subclass of ShaderProperties that defines the shader name and parameters.
- Create a concrete renderer feature inheriting from PostProcessRendererFeature<TShaderProperties>.
- Add the renderer feature to a URP renderer asset.
Properties
BaseProperties
The shader properties for this feature, as the non-generic base type.
public override ShaderProperties BaseProperties { get; }
Property Value
Remarks
Lets editor tooling (for example the shader variant collector) work with any PostProcessRendererFeature<TShaderProperties> without needing a case per concrete effect type.
CustomCameraScopePredicate
A predicate that determines whether this feature should execute for a given camera. Only used when CameraScope is set to Custom.
public Func<CameraData, bool> CustomCameraScopePredicate { get; set; }
Property Value
Remarks
Assign this from a MonoBehaviour, for example in Awake:
var data = GetComponent<UniversalAdditionalCameraData>();
var feature = data.scriptableRenderer.GetRendererFeature<MyFeature>();
feature.CustomCameraScopePredicate = cameraData => cameraData.camera.CompareTag("MyTag");
If the predicate is not assigned, the feature will not execute on any camera.
Properties
public TShaderProperties Properties { get; }
Property Value
- TShaderProperties
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()
Dispose(bool)
Called by Dispose(). Override this function to clean up resources in your renderer.
protected override void Dispose(bool disposing)
Parameters
disposingbool