You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
475 lines
29 KiB
475 lines
29 KiB
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' |
|
|
|
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld' |
|
|
|
// Shader created with Shader Forge v1.28 |
|
// Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/ |
|
// Note: Manually altering this data may prevent you from opening it in Shader Forge |
|
/*SF_DATA;ver:1.28;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,lico:1,lgpr:1,limd:1,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:True,hqlp:False,rprd:False,enco:False,rmgx:True,rpth:0,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:1,bsrc:3,bdst:7,dpts:2,wrdp:False,dith:0,rfrpo:True,rfrpn:Refraction,coma:15,ufog:True,aust:True,igpj:True,qofs:0,qpre:3,rntp:2,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,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False;n:type:ShaderForge.SFN_Final,id:1,x:33552,y:32367,varname:node_1,prsc:2|diff-149-OUT,spec-1319-OUT,normal-4935-OUT,emission-166-OUT,transm-133-OUT,lwrap-133-OUT,alpha-1217-OUT,voffset-140-OUT;n:type:ShaderForge.SFN_Subtract,id:18,x:32111,y:32322,varname:node_18,prsc:2|A-22-OUT,B-19-OUT;n:type:ShaderForge.SFN_Vector1,id:19,x:31935,y:32544,varname:node_19,prsc:2,v1:0.5;n:type:ShaderForge.SFN_Abs,id:21,x:32286,y:32322,varname:node_21,prsc:2|IN-18-OUT;n:type:ShaderForge.SFN_Frac,id:22,x:31935,y:32286,varname:node_22,prsc:2|IN-24-OUT;n:type:ShaderForge.SFN_Panner,id:23,x:31424,y:32238,varname:node_23,prsc:2,spu:0,spv:-0.25|UVIN-5169-UVOUT;n:type:ShaderForge.SFN_ComponentMask,id:24,x:31764,y:32286,varname:node_24,prsc:2,cc1:1,cc2:-1,cc3:-1,cc4:-1|IN-5968-OUT;n:type:ShaderForge.SFN_Multiply,id:25,x:32461,y:32388,cmnt:Triangle Wave,varname:node_25,prsc:2|A-21-OUT,B-26-OUT;n:type:ShaderForge.SFN_Vector1,id:26,x:32286,y:32474,varname:node_26,prsc:2,v1:2;n:type:ShaderForge.SFN_Power,id:133,x:32629,y:32553,cmnt:Panning gradient,varname:node_133,prsc:2|VAL-25-OUT,EXP-8547-OUT;n:type:ShaderForge.SFN_NormalVector,id:139,x:32764,y:33109,prsc:2,pt:False;n:type:ShaderForge.SFN_Multiply,id:140,x:33162,y:32969,varname:node_140,prsc:2|A-133-OUT,B-142-OUT,C-139-OUT;n:type:ShaderForge.SFN_ValueProperty,id:142,x:32870,y:32986,ptovrint:False,ptlb:Bulge Scale,ptin:_BulgeScale,varname:_BulgeScale,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:-0.1;n:type:ShaderForge.SFN_Lerp,id:149,x:33124,y:32063,varname:node_149,prsc:2|A-4592-OUT,B-8608-OUT,T-133-OUT;n:type:ShaderForge.SFN_Lerp,id:150,x:32827,y:32359,varname:node_150,prsc:2|A-267-RGB,B-265-OUT,T-133-OUT;n:type:ShaderForge.SFN_Tex2d,id:151,x:31764,y:32071,ptovrint:False,ptlb:Diffuse,ptin:_Diffuse,varname:_Diffuse,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:b66bceaf0cc0ace4e9bdc92f14bba709,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Multiply,id:166,x:33162,y:32559,cmnt:Glow,varname:node_166,prsc:2|A-168-RGB,B-133-OUT,C-8677-OUT;n:type:ShaderForge.SFN_Color,id:168,x:32844,y:32591,ptovrint:False,ptlb:Glow Color,ptin:_GlowColor,varname:_GlowColor,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.08088237,c2:0.07181796,c3:0.07077207,c4:1;n:type:ShaderForge.SFN_Vector3,id:265,x:32629,y:32377,varname:node_265,prsc:2,v1:1,v2:1,v3:1;n:type:ShaderForge.SFN_Tex2d,id:267,x:32546,y:32156,ptovrint:False,ptlb:Normals,ptin:_Normals,varname:_Normals,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:b66bceaf0cc0ace4e9bdc92f14bba709,ntxv:2,isnm:False;n:type:ShaderForge.SFN_Vector1,id:4921,x:32919,y:32145,varname:node_4921,prsc:2,v1:1;n:type:ShaderForge.SFN_Normalize,id:4935,x:33073,y:32359,varname:node_4935,prsc:2|IN-150-OUT;n:type:ShaderForge.SFN_ValueProperty,id:8547,x:32368,y:32574,ptovrint:False,ptlb:Bulge Shape,ptin:_BulgeShape,varname:_BulgeShape,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:5;n:type:ShaderForge.SFN_Vector1,id:8608,x:32624,y:32079,varname:node_8608,prsc:2,v1:0.1;n:type:ShaderForge.SFN_ValueProperty,id:8677,x:32995,y:32663,ptovrint:False,ptlb:Glow Intensity,ptin:_GlowIntensity,varname:_GlowIntensity,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,v1:1.2;n:type:ShaderForge.SFN_TexCoord,id:5169,x:31218,y:32238,varname:node_5169,prsc:2,uv:0;n:type:ShaderForge.SFN_Multiply,id:1217,x:33162,y:32802,varname:node_1217,prsc:2|A-151-R,B-1916-OUT,C-1680-A,D-2921-OUT;n:type:ShaderForge.SFN_Slider,id:1916,x:32211,y:32738,ptovrint:False,ptlb:alpha,ptin:_alpha,varname:_alpha,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0.24,max:1;n:type:ShaderForge.SFN_Multiply,id:5968,x:31602,y:32368,varname:node_5968,prsc:2|A-23-UVOUT,B-5450-OUT;n:type:ShaderForge.SFN_Slider,id:5450,x:31174,y:32488,ptovrint:False,ptlb:speed,ptin:_speed,varname:_speed,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0.5,cur:1.615385,max:3;n:type:ShaderForge.SFN_Color,id:3665,x:32201,y:32084,ptovrint:False,ptlb:color,ptin:_color,varname:_color,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:1,c2:1,c3:1,c4:1;n:type:ShaderForge.SFN_Multiply,id:4592,x:32386,y:32003,varname:node_4592,prsc:2|A-151-RGB,B-3665-RGB;n:type:ShaderForge.SFN_Slider,id:2711,x:32762,y:32243,ptovrint:False,ptlb:node_2711,ptin:_node_2711,varname:_node_2711,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:1,max:1;n:type:ShaderForge.SFN_Multiply,id:1319,x:33124,y:32223,varname:node_1319,prsc:2|A-4921-OUT,B-2711-OUT;n:type:ShaderForge.SFN_VertexColor,id:1680,x:32629,y:32779,varname:node_1680,prsc:2;n:type:ShaderForge.SFN_Tex2d,id:4372,x:32086,y:32945,ptovrint:False,ptlb:node_4372,ptin:_node_4372,varname:_node_4372,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:d77caf51aa7b7f144b725d692f634814,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Subtract,id:2921,x:32576,y:32951,varname:node_2921,prsc:2|A-4620-OUT,B-151-A;n:type:ShaderForge.SFN_Slider,id:6764,x:31893,y:32816,ptovrint:False,ptlb:node_6764,ptin:_node_6764,varname:_node_6764,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:10,max:10;n:type:ShaderForge.SFN_Multiply,id:4620,x:32317,y:32945,varname:node_4620,prsc:2|A-6764-OUT,B-4372-R;proporder:151-267-168-142-8547-8677-1916-5450-3665-2711-4372-6764;pass:END;sub:END;*/ |
|
|
|
Shader "Shader Forge/Examples/Vertex Animation alpha02" { |
|
Properties { |
|
_Diffuse ("Diffuse", 2D) = "white" {} |
|
_Normals ("Normals", 2D) = "black" {} |
|
_GlowColor ("Glow Color", Color) = (0.08088237,0.07181796,0.07077207,1) |
|
_BulgeScale ("Bulge Scale", Float ) = -0.1 |
|
_BulgeShape ("Bulge Shape", Float ) = 5 |
|
_GlowIntensity ("Glow Intensity", Float ) = 1.2 |
|
_alpha ("alpha", Range(0, 1)) = 0.24 |
|
_speed ("speed", Range(0.5, 3)) = 1.615385 |
|
_color ("color", Color) = (1,1,1,1) |
|
_node_2711 ("node_2711", Range(0, 1)) = 1 |
|
_node_4372 ("node_4372", 2D) = "white" {} |
|
_node_6764 ("node_6764", Range(0, 10)) = 10 |
|
[HideInInspector]_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5 |
|
} |
|
SubShader { |
|
Tags { |
|
"IgnoreProjector"="True" |
|
"Queue"="Transparent" |
|
"RenderType"="Transparent" |
|
} |
|
Pass { |
|
Name "FORWARD" |
|
Tags { |
|
"LightMode"="ForwardBase" |
|
} |
|
Blend SrcAlpha OneMinusSrcAlpha |
|
Cull Front |
|
ZWrite Off |
|
|
|
CGPROGRAM |
|
#pragma vertex vert |
|
#pragma fragment frag |
|
#define UNITY_PASS_FORWARDBASE |
|
#define SHOULD_SAMPLE_SH ( defined (LIGHTMAP_OFF) && defined(DYNAMICLIGHTMAP_OFF) ) |
|
#include "UnityCG.cginc" |
|
#include "Lighting.cginc" |
|
#include "UnityPBSLighting.cginc" |
|
#include "UnityStandardBRDF.cginc" |
|
#pragma multi_compile_fwdbase |
|
#pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON |
|
#pragma multi_compile DIRLIGHTMAP_OFF DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE |
|
#pragma multi_compile DYNAMICLIGHTMAP_OFF DYNAMICLIGHTMAP_ON |
|
#pragma multi_compile_fog |
|
#pragma exclude_renderers xbox360 ps3 |
|
#pragma target 3.0 |
|
uniform float4 _TimeEditor; |
|
uniform float _BulgeScale; |
|
uniform sampler2D _Diffuse; uniform float4 _Diffuse_ST; |
|
uniform float4 _GlowColor; |
|
uniform sampler2D _Normals; uniform float4 _Normals_ST; |
|
uniform float _BulgeShape; |
|
uniform float _GlowIntensity; |
|
uniform float _alpha; |
|
uniform float _speed; |
|
uniform float4 _color; |
|
uniform float _node_2711; |
|
uniform sampler2D _node_4372; uniform float4 _node_4372_ST; |
|
uniform float _node_6764; |
|
struct VertexInput { |
|
float4 vertex : POSITION; |
|
float3 normal : NORMAL; |
|
float4 tangent : TANGENT; |
|
float2 texcoord0 : TEXCOORD0; |
|
float2 texcoord1 : TEXCOORD1; |
|
float2 texcoord2 : TEXCOORD2; |
|
float4 vertexColor : COLOR; |
|
}; |
|
struct VertexOutput { |
|
float4 pos : SV_POSITION; |
|
float2 uv0 : TEXCOORD0; |
|
float2 uv1 : TEXCOORD1; |
|
float2 uv2 : TEXCOORD2; |
|
float4 posWorld : TEXCOORD3; |
|
float3 normalDir : TEXCOORD4; |
|
float3 tangentDir : TEXCOORD5; |
|
float3 bitangentDir : TEXCOORD6; |
|
float4 vertexColor : COLOR; |
|
UNITY_FOG_COORDS(7) |
|
#if defined(LIGHTMAP_ON) || defined(UNITY_SHOULD_SAMPLE_SH) |
|
float4 ambientOrLightmapUV : TEXCOORD8; |
|
#endif |
|
}; |
|
VertexOutput vert (VertexInput v) { |
|
VertexOutput o = (VertexOutput)0; |
|
o.uv0 = v.texcoord0; |
|
o.uv1 = v.texcoord1; |
|
o.uv2 = v.texcoord2; |
|
o.vertexColor = v.vertexColor; |
|
#ifdef LIGHTMAP_ON |
|
o.ambientOrLightmapUV.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; |
|
o.ambientOrLightmapUV.zw = 0; |
|
#elif UNITY_SHOULD_SAMPLE_SH |
|
#endif |
|
#ifdef DYNAMICLIGHTMAP_ON |
|
o.ambientOrLightmapUV.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw; |
|
#endif |
|
o.normalDir = UnityObjectToWorldNormal(-v.normal); |
|
o.tangentDir = normalize( mul( unity_ObjectToWorld, float4( v.tangent.xyz, 0.0 ) ).xyz ); |
|
o.bitangentDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w); |
|
float4 node_8668 = _Time + _TimeEditor; |
|
float node_133 = pow((abs((frac(((o.uv0+node_8668.g*float2(0,-0.25))*_speed).g)-0.5))*2.0),_BulgeShape); // Panning gradient |
|
v.vertex.xyz += (node_133*_BulgeScale*v.normal); |
|
o.posWorld = mul(unity_ObjectToWorld, v.vertex); |
|
float3 lightColor = _LightColor0.rgb; |
|
o.pos = UnityObjectToClipPos(v.vertex ); |
|
UNITY_TRANSFER_FOG(o,o.pos); |
|
return o; |
|
} |
|
float4 frag(VertexOutput i) : COLOR { |
|
i.normalDir = normalize(i.normalDir); |
|
float3x3 tangentTransform = float3x3( i.tangentDir, i.bitangentDir, i.normalDir); |
|
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz); |
|
float4 _Normals_var = tex2D(_Normals,TRANSFORM_TEX(i.uv0, _Normals)); |
|
float4 node_8668 = _Time + _TimeEditor; |
|
float node_133 = pow((abs((frac(((i.uv0+node_8668.g*float2(0,-0.25))*_speed).g)-0.5))*2.0),_BulgeShape); // Panning gradient |
|
float3 normalLocal = normalize(lerp(_Normals_var.rgb,float3(1,1,1),node_133)); |
|
float3 normalDirection = normalize(mul( normalLocal, tangentTransform )); // Perturbed normals |
|
float3 viewReflectDirection = reflect( -viewDirection, normalDirection ); |
|
float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz); |
|
float3 lightColor = _LightColor0.rgb; |
|
float3 halfDirection = normalize(viewDirection+lightDirection); |
|
////// Lighting: |
|
float attenuation = 1; |
|
float3 attenColor = attenuation * _LightColor0.xyz; |
|
///////// Gloss: |
|
float gloss = 0.5; |
|
float specPow = exp2( gloss * 10.0+1.0); |
|
/////// GI Data: |
|
UnityLight light; |
|
#ifdef LIGHTMAP_OFF |
|
light.color = lightColor; |
|
light.dir = lightDirection; |
|
light.ndotl = LambertTerm (normalDirection, light.dir); |
|
#else |
|
light.color = half3(0.f, 0.f, 0.f); |
|
light.ndotl = 0.0f; |
|
light.dir = half3(0.f, 0.f, 0.f); |
|
#endif |
|
UnityGIInput d; |
|
d.light = light; |
|
d.worldPos = i.posWorld.xyz; |
|
d.worldViewDir = viewDirection; |
|
d.atten = attenuation; |
|
#if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) |
|
d.ambient = 0; |
|
d.lightmapUV = i.ambientOrLightmapUV; |
|
#else |
|
d.ambient = i.ambientOrLightmapUV; |
|
#endif |
|
Unity_GlossyEnvironmentData ugls_en_data; |
|
ugls_en_data.roughness = 1.0 - gloss; |
|
ugls_en_data.reflUVW = viewReflectDirection; |
|
UnityGI gi = UnityGlobalIllumination(d, 1, normalDirection, ugls_en_data ); |
|
lightDirection = gi.light.dir; |
|
lightColor = gi.light.color; |
|
////// Specular: |
|
float NdotL = max(0, dot( normalDirection, lightDirection )); |
|
float node_1319 = (1.0*_node_2711); |
|
float3 specularColor = float3(node_1319,node_1319,node_1319); |
|
float3 directSpecular = (floor(attenuation) * _LightColor0.xyz) * pow(max(0,dot(halfDirection,normalDirection)),specPow)*specularColor; |
|
float3 specular = directSpecular; |
|
/////// Diffuse: |
|
NdotL = dot( normalDirection, lightDirection ); |
|
float3 w = float3(node_133,node_133,node_133)*0.5; // Light wrapping |
|
float3 NdotLWrap = NdotL * ( 1.0 - w ); |
|
float3 forwardLight = max(float3(0.0,0.0,0.0), NdotLWrap + w ); |
|
float3 backLight = max(float3(0.0,0.0,0.0), -NdotLWrap + w ) * float3(node_133,node_133,node_133); |
|
NdotL = max(0.0,dot( normalDirection, lightDirection )); |
|
float3 directDiffuse = (forwardLight+backLight) * attenColor; |
|
float3 indirectDiffuse = float3(0,0,0); |
|
indirectDiffuse += gi.indirect.diffuse; |
|
float4 _Diffuse_var = tex2D(_Diffuse,TRANSFORM_TEX(i.uv0, _Diffuse)); |
|
float node_8608 = 0.1; |
|
float3 diffuseColor = lerp((_Diffuse_var.rgb*_color.rgb),float3(node_8608,node_8608,node_8608),node_133); |
|
float3 diffuse = (directDiffuse + indirectDiffuse) * diffuseColor; |
|
////// Emissive: |
|
float3 emissive = (_GlowColor.rgb*node_133*_GlowIntensity); |
|
/// Final Color: |
|
float3 finalColor = diffuse + specular + emissive; |
|
float4 _node_4372_var = tex2D(_node_4372,TRANSFORM_TEX(i.uv0, _node_4372)); |
|
fixed4 finalRGBA = fixed4(finalColor,(_Diffuse_var.r*_alpha*i.vertexColor.a*((_node_6764*_node_4372_var.r)-_Diffuse_var.a))); |
|
UNITY_APPLY_FOG(i.fogCoord, finalRGBA); |
|
return finalRGBA; |
|
} |
|
ENDCG |
|
} |
|
Pass { |
|
Name "FORWARD_DELTA" |
|
Tags { |
|
"LightMode"="ForwardAdd" |
|
} |
|
Blend One One |
|
Cull Front |
|
ZWrite Off |
|
|
|
CGPROGRAM |
|
#pragma vertex vert |
|
#pragma fragment frag |
|
#define UNITY_PASS_FORWARDADD |
|
#define SHOULD_SAMPLE_SH ( defined (LIGHTMAP_OFF) && defined(DYNAMICLIGHTMAP_OFF) ) |
|
#include "UnityCG.cginc" |
|
#include "AutoLight.cginc" |
|
#include "Lighting.cginc" |
|
#include "UnityPBSLighting.cginc" |
|
#include "UnityStandardBRDF.cginc" |
|
#pragma multi_compile_fwdadd |
|
#pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON |
|
#pragma multi_compile DIRLIGHTMAP_OFF DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE |
|
#pragma multi_compile DYNAMICLIGHTMAP_OFF DYNAMICLIGHTMAP_ON |
|
#pragma multi_compile_fog |
|
#pragma exclude_renderers xbox360 ps3 |
|
#pragma target 3.0 |
|
uniform float4 _TimeEditor; |
|
uniform float _BulgeScale; |
|
uniform sampler2D _Diffuse; uniform float4 _Diffuse_ST; |
|
uniform float4 _GlowColor; |
|
uniform sampler2D _Normals; uniform float4 _Normals_ST; |
|
uniform float _BulgeShape; |
|
uniform float _GlowIntensity; |
|
uniform float _alpha; |
|
uniform float _speed; |
|
uniform float4 _color; |
|
uniform float _node_2711; |
|
uniform sampler2D _node_4372; uniform float4 _node_4372_ST; |
|
uniform float _node_6764; |
|
struct VertexInput { |
|
float4 vertex : POSITION; |
|
float3 normal : NORMAL; |
|
float4 tangent : TANGENT; |
|
float2 texcoord0 : TEXCOORD0; |
|
float2 texcoord1 : TEXCOORD1; |
|
float2 texcoord2 : TEXCOORD2; |
|
float4 vertexColor : COLOR; |
|
}; |
|
struct VertexOutput { |
|
float4 pos : SV_POSITION; |
|
float2 uv0 : TEXCOORD0; |
|
float2 uv1 : TEXCOORD1; |
|
float2 uv2 : TEXCOORD2; |
|
float4 posWorld : TEXCOORD3; |
|
float3 normalDir : TEXCOORD4; |
|
float3 tangentDir : TEXCOORD5; |
|
float3 bitangentDir : TEXCOORD6; |
|
float4 vertexColor : COLOR; |
|
LIGHTING_COORDS(7,8) |
|
UNITY_FOG_COORDS(9) |
|
}; |
|
VertexOutput vert (VertexInput v) { |
|
VertexOutput o = (VertexOutput)0; |
|
o.uv0 = v.texcoord0; |
|
o.uv1 = v.texcoord1; |
|
o.uv2 = v.texcoord2; |
|
o.vertexColor = v.vertexColor; |
|
o.normalDir = UnityObjectToWorldNormal(-v.normal); |
|
o.tangentDir = normalize( mul( unity_ObjectToWorld, float4( v.tangent.xyz, 0.0 ) ).xyz ); |
|
o.bitangentDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w); |
|
float4 node_5720 = _Time + _TimeEditor; |
|
float node_133 = pow((abs((frac(((o.uv0+node_5720.g*float2(0,-0.25))*_speed).g)-0.5))*2.0),_BulgeShape); // Panning gradient |
|
v.vertex.xyz += (node_133*_BulgeScale*v.normal); |
|
o.posWorld = mul(unity_ObjectToWorld, v.vertex); |
|
float3 lightColor = _LightColor0.rgb; |
|
o.pos = UnityObjectToClipPos(v.vertex ); |
|
UNITY_TRANSFER_FOG(o,o.pos); |
|
TRANSFER_VERTEX_TO_FRAGMENT(o) |
|
return o; |
|
} |
|
float4 frag(VertexOutput i) : COLOR { |
|
i.normalDir = normalize(i.normalDir); |
|
float3x3 tangentTransform = float3x3( i.tangentDir, i.bitangentDir, i.normalDir); |
|
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz); |
|
float4 _Normals_var = tex2D(_Normals,TRANSFORM_TEX(i.uv0, _Normals)); |
|
float4 node_5720 = _Time + _TimeEditor; |
|
float node_133 = pow((abs((frac(((i.uv0+node_5720.g*float2(0,-0.25))*_speed).g)-0.5))*2.0),_BulgeShape); // Panning gradient |
|
float3 normalLocal = normalize(lerp(_Normals_var.rgb,float3(1,1,1),node_133)); |
|
float3 normalDirection = normalize(mul( normalLocal, tangentTransform )); // Perturbed normals |
|
float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w)); |
|
float3 lightColor = _LightColor0.rgb; |
|
float3 halfDirection = normalize(viewDirection+lightDirection); |
|
////// Lighting: |
|
float attenuation = LIGHT_ATTENUATION(i); |
|
float3 attenColor = attenuation * _LightColor0.xyz; |
|
///////// Gloss: |
|
float gloss = 0.5; |
|
float specPow = exp2( gloss * 10.0+1.0); |
|
////// Specular: |
|
float NdotL = max(0, dot( normalDirection, lightDirection )); |
|
float node_1319 = (1.0*_node_2711); |
|
float3 specularColor = float3(node_1319,node_1319,node_1319); |
|
float3 directSpecular = attenColor * pow(max(0,dot(halfDirection,normalDirection)),specPow)*specularColor; |
|
float3 specular = directSpecular; |
|
/////// Diffuse: |
|
NdotL = dot( normalDirection, lightDirection ); |
|
float3 w = float3(node_133,node_133,node_133)*0.5; // Light wrapping |
|
float3 NdotLWrap = NdotL * ( 1.0 - w ); |
|
float3 forwardLight = max(float3(0.0,0.0,0.0), NdotLWrap + w ); |
|
float3 backLight = max(float3(0.0,0.0,0.0), -NdotLWrap + w ) * float3(node_133,node_133,node_133); |
|
NdotL = max(0.0,dot( normalDirection, lightDirection )); |
|
float3 directDiffuse = (forwardLight+backLight) * attenColor; |
|
float4 _Diffuse_var = tex2D(_Diffuse,TRANSFORM_TEX(i.uv0, _Diffuse)); |
|
float node_8608 = 0.1; |
|
float3 diffuseColor = lerp((_Diffuse_var.rgb*_color.rgb),float3(node_8608,node_8608,node_8608),node_133); |
|
float3 diffuse = directDiffuse * diffuseColor; |
|
/// Final Color: |
|
float3 finalColor = diffuse + specular; |
|
float4 _node_4372_var = tex2D(_node_4372,TRANSFORM_TEX(i.uv0, _node_4372)); |
|
fixed4 finalRGBA = fixed4(finalColor * (_Diffuse_var.r*_alpha*i.vertexColor.a*((_node_6764*_node_4372_var.r)-_Diffuse_var.a)),0); |
|
UNITY_APPLY_FOG(i.fogCoord, finalRGBA); |
|
return finalRGBA; |
|
} |
|
ENDCG |
|
} |
|
Pass { |
|
Name "ShadowCaster" |
|
Tags { |
|
"LightMode"="ShadowCaster" |
|
} |
|
Offset 1, 1 |
|
|
|
CGPROGRAM |
|
#pragma vertex vert |
|
#pragma fragment frag |
|
#define UNITY_PASS_SHADOWCASTER |
|
#define SHOULD_SAMPLE_SH ( defined (LIGHTMAP_OFF) && defined(DYNAMICLIGHTMAP_OFF) ) |
|
#include "UnityCG.cginc" |
|
#include "Lighting.cginc" |
|
#include "UnityPBSLighting.cginc" |
|
#include "UnityStandardBRDF.cginc" |
|
#pragma fragmentoption ARB_precision_hint_fastest |
|
#pragma multi_compile_shadowcaster |
|
#pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON |
|
#pragma multi_compile DIRLIGHTMAP_OFF DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE |
|
#pragma multi_compile DYNAMICLIGHTMAP_OFF DYNAMICLIGHTMAP_ON |
|
#pragma multi_compile_fog |
|
#pragma exclude_renderers xbox360 ps3 |
|
#pragma target 3.0 |
|
uniform float4 _TimeEditor; |
|
uniform float _BulgeScale; |
|
uniform float _BulgeShape; |
|
uniform float _speed; |
|
struct VertexInput { |
|
float4 vertex : POSITION; |
|
float3 normal : NORMAL; |
|
float2 texcoord0 : TEXCOORD0; |
|
float2 texcoord1 : TEXCOORD1; |
|
float2 texcoord2 : TEXCOORD2; |
|
}; |
|
struct VertexOutput { |
|
V2F_SHADOW_CASTER; |
|
float2 uv0 : TEXCOORD1; |
|
float2 uv1 : TEXCOORD2; |
|
float2 uv2 : TEXCOORD3; |
|
float4 posWorld : TEXCOORD4; |
|
float3 normalDir : TEXCOORD5; |
|
}; |
|
VertexOutput vert (VertexInput v) { |
|
VertexOutput o = (VertexOutput)0; |
|
o.uv0 = v.texcoord0; |
|
o.uv1 = v.texcoord1; |
|
o.uv2 = v.texcoord2; |
|
o.normalDir = UnityObjectToWorldNormal(-v.normal); |
|
float4 node_6744 = _Time + _TimeEditor; |
|
float node_133 = pow((abs((frac(((o.uv0+node_6744.g*float2(0,-0.25))*_speed).g)-0.5))*2.0),_BulgeShape); // Panning gradient |
|
v.vertex.xyz += (node_133*_BulgeScale*v.normal); |
|
o.posWorld = mul(unity_ObjectToWorld, v.vertex); |
|
o.pos = UnityObjectToClipPos(v.vertex ); |
|
TRANSFER_SHADOW_CASTER(o) |
|
return o; |
|
} |
|
float4 frag(VertexOutput i) : COLOR { |
|
i.normalDir = normalize(i.normalDir); |
|
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz); |
|
float3 normalDirection = i.normalDir; |
|
SHADOW_CASTER_FRAGMENT(i) |
|
} |
|
ENDCG |
|
} |
|
Pass { |
|
Name "Meta" |
|
Tags { |
|
"LightMode"="Meta" |
|
} |
|
Cull Off |
|
|
|
CGPROGRAM |
|
#pragma vertex vert |
|
#pragma fragment frag |
|
#define UNITY_PASS_META 1 |
|
#define SHOULD_SAMPLE_SH ( defined (LIGHTMAP_OFF) && defined(DYNAMICLIGHTMAP_OFF) ) |
|
#include "UnityCG.cginc" |
|
#include "Lighting.cginc" |
|
#include "UnityPBSLighting.cginc" |
|
#include "UnityStandardBRDF.cginc" |
|
#include "UnityMetaPass.cginc" |
|
#pragma fragmentoption ARB_precision_hint_fastest |
|
#pragma multi_compile_shadowcaster |
|
#pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON |
|
#pragma multi_compile DIRLIGHTMAP_OFF DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE |
|
#pragma multi_compile DYNAMICLIGHTMAP_OFF DYNAMICLIGHTMAP_ON |
|
#pragma multi_compile_fog |
|
#pragma exclude_renderers xbox360 ps3 |
|
#pragma target 3.0 |
|
uniform float4 _TimeEditor; |
|
uniform float _BulgeScale; |
|
uniform sampler2D _Diffuse; uniform float4 _Diffuse_ST; |
|
uniform float4 _GlowColor; |
|
uniform float _BulgeShape; |
|
uniform float _GlowIntensity; |
|
uniform float _speed; |
|
uniform float4 _color; |
|
uniform float _node_2711; |
|
struct VertexInput { |
|
float4 vertex : POSITION; |
|
float3 normal : NORMAL; |
|
float2 texcoord0 : TEXCOORD0; |
|
float2 texcoord1 : TEXCOORD1; |
|
float2 texcoord2 : TEXCOORD2; |
|
}; |
|
struct VertexOutput { |
|
float4 pos : SV_POSITION; |
|
float2 uv0 : TEXCOORD0; |
|
float2 uv1 : TEXCOORD1; |
|
float2 uv2 : TEXCOORD2; |
|
float4 posWorld : TEXCOORD3; |
|
float3 normalDir : TEXCOORD4; |
|
}; |
|
VertexOutput vert (VertexInput v) { |
|
VertexOutput o = (VertexOutput)0; |
|
o.uv0 = v.texcoord0; |
|
o.uv1 = v.texcoord1; |
|
o.uv2 = v.texcoord2; |
|
o.normalDir = UnityObjectToWorldNormal(-v.normal); |
|
float4 node_9026 = _Time + _TimeEditor; |
|
float node_133 = pow((abs((frac(((o.uv0+node_9026.g*float2(0,-0.25))*_speed).g)-0.5))*2.0),_BulgeShape); // Panning gradient |
|
v.vertex.xyz += (node_133*_BulgeScale*v.normal); |
|
o.posWorld = mul(unity_ObjectToWorld, v.vertex); |
|
o.pos = UnityMetaVertexPosition(v.vertex, v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST ); |
|
return o; |
|
} |
|
float4 frag(VertexOutput i) : SV_Target { |
|
i.normalDir = normalize(i.normalDir); |
|
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz); |
|
float3 normalDirection = i.normalDir; |
|
UnityMetaInput o; |
|
UNITY_INITIALIZE_OUTPUT( UnityMetaInput, o ); |
|
|
|
float4 node_9026 = _Time + _TimeEditor; |
|
float node_133 = pow((abs((frac(((i.uv0+node_9026.g*float2(0,-0.25))*_speed).g)-0.5))*2.0),_BulgeShape); // Panning gradient |
|
o.Emission = (_GlowColor.rgb*node_133*_GlowIntensity); |
|
|
|
float4 _Diffuse_var = tex2D(_Diffuse,TRANSFORM_TEX(i.uv0, _Diffuse)); |
|
float node_8608 = 0.1; |
|
float3 diffColor = lerp((_Diffuse_var.rgb*_color.rgb),float3(node_8608,node_8608,node_8608),node_133); |
|
float node_1319 = (1.0*_node_2711); |
|
float3 specColor = float3(node_1319,node_1319,node_1319); |
|
o.Albedo = diffColor + specColor * 0.125; // No gloss connected. Assume it's 0.5 |
|
|
|
return UnityMetaFragment( o ); |
|
} |
|
ENDCG |
|
} |
|
} |
|
FallBack "Diffuse" |
|
CustomEditor "ShaderForgeMaterialInspector" |
|
}
|
|
|