- Home /
C++ Plugin for mipmapping and JPG encoding: viability
Hello folks,
I've been trying to determine whether a C++ plugin could improve my Unity application. However, I haven't developed such a plugin before, so I was hoping to get some assurance as to the viability of my idea. I'm currently exploring my options using the example RenderingPlugin from the Unity Manual found here.
I would like to do the following:
In a C# script:
Create a texture.
Have a camera render to the texture.
Pass the texture to my C++ plugin.
In the plugin:
Resize the texture to various smaller ones. (Mipmapping, sort of)
Convert the texture(s) to a JPG.
Pass one or more JPG's back to the C# script.
Why do I want this? I'm currently making screenshots in C# using the ReadPixels and EncodeToJPG functions (without the mipmapping though) and this works fine, but I'm hoping a C++ plugin will improve performance. I'm currently around 100ms per screenshot on our best machine, with ReadPixels and EncodeToJPG being the bottleneck. Not bad, but I would like it to be faster.
So, my questions:
Can this work?
Will it improve performance?
Got any tips on how to go about this?