This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I want the user to be able to select colors for the character's sprite, like for skin, clothes color, etc. Preferably with the color picker, but if that's not possible I guess I could show a bunch of pre-picked colors. How would I be able to do this? Right now I'm using self_modulate but that only works for the entire sprite, not separate parts of it.

in Engine by (8,580 points)

Thanks for the response, but I'm not really sure how I would do any of that in Godot. I don't really see any mapping properties for a TextureRect. Or should I be using a Sprite instead?

enter image description here

ya i do it by splitting a sprite into different parts now but recently found this possible alternative...

from what i can tell if you just color your original sprite with specific shades of gray (or even colors) you can replace those specific colors with any color you chose using a shader. eg light gray = red, dark gray = blue, gray = orange

these related videos might help

Thanks, I'll probably write a shader to replace different colors in the sprite.

1 Answer

0 votes

You might have to work with sprite masks. You need then separate masks for those individual parts of the sprite which you want to color. You then colorize the masks. This requires to "cut" your sprite into pieces. Thats how i did it for coloring shirts of soccer players.

by (61 points)

How do I make a sprite mask? I don't see any property for that in the Inspector for the Sprite node.

Your sprite mask is just a sprite itself. The way i did it was (for soccer players), i had a sprite sheet with the soccer play as one sprite and another sprite just for the shirt in grayscale. At runtime i drew the main sprite and then the colorized shirt sprite (with the right offset) on top of the main sprite.

Okay, thanks for the reply.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.