Page 1 of 1

Live2D model rendering in LOVE

Posted: Sat Jun 02, 2018 3:54 pm
by AuahDark
It's good to know that I'm the first one who attempt to create this thing.

Click the image to open the video.

Image

I have some reasons why I create this:
  • So I can see BanG Dream! character models (now I can see my best girl models :P ).
  • 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.
The source code of the C module is in here: https://github.com/MikuAuahDark/Live2LOVE

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).
There are some limitations, like clipping system is not yet implemented (requires stencil, but I want to make this library simple) and some minor graphical glitches. I think it's pretty stable and suits my needs at the moment.

Let me know what do you guys think about this.

Re: Live2D model rendering in LOVE

Posted: Sun Jun 03, 2018 5:40 am
by Davidobot
Great work! Really neat to see someone add support for this - I was wondering if it was possible to do at all. I've been planning a VN title for some time now and resolved myself to Unity because of the native integration with Live2D.

I'll definitely be making use of this over the summer! Thank you very much for your work.

Quick question - does it support the lip-sync feature?

Re: Live2D model rendering in LOVE

Posted: Sun Jun 03, 2018 7:00 am
by AuahDark
For lip sync, I'm sure you just need to modify "PARAM_MOUTH_OPEN_Y" parameter, and this library allows you to do that.

Code: Select all

local Live2LOVEModel = Live2LOVE.loadModel("model_definition.json")
Live2LOVEModel:setParamValue("PARAM_MOUTH_OPEN_Y", lipsyncValue, 0.8)

Re: Live2D model rendering in LOVE

Posted: Sun Jun 03, 2018 10:14 am
by zorg
basically, someone writes a lightweight wrapper around everything, and it'll be just as usable as any other live2d interface.