Outline shader for characterBody2d and Node2d
Asked Answered
O

4

0

Hi all!

I'm very new to Godot, and I'm facing a problem a don't know how to solve. I made a character combining an animated sprite and a cloak moved programatically with the movement of my character. I want to make a shader to outline both elements but I can't seem to find how to do it.

My tree is something like:

  • World
    -- TileMap
    -- Player
    ---- Cloak (Node2d)
    ---- CharacterBody2d
    ------ CollisionShape
    ------ Sprite
    ------ AnimationTree
    ------ AnimationPlayer

So, what's the best approach to do this? I tried with viewports (but I think i need to duplicate my player to mimic the sprite and the animations) and I tried the new canvasGroup but without success...

thank you in advance,

Okubo answered 21/3, 2023 at 22:21 Comment(0)
N
0

Natelson answered 22/3, 2023 at 4:14 Comment(0)
O
0

Natelson

Thank you! But this is not what I was looking for. I have an animated sprite in combination with a node2d, I need/want a shader to outline both at the same time. If I apply a shader to my sprite it will outline the character but not the cloak because it's in a different node. And I don't want to outline both separately...

Okubo answered 22/3, 2023 at 8:9 Comment(0)
M
0

You should be able to use a CanvasGroup to draw all your AnimatedSprite2D nodes with your Node2D nodes, and then apply the shader to the CanvasGroup. Then I think it should outline all of it in a single pass as if it is a single texture.

Michell answered 22/3, 2023 at 11:36 Comment(0)
N
0

Okubo As Subantarctic points out, you should be able to apply the shader to it all at once even if the CanvasGroup method doesn't work, just a matter of keeping the outline settings exactly the same.

Natelson answered 22/3, 2023 at 14:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.