On Unity Engine, I'm trying to convert an image effect (from the asset store) from the camera event OnRenderImage(RenderTexture source, RenderTexture destination)
to a camera command buffer (UnityEngine.Rendering.CommandBuffer
)(to control the rendering order of all the effects stack).
The image effect rendering C# method is pretty complicated and I would rather not modify it (redoing the effect from scratch might be faster).
So the ideal solution would be calling the effect rendering C# method by a command buffer triggered event.
CommandBuffer.IssuePluginCustomBlit
looks like a solution, but I can't find any example how to set it up.
It references a callback method, a source render texture and a destination render texture. There are examples of the method call (especially in the VRWorks plugin) :
buffer.IssuePluginCustomBlit(PluginExtGetIssueEventCallback(), (UInt32)command, source, dest, commandParam, commandFlags);
[DllImport("GfxPluginVRWorks32", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
private static extern IntPtr PluginExtGetIssueEventCallback();
Nonetheless, I have no clue how the PluginExtGetIssueEventCallback
is built and how it implement the source and destination render textures.
If someone would have an example to share of how to use CommandBuffer.IssuePluginCustomBlit
and to create a callback method, it would be appreciated.
Thanks!