Now this works with lighter, brighter colors BUT when I set the outline color to black or any other darker color, the outline just becomes transparent, which I don’t want.
Lighter colors like white + bright red show the outline (I have checked all of this in game just showing it on the shader graph for ease):
so have u tested the black outline with a sprite that doesnt have a black outline by default? Its easy to see on your sprite that you might just be confusing the already existing outline with the new
try your shader on a white square sprite for example and check the results ( u must leave transparent margins on the texture for outline space)
none of my sprites have a black outline by default but I did try my shader on a white square sprite like you suggested and I got even stranger results.
The outline doesn’t show at all and I think this is to do with the sprite being completely white because when I change the tint color on the sprite renderer the outline faintly shows but only if the tint is around the same color as the color I have set for the outline? So it’s clear I need to change how I’m setting the color of the outline but I still don’t know how I’m going to be able to do that.
Outline on the white square doesn’t show when the outline color is set to bright red (it does show on other sprites that don’t contain only white, I think this maybe the issue?)
If I change the tint of the sprite renderer slightly to more to red the outline very faintly shows:
Both are using the same material + shader graph, and the issue still applies to the sprites that show the bright colors (the ladder); that when the outline color is set to darker colors the outline just becomes transparent.
yes I did make the square with a lot of room to display, and I tried your sprites and it gave these results when I set the outline color to a bright orange.
It shows on the red, but not the white.
And I have tried many times reversing the multiply node hoping it would do something haha, but unfortunately no difference
Ive got to say that Im stumped aswell. It seems that the add node is not appropriate for this? For example with a blue square if you add a red color it turns pink. The addition of the alpha channels also turns out wonky. Theres something about these squares that completely breaks the shader. Its wacky because with a “normal” sprite it kinda works as expected but when you use a solid color square it becomes completely wacky.
yeah it’s very confusing lol, I’m guessing it’s something to do with the alpha channel in the shader graph because the issues are concerning transparency of the outline when the color is set to darker colors (for “normal” sprites as you put it at least…), but I’m no expert I’m just getting the hang of shader graphs and I just want this silly outline to work.
unfortunately I won’t be able to share the sample project, the unity version is 2021.3.16f1 (so after the 2020 shader graph update that separated Alpha and Base Color in the master node if that means anything). Is there any other information I can provide for some help to get this working? Thanks for your response.
thanks for the idea but when I did this my sprites either just completely disappear (this happens with all the squares) or only show small broken up parts of the sprite, so it is clear that this doesn’t work and only puts me backwards. I changed all the Add nodes to Blend nodes with the overwrite option.
This will only work for a project using URP I believe so if it’s not working that may be the issue, also the outline thickness should probably be changed to a larger number if you can’t see the outline sometimes!
I’ve messed around with the blending options for a bit now and get very strange and weird behaviour, I did set all the options to Overlay as well and this caused all my sprites to turn black, so I believe a different approach is required.
If you like you can try it out yourself using the link I sent. Thanks anyways.
There is this dirty fix was the best that i could do
you duplicate the object and place it as a child, and put the shader only on the child, then a normal shader on the original
im sure there is a cleaner solution to add the outline directly on the original sprite and not have to use a duplicate maybe @MaxwellTan can show a way
I’ve finally found a way to solve this problem by adding a few more extra nodes before adding both the original texture to the outline color if anyone is interested:
However for some reason most of my sprites end up having jaggedy pixelly edges, even when the outline thickness is set to 0, don’t know if this is an anti-aliasing problem or what. Please can someone help me out if they know thank you.
When outline thickness is set to 0.1 and color is set to black.