Sprite Outline thickness (noob question)

Node-based Shader Editor

Sprite Outline thickness (noob question)

Postby wintermute » Thu Jun 21, 2018 1:53 pm

Hi everybody!

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:
Image

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.
wintermute
 
Posts: 4
Joined: Thu May 24, 2018 12:18 pm

Re: Sprite Outline thickness (noob question)

Postby Ricardo Teixeira » Tue Jun 26, 2018 10:53 am

Hello,

Thank you for getting in touch, always happy to help!

Unfortunately, the technique used does not allow you to set a fixed, size-independent, thickness value per-object.

The effect you're looking for is best achieved using a scree-based solution such as the image effect below.

Sprite Outline FX

Looking forward to see what you create.
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 0 guests