Live2D model rendering in LOVE
Posted: Sat Jun 02, 2018 3:54 pm
It's good to know that I'm the first one who attempt to create this thing.
Click the image to open the video.
I have some reasons why I create this:
Most things is already supported in the module, like proper blending, draw ordering, animation, physics (handled by Live2D and not by love.physics), motion, and face expression.
The principle is basically, let the Live2D Cubism SDK update the models, but don't let Live2D do the rendering. Instead, retrieve the transformed points and supply it to Mesh object. The model texture is also assigned by using Image object then calling Mesh:setTexture. When drawing the model, for each Mesh, it's just simple call to love.graphics.draw supplying the Mesh object and additional parameters for transformation. This gives some advantages:
Let me know what do you guys think about this.
Click the image to open the video.
I have some reasons why I create this:
- So I can see BanG Dream! character models (now I can see my best girl models ).
- Because no one ever attempt to use Live2D in LOVE.
- For learning purpose on how to write OOP Lua C module (yeah the library is C module).
- Other creations which may come handy in the future.
Most things is already supported in the module, like proper blending, draw ordering, animation, physics (handled by Live2D and not by love.physics), motion, and face expression.
The principle is basically, let the Live2D Cubism SDK update the models, but don't let Live2D do the rendering. Instead, retrieve the transformed points and supply it to Mesh object. The model texture is also assigned by using Image object then calling Mesh:setTexture. When drawing the model, for each Mesh, it's just simple call to love.graphics.draw supplying the Mesh object and additional parameters for transformation. This gives some advantages:
- You can apply Shader to it.
- You can render it to Canvas as needed.
- The model drawing is affected by love.graphics transformation (which is what most people want).
Let me know what do you guys think about this.