238 lines
21 KiB
Plaintext
238 lines
21 KiB
Plaintext
|
|
// Shader created with Shader Forge v1.40
|
||
|
|
// Shader Forge (c) Freya Holmer - http://www.acegikmo.com/shaderforge/
|
||
|
|
// Note: Manually altering this data may prevent you from opening it in Shader Forge
|
||
|
|
/*SF_DATA;ver:1.40;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,cgin:,cpap:True,lico:0,lgpr:1,limd:0,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,imps:True,rpth:0,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:2,bsrc:0,bdst:1,dpts:2,wrdp:True,dith:0,atcv:False,rfrpo:True,rfrpn:Refraction,coma:15,ufog:True,aust:True,igpj:False,qofs:0,qpre:1,rntp:1,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.01,fgrn:0,fgrf:300,stcl:False,atwp:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False,fsmp:False;n:type:ShaderForge.SFN_Final,id:9361,x:33569,y:32610,varname:node_9361,prsc:2|custl-27-OUT,olwid-5042-OUT,olcol-3267-RGB;n:type:ShaderForge.SFN_Lerp,id:5134,x:32174,y:33032,cmnt:亮面暗面,varname:node_5134,prsc:2|A-7224-RGB,B-7183-RGB,T-5872-OUT;n:type:ShaderForge.SFN_Slider,id:1385,x:31399,y:32849,ptovrint:False,ptlb:boundry,ptin:_boundry,varname:node_1385,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:-1,cur:0,max:1;n:type:ShaderForge.SFN_Slider,id:3609,x:31399,y:32976,ptovrint:False,ptlb:smooth,ptin:_smooth,varname:node_3609,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0.0001,cur:0.0001,max:1;n:type:ShaderForge.SFN_Add,id:1755,x:31746,y:32833,varname:node_1755,prsc:2|A-1385-OUT,B-3609-OUT;n:type:ShaderForge.SFN_Subtract,id:9320,x:31746,y:32976,varname:node_9320,prsc:2|A-1385-OUT,B-3609-OUT;n:type:ShaderForge.SFN_NormalVector,id:4901,x:30456,y:32808,prsc:2,pt:False;n:type:ShaderForge.SFN_LightVector,id:7219,x:30456,y:32955,varname:node_7219,prsc:2;n:type:ShaderForge.SFN_Dot,id:590,x:30618,y:32896,varname:node_590,prsc:2,dt:0|A-4901-OUT,B-7219-OUT;n:type:ShaderForge.SFN_Smoothstep,id:5872,x:31885,y:32897,varname:node_5872,prsc:2|A-1755-OUT,B-9320-OUT,V-590-OUT;n:type:ShaderForge.SFN_Color,id:7224,x:31994,y:32994,ptovrint:False,ptlb:NO Shadow,ptin:_NOShadow,varname:node_7224,prsc:2,glob:False,taghide:True,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:1,c2:1,c3:1,c4:1;n:type:ShaderForge.SFN_Color,id:7183,x:31994,y:32827,ptovrint:False,ptlb:NO light,ptin:_NOlight,varname:node_7183,prsc:2,glob:False,taghide:True,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0,c2:0,c3:0,c4:1;n:type:ShaderForge.SFN_Lerp,id:2577,x:32488,y:32261,cmnt:高亮色,varname:node_2577,prsc:2|A-1945-RGB,B-4585-RGB,T-5812-OUT;n:type:ShaderForge.SFN_Add,id:27,x:33181,y:32852,varname:node_27,prsc:2|A-8063-OUT,B-8809-OUT,C-269-OUT,D-4745-OUT,E-2495-OUT;n:type:ShaderForge.SFN_Smoothstep,id:5812,x:32177,y:32300,varname:node_5812,prsc:2|A-4791-OUT,B-812-OUT,V-590-OUT;n:type:ShaderForge.SFN_Slider,id:540,x:31667,y:32368,ptovrint:False,ptlb:HighLight Smooth,ptin:_HighLightSmooth,varname:node_540,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0.001,cur:0.001,max:1;n:type:ShaderForge.SFN_Slider,id:2364,x:31667,y:32237,ptovrint:False,ptlb:HighLight Boundry,ptin:_HighLightBoundry,varname:node_2364,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:1,cur:0.7374512,max:0.5;n:type:ShaderForge.SFN_Add,id:4791,x:32020,y:32221,varname:node_4791,prsc:2|A-2364-OUT,B-540-OUT;n:type:ShaderForge.SFN_Subtract,id:812,x:32020,y:32366,varname:node_812,prsc:2|A-2364-OUT,B-540-OUT;n:type:ShaderForge.SFN_Color,id:1945,x:32301,y:32227,ptovrint:False,ptlb:Hidh Light Color,ptin:_HidhLightColor,varname:node_1945,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.2924528,c2:0.2924528,c3:0.2924528,c4:1;n:type:ShaderForge.SFN_Color,id:4585,x:32301,y:32385,ptovrint:False,ptlb:NO hl,ptin:_NOhl,varname:node_4585,prsc:2,glob:False,taghide:True,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0,c2:0,c3:0,c4:1;n:type:ShaderForge.SFN_Lerp,id:269,x:32967,y:33466,cmnt:暗面补光,varname:node_269,prsc:2|A-3560-RGB,B-1236-RGB,T-5254-OUT;n:type:ShaderForge.SFN_Color,id:3560,x:32798,y:33366,ptovrint:False,
|
||
|
|
|
||
|
|
Shader "Shader Forge/Base_Outline" {
|
||
|
|
Properties {
|
||
|
|
_MainColor ("Main Color", Color) = (1,1,1,1)
|
||
|
|
_MainTex ("Main Tex", 2D) = "white" {}
|
||
|
|
_lightcolor ("light color", Color) = (1,1,1,1)
|
||
|
|
_shadowcolor ("shadow color", Color) = (0.6462264,0.718895,1,1)
|
||
|
|
[HideInInspector]_NOlight ("NO light", Color) = (0,0,0,1)
|
||
|
|
[HideInInspector]_NOShadow ("NO Shadow", Color) = (1,1,1,1)
|
||
|
|
_boundry ("boundry", Range(-1, 1)) = 0
|
||
|
|
_smooth ("smooth", Range(0.0001, 1)) = 0.0001
|
||
|
|
_HidhLightColor ("Hidh Light Color", Color) = (0.2924528,0.2924528,0.2924528,1)
|
||
|
|
_HighLightBoundry ("HighLight Boundry", Range(1, 0.5)) = 0.7374512
|
||
|
|
_HighLightSmooth ("HighLight Smooth", Range(0.001, 1)) = 0.001
|
||
|
|
[HDR]_FillColor ("Fill Color", Color) = (0,0,0,1)
|
||
|
|
_FillBoundry ("Fill Boundry", Range(-1, -0.5)) = -0.8308498
|
||
|
|
_FillSmooth ("Fill Smooth", Range(0, -1)) = 0
|
||
|
|
[HideInInspector]_NOhl ("NO hl", Color) = (0,0,0,1)
|
||
|
|
[HideInInspector]_NOfill ("NO fill", Color) = (0,0,0,1)
|
||
|
|
[HDR]_outlinecolor ("outline color", Color) = (0,0,0,1)
|
||
|
|
_outlinewidth ("outline width", Range(0, 0.1)) = 0.05812309
|
||
|
|
[HDR]_Emissioncolor ("Emission color", Color) = (0,0,0,1)
|
||
|
|
_Emissiontex ("Emission tex", 2D) = "white" {}
|
||
|
|
_RimLight ("Rim Light", Color) = (0,0,0,1)
|
||
|
|
_RimSmooth ("Rim Smooth", Range(1, 0)) = 1
|
||
|
|
_RimBoundry ("Rim Boundry", Range(0.001, 1)) = 0.001
|
||
|
|
[HideInInspector]_NOrim ("NO rim", Color) = (0,0,0,1)
|
||
|
|
_AdditiveColor ("AdditiveColor", Color) = (0, 0, 0, 1)
|
||
|
|
}
|
||
|
|
SubShader {
|
||
|
|
Tags {
|
||
|
|
"RenderType"="Opaque"
|
||
|
|
}
|
||
|
|
Pass {
|
||
|
|
Name "Outline"
|
||
|
|
Tags {
|
||
|
|
}
|
||
|
|
Cull Front
|
||
|
|
|
||
|
|
CGPROGRAM
|
||
|
|
#pragma vertex vert
|
||
|
|
#pragma fragment frag
|
||
|
|
#pragma multi_compile_instancing
|
||
|
|
#include "UnityCG.cginc"
|
||
|
|
#pragma fragmentoption ARB_precision_hint_fastest
|
||
|
|
#pragma multi_compile_shadowcaster
|
||
|
|
#pragma multi_compile_fog
|
||
|
|
#pragma target 3.0
|
||
|
|
UNITY_INSTANCING_BUFFER_START( Props )
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float4, _outlinecolor)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float, _outlinewidth)
|
||
|
|
UNITY_INSTANCING_BUFFER_END( Props )
|
||
|
|
struct VertexInput {
|
||
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||
|
|
float4 vertex : POSITION;
|
||
|
|
float3 normal : NORMAL;
|
||
|
|
};
|
||
|
|
struct VertexOutput {
|
||
|
|
float4 pos : SV_POSITION;
|
||
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||
|
|
UNITY_FOG_COORDS(0)
|
||
|
|
};
|
||
|
|
VertexOutput vert (VertexInput v) {
|
||
|
|
VertexOutput o = (VertexOutput)0;
|
||
|
|
UNITY_SETUP_INSTANCE_ID( v );
|
||
|
|
UNITY_TRANSFER_INSTANCE_ID( v, o );
|
||
|
|
float _outlinewidth_var = UNITY_ACCESS_INSTANCED_PROP( Props, _outlinewidth );
|
||
|
|
o.pos = UnityObjectToClipPos( float4(v.vertex.xyz + v.normal*_outlinewidth_var,1) );
|
||
|
|
UNITY_TRANSFER_FOG(o,o.pos);
|
||
|
|
return o;
|
||
|
|
}
|
||
|
|
float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
|
||
|
|
UNITY_SETUP_INSTANCE_ID( i );
|
||
|
|
float isFrontFace = ( facing >= 0 ? 1 : 0 );
|
||
|
|
float faceSign = ( facing >= 0 ? 1 : -1 );
|
||
|
|
float4 _outlinecolor_var = UNITY_ACCESS_INSTANCED_PROP( Props, _outlinecolor );
|
||
|
|
return fixed4(_outlinecolor_var.rgb,0);
|
||
|
|
}
|
||
|
|
ENDCG
|
||
|
|
}
|
||
|
|
Pass {
|
||
|
|
Name "FORWARD"
|
||
|
|
Tags {
|
||
|
|
"LightMode"="ForwardBase"
|
||
|
|
}
|
||
|
|
Cull Off
|
||
|
|
|
||
|
|
|
||
|
|
CGPROGRAM
|
||
|
|
#pragma vertex vert
|
||
|
|
#pragma fragment frag
|
||
|
|
#pragma multi_compile_instancing
|
||
|
|
#include "UnityCG.cginc"
|
||
|
|
#include "AutoLight.cginc"
|
||
|
|
#include "Lighting.cginc"
|
||
|
|
#pragma multi_compile_fwdbase_fullshadows
|
||
|
|
#pragma multi_compile_fog
|
||
|
|
#pragma target 3.0
|
||
|
|
uniform sampler2D _MainTex; uniform float4 _MainTex_ST;
|
||
|
|
uniform sampler2D _Emissiontex; uniform float4 _Emissiontex_ST;
|
||
|
|
UNITY_INSTANCING_BUFFER_START( Props )
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float, _boundry)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float, _smooth)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float4, _NOShadow)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float4, _NOlight)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float, _HighLightSmooth)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float, _HighLightBoundry)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float4, _HidhLightColor)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float4, _NOhl)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float4, _FillColor)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float4, _NOfill)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float, _FillSmooth)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float, _FillBoundry)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float4, _MainColor)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float4, _lightcolor)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float4, _shadowcolor)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float4, _Emissioncolor)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float4, _RimLight)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float, _RimSmooth)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float, _RimBoundry)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float4, _NOrim)
|
||
|
|
UNITY_DEFINE_INSTANCED_PROP( float4, _AdditiveColor)
|
||
|
|
UNITY_INSTANCING_BUFFER_END( Props )
|
||
|
|
struct VertexInput {
|
||
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||
|
|
float4 vertex : POSITION;
|
||
|
|
float3 normal : NORMAL;
|
||
|
|
float2 texcoord0 : TEXCOORD0;
|
||
|
|
};
|
||
|
|
struct VertexOutput {
|
||
|
|
float4 pos : SV_POSITION;
|
||
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||
|
|
float2 uv0 : TEXCOORD0;
|
||
|
|
float4 posWorld : TEXCOORD1;
|
||
|
|
float3 normalDir : TEXCOORD2;
|
||
|
|
LIGHTING_COORDS(3,4)
|
||
|
|
UNITY_FOG_COORDS(5)
|
||
|
|
};
|
||
|
|
VertexOutput vert (VertexInput v) {
|
||
|
|
VertexOutput o = (VertexOutput)0;
|
||
|
|
UNITY_SETUP_INSTANCE_ID( v );
|
||
|
|
UNITY_TRANSFER_INSTANCE_ID( v, o );
|
||
|
|
o.uv0 = v.texcoord0;
|
||
|
|
o.normalDir = UnityObjectToWorldNormal(v.normal);
|
||
|
|
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
|
||
|
|
o.pos = UnityObjectToClipPos( v.vertex );
|
||
|
|
UNITY_TRANSFER_FOG(o,o.pos);
|
||
|
|
TRANSFER_VERTEX_TO_FRAGMENT(o)
|
||
|
|
return o;
|
||
|
|
}
|
||
|
|
float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
|
||
|
|
UNITY_SETUP_INSTANCE_ID( i );
|
||
|
|
float isFrontFace = ( facing >= 0 ? 1 : 0 );
|
||
|
|
float faceSign = ( facing >= 0 ? 1 : -1 );
|
||
|
|
i.normalDir = normalize(i.normalDir);
|
||
|
|
i.normalDir *= faceSign;
|
||
|
|
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
|
||
|
|
float3 normalDirection = i.normalDir;
|
||
|
|
float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
|
||
|
|
////// Lighting:
|
||
|
|
float attenuation = LIGHT_ATTENUATION(i);
|
||
|
|
float4 _HidhLightColor_var = UNITY_ACCESS_INSTANCED_PROP( Props, _HidhLightColor );
|
||
|
|
float4 _NOhl_var = UNITY_ACCESS_INSTANCED_PROP( Props, _NOhl );
|
||
|
|
float _HighLightBoundry_var = UNITY_ACCESS_INSTANCED_PROP( Props, _HighLightBoundry );
|
||
|
|
float _HighLightSmooth_var = UNITY_ACCESS_INSTANCED_PROP( Props, _HighLightSmooth );
|
||
|
|
float node_590 = dot(i.normalDir,lightDirection);
|
||
|
|
float4 _MainColor_var = UNITY_ACCESS_INSTANCED_PROP( Props, _MainColor );
|
||
|
|
float4 _shadowcolor_var = UNITY_ACCESS_INSTANCED_PROP( Props, _shadowcolor );
|
||
|
|
float4 _lightcolor_var = UNITY_ACCESS_INSTANCED_PROP( Props, _lightcolor );
|
||
|
|
float4 _NOShadow_var = UNITY_ACCESS_INSTANCED_PROP( Props, _NOShadow );
|
||
|
|
float4 _NOlight_var = UNITY_ACCESS_INSTANCED_PROP( Props, _NOlight );
|
||
|
|
float _boundry_var = UNITY_ACCESS_INSTANCED_PROP( Props, _boundry );
|
||
|
|
float _smooth_var = UNITY_ACCESS_INSTANCED_PROP( Props, _smooth );
|
||
|
|
float4 _MainTex_var = tex2D(_MainTex,TRANSFORM_TEX(i.uv0, _MainTex));
|
||
|
|
float4 _FillColor_var = UNITY_ACCESS_INSTANCED_PROP( Props, _FillColor );
|
||
|
|
float4 _NOfill_var = UNITY_ACCESS_INSTANCED_PROP( Props, _NOfill );
|
||
|
|
float _FillSmooth_var = UNITY_ACCESS_INSTANCED_PROP( Props, _FillSmooth );
|
||
|
|
float _FillBoundry_var = UNITY_ACCESS_INSTANCED_PROP( Props, _FillBoundry );
|
||
|
|
float4 _Emissioncolor_var = UNITY_ACCESS_INSTANCED_PROP( Props, _Emissioncolor );
|
||
|
|
float4 _Emissiontex_var = tex2D(_Emissiontex,TRANSFORM_TEX(i.uv0, _Emissiontex));
|
||
|
|
float4 _RimLight_var = UNITY_ACCESS_INSTANCED_PROP( Props, _RimLight );
|
||
|
|
float4 _NOrim_var = UNITY_ACCESS_INSTANCED_PROP( Props, _NOrim );
|
||
|
|
float _RimSmooth_var = UNITY_ACCESS_INSTANCED_PROP( Props, _RimSmooth );
|
||
|
|
float _RimBoundry_var = UNITY_ACCESS_INSTANCED_PROP( Props, _RimBoundry );
|
||
|
|
float3 finalColor = ((attenuation*lerp(_HidhLightColor_var.rgb,_NOhl_var.rgb,smoothstep( (_HighLightBoundry_var+_HighLightSmooth_var), (_HighLightBoundry_var-_HighLightSmooth_var), node_590 )))+(_MainColor_var.rgb*lerp(_shadowcolor_var.rgb,_lightcolor_var.rgb,(attenuation*lerp(_NOShadow_var.rgb,_NOlight_var.rgb,smoothstep( (_boundry_var+_smooth_var), (_boundry_var-_smooth_var), node_590 ))))*_MainTex_var.rgb)+lerp(_FillColor_var.rgb,_NOfill_var.rgb,smoothstep( (_FillSmooth_var+_FillBoundry_var), (_FillBoundry_var-_FillSmooth_var), node_590 ))+(_Emissioncolor_var.rgb*_Emissiontex_var.rgb)+lerp(_RimLight_var.rgb,_NOrim_var.rgb,smoothstep( (_RimSmooth_var+_RimBoundry_var), (_RimSmooth_var-_RimBoundry_var), (1.0-max(0,dot(normalDirection, viewDirection))) )));
|
||
|
|
fixed4 finalRGBA = fixed4(finalColor,1);
|
||
|
|
float4 _AdditiveColor_var = UNITY_ACCESS_INSTANCED_PROP( Props, _AdditiveColor );
|
||
|
|
UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
|
||
|
|
finalRGBA = _AdditiveColor_var * _AdditiveColor_var.a + finalRGBA;
|
||
|
|
return finalRGBA;
|
||
|
|
}
|
||
|
|
ENDCG
|
||
|
|
}
|
||
|
|
Pass {
|
||
|
|
Name "ShadowCaster"
|
||
|
|
Tags {
|
||
|
|
"LightMode"="ShadowCaster"
|
||
|
|
}
|
||
|
|
Offset 1, 1
|
||
|
|
Cull Off
|
||
|
|
|
||
|
|
CGPROGRAM
|
||
|
|
#pragma vertex vert
|
||
|
|
#pragma fragment frag
|
||
|
|
#include "UnityCG.cginc"
|
||
|
|
#include "Lighting.cginc"
|
||
|
|
#pragma fragmentoption ARB_precision_hint_fastest
|
||
|
|
#pragma multi_compile_shadowcaster
|
||
|
|
#pragma multi_compile_fog
|
||
|
|
#pragma target 3.0
|
||
|
|
struct VertexInput {
|
||
|
|
float4 vertex : POSITION;
|
||
|
|
};
|
||
|
|
struct VertexOutput {
|
||
|
|
V2F_SHADOW_CASTER;
|
||
|
|
};
|
||
|
|
VertexOutput vert (VertexInput v) {
|
||
|
|
VertexOutput o = (VertexOutput)0;
|
||
|
|
o.pos = UnityObjectToClipPos( v.vertex );
|
||
|
|
TRANSFER_SHADOW_CASTER(o)
|
||
|
|
return o;
|
||
|
|
}
|
||
|
|
float4 frag(VertexOutput i, float facing : VFACE) : COLOR {
|
||
|
|
float isFrontFace = ( facing >= 0 ? 1 : 0 );
|
||
|
|
float faceSign = ( facing >= 0 ? 1 : -1 );
|
||
|
|
SHADOW_CASTER_FRAGMENT(i)
|
||
|
|
}
|
||
|
|
ENDCG
|
||
|
|
}
|
||
|
|
}
|
||
|
|
FallBack "Diffuse"
|
||
|
|
CustomEditor "ShaderForgeMaterialInspector"
|
||
|
|
}
|