• RuntimesGodot
  • Adding Shader Material to SpineSprite make every hidden parts visible

Hi,
I'm using Godot Spine 4.2.2

I want to add a Normal Material to a Spine Sprite node. This is done easily with the editor and the shader works as expected but I have only one issue/bug:

My Character have some hidden parts like weapon / face expression, without Material I can switch from one animation to another with the corresponding parts appearing / disappearing as expected.

But when adding a Shader in the Normal Material in Editor, the Spine character is showing all the parts that should be hidden, even if I play the animations that should hide some specific parts... Note that I dont have any other spine nodes as child of the SpineSprite.

How can I add a Material to my SpineSprite keeping the visibility of each corresponding parts and not making it all visible ?

Thank You

Related Discussions
...

When adding a custom material to a SpineSprite in Godot, it can sometimes cause hidden parts of the skeleton to become visible. This issue arises because the custom material might not respect the visibility settings of individual slots and attachments. To address this, you can use the SpineSlotNode to set materials for specific slots, ensuring that the visibility settings are preserved.

Here’s how you can do it:

  1. Create a SpineSlotNode for each slot you want to customize:

    • Right-click on your SpineSprite node in the scene tree.
    • Select Add Child Node... and choose SpineSlotNode.
    • Assign the slot name to the SpineSlotNode in the inspector.
  2. Assign the custom material to the SpineSlotNode:

    • In the Materials section of the SpineSlotNode, set your custom material.
    • This will override the material for that specific slot while preserving the visibility settings.
  3. Ensure the SpineSlotNode is a direct child of the SpineSprite:

    • The SpineSlotNode must be a direct child of the SpineSprite to function correctly.

Here is an example of how to set a custom material for a specific slot using GDScript:

extends SpineSprite

func _ready():
    var slot_node = SpineSlotNode.new()
    slot_node.slot_name = "your_slot_name"
    slot_node.material = preload("res://path_to_your_material.tres")
    add_child(slot_node)

By using SpineSlotNode, you can apply custom materials to specific slots without affecting the visibility of other parts of the skeleton.

For more detailed information, you can refer to the SpineSlotNode section in the spine-godot runtime documentation.

Thanks for the quick bot reply, but I want the Shader to be applied to all the SpineSprite, I don't want to have a separate material for slot/bone.

How can I apply the Material Shader to all the SpineSprite without affecting the original visibility of all the bones/parts of my Character ?

  • Misaki ответили на это сообщение.

    Musashogi Unfortunately, Mario, the person in charge of spine-godot, is currently ill and unable to answer questions. He should be able to respond to you sequentially once he returns, so we appreciate your patience.

    4 дня спустя

    Hi Misaki,

    I hope Mario will recover soon and wish him the best.

    Do you know when can I expect an answer?

    Thank You

    • Misaki ответили на это сообщение.

      Musashogi Thank you for your kind words. Fortunately, Mario has recovered somewhat and is back at work. However, there is a priority fix that needs to be addressed, and he has not yet had a chance to begin addressing the threads that have accumulated on the forums that need to be answered. And since some questions have come in before yours, I cannot say exactly when he will be able to answer your questions. We apologize for the long wait, but we hope you will continue to wait the answer.

      Could you please prepare a simple scene that demonstrates the issue? I'm not familiar with the "normal material editor" and what it does.

      Ideally, you can provide me a very small, self-contained Godot project with the assets that give you trouble.