inochi2d 0.4.0-beta

A bring-your-own-renderer realtime 2D puppet library

To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

<p align="center"> <img width="256" height="256" src="logo.png"> </p>


Inochi2D is a library for realtime 2D puppet animation and the reference implementation of the Inochi2D Puppet standard.

Currently this library and the standard is in the prototype stage and is not recommended for production use. If you want to try it out anyways you can clone this repo and run dub add-local (inochi2d folder) "1.0.0" then manually add it as a dependency in to dub.sdl/json.

Early prototype video


Supported platforms

The reference library requires at least OpenGL 4.2 or above, as well support for the SPIR-V ARB extension for per-part shaders. Inochi2D will disable custom shaders if SPIR-V is not found.

Implementors are free to implement Inochi2D over other graphics APIs and abstractions and should work on most modern graphics APIs (newer than OpenGL 2)

An official Unity implementation will be provided once 1.0 is complete.


How does Inochi2D work?

Inochi2D contains all your parts (textures) in a tree of Node objects. Nodes have their own individual purpose.


Parts contain the actual textures and vertex information of your model. Each part is an individual texture and set of vertices.


PathDeforms deform its child Drawables based on its handles. PathDeforms can deform multiple Drawables at once.


Masks are a Drawable which allow you to specify a shape. That shape is used to mask Parts without being a texture itself.

  More Node types to come...

Do Note

The spec is still work in progress and is subject to change. More details will be revealed once 1.0 of the spec is released.


Bootstrapping Inochi2D

Bootstrapping Inochi2D depends on the backing window managment library you are using.

Inochi2D can be boostrapped in GLFW (bindbc) with the following code

// Loads GLFW

// Create Window and initialize OpenGL 4.2 with compat profile
window = glfwCreateWindow(1024, 1024, "Inochi2D App".toStringz, null, null);

// Make OpenGL current and load its functions.

// A timing function that returns the current applications runtime in seconds and milliseconds is needed
inInit(cast(double function())glfwGetTime);

// Get the viewport size, which is the size of the scene
int sceneWidth, sceneHeight;

// It is highly recommended to change the viewport with
// inSetViewport to match the viewport you want, otherwise it'll be 640x480
inSetViewport(1024, 1024);
inGetViewport(sceneWidth, sceneHeight);

// Also many vtuber textures are pretty big so let's zoom out a bit.
inGetCamera().scale = vec2(0.5);

// NOTE: If you want to implement camera switching (for eg camera presets) use
// inSetCamera

// NOTE: Loading API WIP, subject to change
Puppet myPuppet = inLoadPuppet("myPuppet.inp");

while(!glfwWindowShouldClose(window)) {
    // NOTE: Inochi2D does not itself clear the main framebuffer
    // you have to do that your self.

    // Run updateInochi2D first
    // This updates various submodules and time managment for animation

    // Imagine there's a lot of rendering code here
    // Maybe even some game logic or something

    // Begins drawing in to the Inochi2D scene
    // NOTE: You *need* to do this otherwise rendering may break

    // Draw myPuppet.

    // Ends drawing in to the Inochi2D scene.

    // Draw the scene, background is transparent
    inSceneDraw(vec4i(0, 0, sceneWidth, sceneHeight));

    // Do the buffer swapping and event polling last


Currently not in the dub database use dub add-local (inochi2d folder) "1.0.0" to add inochi2d as a local package. You can then add inochi2d as a dependency.


The Inochi2D logo was designed by James Daniel

  • Luna Nielsen
imagefmt, gl3n, bindbc-opengl, asdf
0.4.0-beta 2021-Jun-06
~main 2021-Jun-22
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 2 downloads this week

  • 11 downloads this month

  • 11 downloads total

Short URL: