MizunagiKB / gd_cubism

Unofficial Live2D Player for Godot Engine

Home Page:https://mizunagikb.github.io/gd_cubism/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Animation change error

JekSun97 opened this issue · comments

When changing the animation, something strange happens on the face, it looks like flipping through all possible face effects, this does not happen in the official program from Live2D

0318.1.mp4

Using model: Epsilon
Godot: 4.1.3 stable

Also, in order not to create a new topic, I wanted to know, in the new Kei model from Live2D, for version 5, animations with audio tracks are used, these animations are not produced in Godot, is there any plan to support audio in the future?

The reason why the color becomes strange in GDCubism when rendering Live2D models is due to the fact that the rendering pipeline in Godot Engine is fixed, which leads to some different rendering processes.

In the Godot Engine version, a drawing method called "premultiple alpha" is used for all drawings.
This method makes it less likely to cause problems with addition and multiplication synthesis on Godot Engine, but as a side effect, problems occur with switching multiple transparencies.

The current workaround for this is to rewrite the shader for each model.

In this case, you could prepare a shader like the following:

// Custom Shader Mix
shader_type canvas_item;
render_mode blend_premul_alpha, unshaded;

uniform vec4 color_base;
uniform vec4 color_screen;
uniform vec4 color_multiply;
uniform vec4 channel;
uniform sampler2D tex_main : filter_linear_mipmap;

void vertex() {
    UV.y = 1.0 - UV.y;
}

void fragment() {
    vec4 color_tex = texture(tex_main, UV);
    color_tex.rgb = color_tex.rgb * color_multiply.rgb;

    // premul alpha
    color_tex.rgb = (color_tex.rgb + color_screen.rgb) - (color_tex.rgb * color_screen.rgb);
    vec4 color = color_tex;
    COLOR = vec4(color.rgb * color.a, color.a);
}

Please open the Inspector of GDCubismUserModel and assign the above to the Shader Mix in the Shader section.

Although smooth alpha blending will no longer occur, you may find that the blackening during rendering is less noticeable.

I am not an expert in shaders, so I cannot provide a superior method, but please try customizing individually as described above.

Also, in order not to create a new topic, I wanted to know, in the new Kei model from Live2D, for version 5, animations with audio tracks are used, these animations are not produced in Godot, is there any plan to support audio in the future?

When implementing audio playback, it is desirable to consider Godot Engine’s AudioMixer.
Therefore, if we arbitrarily decide the playback method, it could become difficult to use.

For this reason, we are currently not considering the integration of audio features.

Also, in order not to create a new topic, I wanted to know, in the new Kei model from Live2D, for version 5, animations with audio tracks are used, these animations are not produced in Godot, is there any plan to support audio in the future?

When implementing audio playback, it is desirable to consider Godot Engine’s AudioMixer. Therefore, if we arbitrarily decide the playback method, it could become difficult to use.

For this reason, we are currently not considering the integration of audio features.

Is it possible to make sure that in the inspector we select a node, for example AudioStreamPlayer, which would produce the sound itself?

GDCubism does not handle audio features.
Therefore, if you ask about audio-related nodes, there is no way to provide an answer.

Oh, got it, didn't know about that