Live2D model rendering in LOVE

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

Live2D model rendering in LOVE

Post 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.
Profile. Do you encounter crashes in LÖVE Android and wanna send me logcats? Please hit me up in LÖVE Discord and send the full logcat file!
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Live2D model rendering in LOVE

Post 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?
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
AuahDark
Party member
Posts: 107
Joined: Mon Oct 23, 2017 2:34 pm
Location: Indonesia
Contact:

Re: Live2D model rendering in LOVE

Post 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)
Profile. Do you encounter crashes in LÖVE Android and wanna send me logcats? Please hit me up in LÖVE Discord and send the full logcat file!
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Live2D model rendering in LOVE

Post by zorg »

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: No registered users and 40 guests