How to create a Sprite Color Mask in Unity

Viewed 51

I'm trying to use the Among Us Spritesheets to get crewmates in Unity. The spritesheet looks like this: https://www.reddit.com/r/AmongUs/comments/ir6nl0/main_player_sprite_sheet_for_those_who_wanted_it/

Each sprite is a blue/red color. Somehow the devs get every color of crewmate from these sprites, and I'm wondering how they did it.

How can I get every color of crewmate from this sprite sheet?

Thanks!

EDIT: Solution

I edited the title to be more accurate to my problem. Thanks to @G Kalendar for mentioning Shaders, I hadn't thought about that.

What I ended up doing was creating a Shader Graph, extracting each color channel, multiplying it by a color value, and recombining them into a texture.

I followed this helpful and straightforward tutorial: https://www.youtube.com/watch?v=4dAGUxvsD24

This is what my Shader Graph ended up looking like: Shader Graph for Among Us Color Mask

"Secondary" and "Primary" are color properties.

Hope this helps somebody!

1 Answers

If you want to have multiple info stored in a single image, it's common practice to use the channels: Red, Green, Blue. Horizon Zero Dawn for example uses that technique to make the environment effects as efficient as possible.

Here it looks like blue and red are used as a polaceholder to mark an area. So in unity's shader graph, when you use this image in a SampleTexture2D node you can use a Split node to get the different channels of the image to isolate the parts you want to color in.

Then just multiply the different channels by the color you want, add them together and use that as the base color.

Edit: Or use the "Replace Color Node" I just learned about.

Related