gd_cubism icon indicating copy to clipboard operation
gd_cubism copied to clipboard

Animation change error

Open JekSun97 opened this issue 1 year ago • 2 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

https://github.com/MizunagiKB/gd_cubism/assets/130399274/7e8570d5-e08f-44d8-bf34-df5268590d3d

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?

JekSun97 avatar Mar 17 '24 22:03 JekSun97

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.

MizunagiKB avatar Mar 24 '24 02:03 MizunagiKB

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.

MizunagiKB avatar Mar 24 '24 03:03 MizunagiKB

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?

JekSun97 avatar Jun 06 '24 16:06 JekSun97

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

MizunagiKB avatar Jun 06 '24 23:06 MizunagiKB

Oh, got it, didn't know about that

JekSun97 avatar Jun 07 '24 06:06 JekSun97

This is the current operational specification. The issue originating from the Shader is similar to the following issue: https://github.com/MizunagiKB/gd_cubism/issues/7

This problem cannot be resolved beyond making it less noticeable, as the rendering pipeline of the Godot Engine cannot be modified without altering the source code.

As there has been no particular progress, this issue will be closed.

MizunagiKB avatar Aug 15 '24 02:08 MizunagiKB

@JekSun97 The issue of colors becoming dark during semi-transparent blending might be resolved with the following bug fix: https://github.com/MizunagiKB/gd_cubism/issues/113

MizunagiKB avatar Sep 12 '24 23:09 MizunagiKB

@JekSun97

Addressed the issue where colors would darken during animations involving translucent blending.

  • https://github.com/MizunagiKB/gd_cubism/releases/tag/v0.7.0
  • https://github.com/MizunagiKB/gd_cubism/releases/tag/v0.7.0-godot4.1

MizunagiKB avatar Sep 16 '24 14:09 MizunagiKB

@JekSun97

Решена проблема, из-за которой цвета темнели во время анимации с использованием полупрозрачного смешивания.

  • https://github.com/MizunagiKB/gd_cubism/releases/tag/v0.7.0
  • https://github.com/MizunagiKB/gd_cubism/releases/tag/v0.7.0-godot4.1

Thanks!

JekSun97 avatar Sep 16 '24 17:09 JekSun97