Description
The AddHookAfterTransparent
method allows you to add a custom rendering hook to the camera's rendering pipeline, specifically after the transparent objects have been rendered. This can be useful for applying post-processing effects or custom rendering logic that should occur after transparent objects are drawn.
Usage
To use this method, you need to provide a debugName
for identifying the hook, an order
to determine the execution sequence among multiple hooks, and a renderEffect
action that defines the rendering logic to be executed.
The method returns an IDisposable
object, which can be used to remove the hook when it is no longer needed by calling Dispose()
on it.
Example
// Example of adding a rendering hook after transparent objects
CameraComponent cameraComponent = new CameraComponent();
IDisposable hook = cameraComponent.AddHookAfterTransparent(
"MyTransparentHook",
10,
(sceneCamera) => {
// Custom rendering logic here
// This code will be executed after transparent objects are rendered
}
);
// Later, when you want to remove the hook
hook.Dispose();