Hide sprite in light and show in darkness

Godot Version

4.4.1.0

Question

I want to make an outline of my character in the dark, like shown in the image:

Is shader an only way?

2 Likes

Yes!
Shader is the most easy way to do it

What kind of light are you useing, could you send a picture of the full scene tree and setup? if so i might me able to help you not use a shader

Woah woah wait
Can I ask something?
How did you posted 5 times at the same time?
Or your account was on hold?

Im new so the posts had to be reviewd by a mod

1 Like

Do you think this would be a good starting point for the shader?

1 Like

yeah
maybe
and sorry I thought you are a bot cuz, mods does this work under maybe 24h
Have fun ; )

nah your good

1 Like

Well, I have two Sprite2D’s, a light with circle texture and CanvasModulate to make the scene dark. I want one sprite to be shown only in light and the other one only out of light. I’m not a pro in shaders so I can’t really figure out a way to implement it

Could you send me the project? if it doesnt β€œfit” when uploading it on the fourm you can send a google drive or github link

I think i just found the BEST thing for this !!!

The stencil buffer in godot 4.5 is perfect for this, i will experement with it and see if i can get it working

1 Like

Isn’t stencil buffer just for 3d?

not sure

I havent been able to get 4.5 yet
(it has to be approved for my computer and they never anser the service desk tcikets, it might be a while)

…why other guy have to give u permission to just run a piece of exe on your own computer?

Its not my computer