Hello all! I’m trying to create a shader that when I add a mask texture I can have a float property such as my _Glow that controls a feather’d effect. The current masks are supposed to highlight the edges of my objects and I’d like add a feather that grows inward (in addition to the mask texture) from the edges/mask texture.
It’s hard for me to explain exactly but instead of subtracting from the mask id like to add as if adding pixels to a mask in photoshop and feathering the edge. Almost as if the the edges have an emission value within the texture itself. I’m assuming there is a math function I need to add to this shader, but I can’t seem to find a list of possible functions with their definitions and usages anywhere with out searching each one individually.
Here’s My code so far:
Properties {
_OverlayTex ("Overlay (RGBA)", 2D) = "" {}
_Color ("Color", Color) = (0,0,0,1)
_ELevel("Glow Strength", Range(0.01,10.0)) = 1.0
_Glow ("Glow Amount", Range(.05,1)) = 1
}
SubShader {
Tags { "Queue"="Transparent" "RenderType"="Transparent" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert alpha:fade
#pragma target 3.0
#include "UnityStandardUtils.cginc"
sampler2D _OverlayTex;
fixed4 _Color;
float _ELevel;
half base = (1,1,1,1);
float _Glow;
struct Input {
float2 uv2_OverlayTex;
float4 _Color;
float _ELevel;
half base;
float _Glow;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_OverlayTex, IN.uv2_OverlayTex) * _Color;
float4 g = lerp(1,base, _Glow);
o.Albedo = c* _Color;
o.Alpha = saturate(c.a+ g);
o.Emission = _Color* _ELevel;
}
ENDCG
}
FallBack "Diffuse"
}
