shader graph outline for sprites, how do you stop the edges getting cut off?
trying to do a simple 1px outline on sprites when you hover them, to show you can interact. shader graph in URP 2D. my approach: sample the main texture alpha 4 times with the UV offset by one texel up, down, left and right, add them up, subtract the original alpha, use that as the outline mask
it works... except the outline is cut off at the edges of the sprite. like the top of the characters head has no outline at all, and neither do the sides of the fence posts
texel size comes from the _MainTex_TexelSize property so that part seems right. what am i missing?
Top answer
Written by
Jake Morrison
indie game dev in melbourne, making a cosy farming game in unity that is definitely shipping this year (3rd year saying this). shaders, pixel art, coffee
Get the best of #pixels-and-polygons weekly
One email each Monday with the most useful posts. No spam; unsubscribe in one click.
Comments
Sign in to join the conversation.
Sign in to comment