Live2D model rendering in LOVE

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
AuahDark
Prole
Posts: 4
Joined: Mon Oct 23, 2017 2:34 pm
Contact:

Live2D model rendering in LOVE

Post by AuahDark » 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.

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.
Put "AuahDark" as credits, not "Tae Hanazono"

User avatar
Davidobot
Party member
Posts: 1144
Joined: Sat Mar 31, 2012 5:18 am
Location: Game-Dev. Land
Contact:

Re: Live2D model rendering in LOVE

Post by Davidobot » Sun Jun 03, 2018 5:40 am

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?
My library:
LovelyMoon

Check out my current project:
Raycaster

Oh hey, I have a website now!

User avatar
AuahDark
Prole
Posts: 4
Joined: Mon Oct 23, 2017 2:34 pm
Contact:

Re: Live2D model rendering in LOVE

Post by AuahDark » Sun Jun 03, 2018 7:00 am

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)
Put "AuahDark" as credits, not "Tae Hanazono"

User avatar
zorg
Party member
Posts: 2410
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Live2D model rendering in LOVE

Post by zorg » Sun Jun 03, 2018 10:14 am

basically, someone writes a lightweight wrapper around everything, and it'll be just as usable as any other live2d interface.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

Post Reply

Who is online

Users browsing this forum: Stifu and 2 guests