I’ve found nice Fresnel shader here. It works perfectly, but I want to use it as particle shader, so I should somehow make vertex color (it is affected by Shuriken) affect rim color. I’ve crawled through built-in particle shaders code, but didn’t make it work.
Here is the code of fresnel shader
Shader "Custom/TransparentFresnel"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
_InnerColor("Inner Color", Color) = (1.0, 1.0, 1.0, 1.0)
_RimColor("Rim Color", Color) = (0.26,0.19,0.16,0.0)
_RimPower("Rim Power", Range(0.5,8.0)) = 3.0
}
SubShader
{
Tags{ "Queue" = "Transparent" }
Cull Back
Blend One One
ZWrite Off
CGPROGRAM
#pragma surface surf Lambert
struct Input
{
float2 uv_MainTex;
float3 viewDir;
};
sampler2D _MainTex;
float4 _InnerColor;
float4 _RimColor;
float _RimPower;
void surf(Input IN, inout SurfaceOutput o)
{
o.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgba * _InnerColor;
half rim = 1.0 - saturate(dot(normalize(IN.viewDir), o.Normal));
o.Emission = _RimColor.rgba * pow(rim, _RimPower);
}
ENDCG
}
Fallback "Diffuse"
}