Download

Using alpha channel for paper 2d sprite...?

Could you send a screenshot of your material?

Sure I’m doing the pants outline as the extra alpha channel and as you can see I did the same setup as the pants with color nodes but this is impossible as you cannot plug two nodes into the emissive color.

Texture:
OnPaste.20210719-062210

Before I answer that question, my I ask:

Why do you need a separate outline texture? Do you just want the outline to be a bit darker? Or do you want them to be entirely different colors?

I want entirely different colors that can be chosen :slight_smile:

Okay, sounds good! Well, the first thing I would start with is to transfer the alpha channel of your new outline texture(s) into the green channel of the “Pants Texture”. This will save space, improve performance, and reduce the shader count.

1 Like

Then, try to do the changes illustrated by this messy picture:

NewMatGraph

The green “X” node is Multiply.

Also, I think you should remove the Vertex Color node and the Multiply nodes related to it, because you don’t need it in this case.

1 Like

Thank you for this!

I’ve just copyed this out and added an extra multiply node as the top multiply was plugged into the emissive color for the pants and that didn’t have anywhere to go.

OnPaste.20210720-064503

Chosing the pants color works perfectly find but when I choose the pants outline, it almost works but the colors are off and way more saturated.




Here’s my material:

Again, I couldn’t thank you enough for your help :slight_smile:

I’m also working on getting the material working with lots of different sprites that are part of many flipbook animations. So I created a spritesheet for the character animations and the red and green only pants and pant outline that match the character animations on the other spritesheet.

Any idea of what I should do now to get it so the colors work with sprites now? Because I know I can always input a source texture on the sprite, but I’m not able to input the pants texture that matches the sprite.

Given that you’re probably not using Vertex Coloring, I think you should remove that part.

These changes should make it all work fine:

1 Like

Thanks but I have tried this and it half works as it does the pants color and outline correctly but it makes the outline of my character really pixaly and there is a black rectangle.

OnPaste.20210720-194911

You need to link SourceTexture’s A pin to the Opacity output :smiley:

Thank you that was it! It finally works haha :smiley:

I’m also working on getting the material working with lots of different sprites that are part of many flipbook animations. So I created a spritesheet for the character animations and the red and green only pants and pant outline that match the character animations on the other spritesheet.

Any idea of what I should do now to get it so the colors work with sprites now? Because I know I can always input a source texture on the sprite, but I’m not able to input the pants texture that matches the sprite.

I’M NOT A TOTAL EXPERT, but I don’t actually have any great ideas… it seems that the sprite component is limited to one texture, and couldn’t be easily extended.

Sorry for all the questions haha

I had a look on the sprite and there is an additional textures array that you can add to so I think you may need to get that in the material but I’m not sure how to do that

Could you upload the used textures please? I would like to test something with them :slight_smile: Regarding them just being packed into a single channel or being a whole extra texture
(alpha textures are/were a thing, it may just not be common anymore, but you can also use a simple grayscale jpg as alpha input, and sometimes it might be easier to have them as completely separate texture)

1 Like

I obviously haven’t used Paper2D enough, because that should work as the solution!

To use an “additional texture” in your material, go to your SpriteTextureSampler node and enable “Sample Additional Textures”. Then, you can set the index of the texture.

1 Like

Ok, i looked a little bit more into my test RPG char, and why it wasn´t working as expected, now it does :slight_smile: Now i can add as much additional body armor and clothing as i want (exept weapons, the spear requiered a larger area than the main body sprite can offer, so this would be a spearate material).
And it really should be easy, since the LERP is almost idiotproof and does exactly what you want. Almost idiotproof, because during my testings and creating that broken first version, UE4 got somehow jammed and didn´t refresh some textures, leading to false lerp results that i tried to compensate with all that mess… which didn´t work very well ^.^
Also i had a case of not seeing the obvious solution, that was right in front of my eyes, something like “I can´t see the forest because of all those trees.” -.-´

Here is the resulting project. I converted that lerp into an additional function, which relies on that switch (except in the helmet case, thats a special situation), because this node combination is used for all additional clothing and armor pieces (would be your belt, belt outliner and headband).

Project:
RPG_Sprites.zip (1.1 MB)

Demonstration:

Also, if you want to recolor your pieces, then i suggest either creating the textures for them in grayscale, and multiply that texture with a color node, then use this result as input for the LERP or any LERP function.
OR, if you want use colored textures, then you always can desaturate them (make them gray, there is a node for this) and then multiply that deasturated result with a color node, should be the same as using a grayscale texture with a color node.
It´s just difficult to make a red piece blue, since blue usually contains no red :slight_smile:

I just haven´t use any additional color, but you can totally include them, and link their result into the LERP.

Hope, this helps a little bit ^.^

1 Like

Hey thank you SO much man, this really helps me and yeah I also have the problem sometimes of not seeing answers to problems when they are right in front of you haha! :slight_smile: