Home

Awesome

NatRender

NatRender is a lightweight graphics utility library for Unity Engine. Features include:

Setup Instructions

NatShare should be installed using the Unity Package Manager. In your manifest.json file, add the following dependency:

{
  "dependencies": {
    "com.natsuite.natrender": "git+https://github.com/natsuite/NatRender"
  }
}

Pixel Buffer Readbacks

NatRender provides lightweight primitives for performing pixel buffer readbacks from textures on the GPU. This is exposed through implementations the IReadback interface. Currently, NatRender provides the following implementations:

Once you create a readback, you can request the pixel data by calling the Readback method:

// Starting with some texture you want to readback
var texture = ...;
// Create readback
var readback = new GLESReadback(...) or new MLTReadback(...) or ...;
// Issue request
readback.Request(texture, (NativeArray<byte> pixelBuffer) => {
    // Do stuff with pixel buffer
});
// And when you're done remember to dispose
readback.Dispose();

Running on the Render Thread

NatRender also provides a way to run an Action on Unity's render thread. This is useful for performing native rendering or doing anything that requires being on the primary render thread:

RenderThread.Run(() => {
    // We're on Unity's render thread
    Debug.Log("Hello from the render thread");
});

Requirements

Resources

Thank you very much!