I googled before asking here, and I tried to replicated the following answer:
- Code: Select all
fixed4 pixelUp = tex2D(_MainTex, IN.texcoord + fixed2(0, _MainTex_TexelSize.y));
fixed4 pixelDown = tex2D(_MainTex, IN.texcoord - fixed2(0, _MainTex_TexelSize.y));
fixed4 pixelRight = tex2D(_MainTex, IN.texcoord + fixed2(_MainTex_TexelSize.x, 0));
fixed4 pixelLeft = tex2D(_MainTex, IN.texcoord - fixed2(_MainTex_TexelSize.x, 0));
So I ended up with something like this:
Which seems maybe to big of a sheet but short of works nevertheless.
My problem is that I don't know how to translate the float thickness property into real pixels width so I can controll the number of pixels it is thick. Right now every different sprite has a different outline width. Also scaling a sprite scales the outline too.
How can I tell a shader that a property means pixels?
Thank you.