Shader "Toon/Lit Dissolve Hide" {
Properties{
//_Color("Main Color", Color) = (0.5,0.5,0.5,1)
//_MainTex("Base (RGB)", 2D) = "white" {}
//_Ramp("Toon Ramp (RGB)", 2D) = "gray" {}
_NoiseTex("Dissolve Noise", 2D) = "white"{}
_NScale("Noise Scale", Float) = 1
_DisAmount("Radius Noise Offset", Float) = 0//Noise Texture Opacity
_Radius("Radius", Float) = 0
//_DisLineWidth("Line Width", Float) = 0
//_DisLineColor("Line Tint", Color) = (1,1,1,1)
//[Toggle(ALPHA)] _ALPHA("No Shadows on Transparent", Float) = 0
}
SubShader{
Tags { "RenderType" = "Transparent" "IgnoreProjector"="True"}
LOD 200
Blend SrcAlpha OneMinusSrcAlpha // transparency
CGPROGRAM
#pragma shader_feature LIGHTMAP
#pragma surface surf Lambert alphatest:_A //addshadow// transparency//i cant get rid of the alphatest with the fake property lol
//sampler2D _Ramp;
// custom lighting function that uses a texture ramp based
// on angle between light direction and normal
//#pragma lighting ToonRamp exclude_path:prepass
//inline half4 LightingToonRamp(SurfaceOutput s, half3 lightDir, half atten)
//{
// #ifndef USING_DIRECTIONAL_LIGHT
// lightDir = normalize(lightDir);
// #endif
//
// half d = dot(s.Normal, lightDir) * 0.5 + 0.5;
// //half3 ramp = tex2D(_Ramp, float2(d,d)).rgb;
//
// half4 c;
// c.rgb = s.Albedo * _LightColor0.rgb * (atten * 2);//*ramp
// //c.a = 0; we don't want the alpha
// c.a = s.Alpha; // use the alpha of the surface output
// return c;
//}
uniform float3 _Position;
float _Radius;
sampler2D _MainTex;
sampler2D _NoiseTex;//
//float4 _Color;
float _DisAmount, _NScale;//
//float _DisLineWidth;//
//float4 _DisLineColor;//
struct Input
{
float2 uv_MainTex : TEXCOORD0;
float2 uv_NoiseTex : TEXCOORD1;
float3 worldPos;// built in value to use the world space position
float3 worldNormal;
float3 objPos;
};
//void vert(inout appdata_full v, out Input o) {
// UNITY_INITIALIZE_OUTPUT(Input, o);
// o.objPos = v.vertex;
//}
void surf(Input IN, inout SurfaceOutput o)
{
half4 c = tex2D(_MainTex, IN.uv_MainTex);// * _Color;
//half4 d = tex2D(_NoiseTex, IN.uv_NoiseTex);
// triplanar noise
float3 blendNormal = saturate(pow(IN.worldNormal * 1.4,4));
half4 nSide1 = tex2D(_NoiseTex, IN.worldPos.xy * _NScale);//+_Time.x ~~ IN.worldPos.xy
half4 nSide2 = tex2D(_NoiseTex, IN.worldPos.xz * _NScale);
half4 nTop = tex2D(_NoiseTex, IN.worldPos.yz * _NScale);
float3 noisetexture = nSide1;
noisetexture = lerp(noisetexture, nTop, blendNormal.x);
noisetexture = lerp(noisetexture, nSide2, blendNormal.y);
// distance influencer position to world position and sphere radius
float3 dis = distance(_Position, IN.worldPos);
float3 sphereR = 1 - saturate(dis / _Radius);
float3 sphereRNoise = (noisetexture * sphereR.r);// *
//float3 DissolveLineIn = step(sphereRNoise - _DisLineWidth, _DisAmount);
float3 NoDissolve = float3(1, 1, 1);// - DissolveLineIn;
c.rgb = (NoDissolve * c.rgb);
//o.Emission = (DissolveLineIn * _DisLineColor) * 2;
c.a = step(_DisAmount, sphereRNoise);
o.Albedo = c.rgb;
o.Alpha = -c.a;
//This shader is a remix based on another one made by Joyce (MinionsArt) https://www.patreon.com/posts/19530112
}
ENDCG
}
Fallback "Diffuse"
}