// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld' // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' // 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:Standard,iptp:0,cusa:False,bamd:0,lico:1,lgpr:1,limd:3,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:True,hqlp:False,rprd:True,enco:False,rmgx:True,rpth:0,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:0,bsrc:0,bdst:1,dpts:2,wrdp:True,dith:0,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,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:2865,x:32719,y:32712,varname:node_2865,prsc:2|diff-6343-OUT,spec-3368-R,gloss-3368-A,normal-5964-RGB,emission-94-OUT,amdfl-9741-RGB;n:type:ShaderForge.SFN_Multiply,id:6343,x:32099,y:32273,varname:node_6343,prsc:2|A-7736-RGB,B-6665-RGB;n:type:ShaderForge.SFN_Color,id:6665,x:31906,y:32366,ptovrint:False,ptlb:Color,ptin:_Color,varname:_Color,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.5019608,c2:0.5019608,c3:0.5019608,c4:1;n:type:ShaderForge.SFN_Tex2d,id:7736,x:31906,y:32198,varname:_MainTex,prsc:2,ntxv:0,isnm:False|TEX-9313-TEX;n:type:ShaderForge.SFN_Tex2d,id:5964,x:31906,y:32526,varname:_BumpMap,prsc:2,ntxv:3,isnm:True|TEX-2018-TEX;n:type:ShaderForge.SFN_Tex2dAsset,id:9313,x:31633,y:32166,ptovrint:False,ptlb:Albedo Opacity,ptin:_AlbedoOpacity,varname:node_9313,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Tex2dAsset,id:2018,x:31633,y:32373,ptovrint:False,ptlb:Normal Map,ptin:_NormalMap,varname:node_2018,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:3,isnm:True;n:type:ShaderForge.SFN_Tex2dAsset,id:9847,x:31641,y:32680,ptovrint:False,ptlb:Metallic Roughness,ptin:_MetallicRoughness,varname:node_9847,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Tex2d,id:3368,x:31890,y:32697,varname:node_3368,prsc:2,ntxv:0,isnm:False|TEX-9847-TEX;n:type:ShaderForge.SFN_Tex2dAsset,id:8004,x:31641,y:32935,ptovrint:False,ptlb:Ambient Occlusion,ptin:_AmbientOcclusion,varname:node_8004,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Tex2d,id:9741,x:31879,y:32876,varname:node_9741,prsc:2,ntxv:0,isnm:False|TEX-8004-TEX;n:type:ShaderForge.SFN_Tex2dAsset,id:8242,x:31641,y:33154,ptovrint:False,ptlb:Emissive,ptin:_Emissive,varname:node_8242,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:2,isnm:False;n:type:ShaderForge.SFN_Tex2d,id:5363,x:31844,y:33171,varname:node_5363,prsc:2,ntxv:0,isnm:False|TEX-8242-TEX;n:type:ShaderForge.SFN_Time,id:3,x:31511,y:33347,varname:node_3,prsc:2;n:type:ShaderForge.SFN_Blend,id:5666,x:32224,y:33239,varname:node_5666,prsc:2,blmd:1,clmp:True|SRC-5363-RGB,DST-9937-OUT;n:type:ShaderForge.SFN_TexCoord,id:4194,x:31578,y:33617,varname:node_4194,prsc:2,uv:0;n:type:ShaderForge.SFN_Sin,id:6016,x:31852,y:33438,varname:node_6016,prsc:2|IN-8905-OUT;n:type:ShaderForge.SFN_Add,id:9937,x:32308,y:33537,varname:node_9937,prsc:2|A-6016-OUT,B-3291-OUT;n:type:ShaderForge.SFN_RemapRange,id:1027,x:31829,y:33597,varname:node_1027,prsc:2,frmn:0,frmx:1,tomn:-1,tomx:1|IN-4194-UVOUT;n:type:ShaderForge.SFN_Length,id:3291,x:32066,y:33597,varname:node_3291,prsc:2|IN-1027-OUT;n:type:ShaderForge.SFN_Add,id:581,x:32305,y:33068,varname:node_581,prsc:2|A-5666-OUT,B-5363-RGB;n:type:ShaderForge.SFN_Multiply,id:94,x:32476,y:32953,varname:node_94,prsc:2|A-3435-OUT,B-5666-OUT;n:type:ShaderForge.SFN_Slider,id:3435,x:32012,y:32917,ptovrint:False,ptlb:Emissive Power,ptin:_EmissivePower,varname:node_3435,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:1,max:100;n:type:ShaderForge.SFN_Multiply,id:8905,x:31693,y:33438,varname:node_8905,prsc:2|A-2277-OUT,B-3-T;n:type:ShaderForge.SFN_Slider,id:2277,x:31345,y:33511,ptovrint:False,ptlb:Fade Speed,ptin:_FadeSpeed,varname:node_2277,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:1,max:5;proporder:9313-6665-2018-9847-8004-8242-3435-2277;pass:END;sub:END;*/ Shader "SFBayStudios/SFB_GlowingEmissive" { Properties { _AlbedoOpacity ("Albedo Opacity", 2D) = "white" {} _Color ("Color", Color) = (0.5019608,0.5019608,0.5019608,1) _NormalMap ("Normal Map", 2D) = "bump" {} _MetallicRoughness ("Metallic Roughness", 2D) = "white" {} _AmbientOcclusion ("Ambient Occlusion", 2D) = "white" {} _Emissive ("Emissive", 2D) = "black" {} _EmissivePower ("Emissive Power", Range(0, 100)) = 1 _FadeSpeed ("Fade Speed", Range(0, 5)) = 1 } SubShader { Tags { "RenderType"="Opaque" } Pass { Name "FORWARD" Tags { "LightMode"="ForwardBase" } CGPROGRAM #pragma vertex vert #pragma fragment frag #define UNITY_PASS_FORWARDBASE #define SHOULD_SAMPLE_SH ( defined (LIGHTMAP_OFF) && defined(DYNAMICLIGHTMAP_OFF) ) #define _GLOSSYENV 1 #include "UnityCG.cginc" #include "AutoLight.cginc" #include "Lighting.cginc" #include "UnityPBSLighting.cginc" #include "UnityStandardBRDF.cginc" #pragma multi_compile_fwdbase_fullshadows #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 d3d11_9x xbox360 xboxone ps3 ps4 psp2 #pragma target 3.0 uniform float4 _TimeEditor; uniform float4 _Color; uniform sampler2D _AlbedoOpacity; uniform float4 _AlbedoOpacity_ST; uniform sampler2D _NormalMap; uniform float4 _NormalMap_ST; uniform sampler2D _MetallicRoughness; uniform float4 _MetallicRoughness_ST; uniform sampler2D _AmbientOcclusion; uniform float4 _AmbientOcclusion_ST; uniform sampler2D _Emissive; uniform float4 _Emissive_ST; uniform float _EmissivePower; uniform float _FadeSpeed; struct VertexInput { float4 vertex : POSITION; float3 normal : NORMAL; float4 tangent : TANGENT; 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; float3 tangentDir : TEXCOORD5; float3 bitangentDir : TEXCOORD6; LIGHTING_COORDS(7,8) UNITY_FOG_COORDS(9) #if defined(LIGHTMAP_ON) || defined(UNITY_SHOULD_SAMPLE_SH) float4 ambientOrLightmapUV : TEXCOORD10; #endif }; VertexOutput vert (VertexInput v) { VertexOutput o = (VertexOutput)0; o.uv0 = v.texcoord0; o.uv1 = v.texcoord1; o.uv2 = v.texcoord2; #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); 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); float3 _BumpMap = UnpackNormal(tex2D(_NormalMap,TRANSFORM_TEX(i.uv0, _NormalMap))); float3 normalLocal = _BumpMap.rgb; 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 = LIGHT_ATTENUATION(i); float3 attenColor = attenuation * _LightColor0.xyz; float Pi = 3.141592654; float InvPi = 0.31830988618; ///////// Gloss: float4 node_3368 = tex2D(_MetallicRoughness,TRANSFORM_TEX(i.uv0, _MetallicRoughness)); float gloss = node_3368.a; 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 d.boxMax[0] = unity_SpecCube0_BoxMax; d.boxMin[0] = unity_SpecCube0_BoxMin; d.probePosition[0] = unity_SpecCube0_ProbePosition; d.probeHDR[0] = unity_SpecCube0_HDR; d.boxMax[1] = unity_SpecCube1_BoxMax; d.boxMin[1] = unity_SpecCube1_BoxMin; d.probePosition[1] = unity_SpecCube1_ProbePosition; d.probeHDR[1] = unity_SpecCube1_HDR; 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 LdotH = max(0.0,dot(lightDirection, halfDirection)); float3 specularColor = node_3368.r; float specularMonochrome; float4 _MainTex = tex2D(_AlbedoOpacity,TRANSFORM_TEX(i.uv0, _AlbedoOpacity)); float3 diffuseColor = (_MainTex.rgb*_Color.rgb); // Need this for specular when using metallic diffuseColor = DiffuseAndSpecularFromMetallic( diffuseColor, specularColor, specularColor, specularMonochrome ); specularMonochrome = 1.0-specularMonochrome; float NdotV = max(0.0,dot( normalDirection, viewDirection )); float NdotH = max(0.0,dot( normalDirection, halfDirection )); float VdotH = max(0.0,dot( viewDirection, halfDirection )); float visTerm = SmithJointGGXVisibilityTerm( NdotL, NdotV, 1.0-gloss ); float normTerm = max(0.0, GGXTerm(NdotH, 1.0-gloss)); float specularPBL = (NdotL*visTerm*normTerm) * (UNITY_PI / 4); if (IsGammaSpace()) specularPBL = sqrt(max(1e-4h, specularPBL)); specularPBL = max(0, specularPBL * NdotL); float3 directSpecular = (floor(attenuation) * _LightColor0.xyz)*specularPBL*FresnelTerm(specularColor, LdotH); half grazingTerm = saturate( gloss + specularMonochrome ); float3 indirectSpecular = (gi.indirect.specular); indirectSpecular *= FresnelLerp (specularColor, grazingTerm, NdotV); float3 specular = (directSpecular + indirectSpecular); /////// Diffuse: NdotL = max(0.0,dot( normalDirection, lightDirection )); half fd90 = 0.5 + 2 * LdotH * LdotH * (1-gloss); float nlPow5 = Pow5(1-NdotL); float nvPow5 = Pow5(1-NdotV); float3 directDiffuse = ((1 +(fd90 - 1)*nlPow5) * (1 + (fd90 - 1)*nvPow5) * NdotL) * attenColor; float3 indirectDiffuse = float3(0,0,0); float4 node_9741 = tex2D(_AmbientOcclusion,TRANSFORM_TEX(i.uv0, _AmbientOcclusion)); indirectDiffuse += node_9741.rgb; // Diffuse Ambient Light indirectDiffuse += gi.indirect.diffuse; float3 diffuse = (directDiffuse + indirectDiffuse) * diffuseColor; ////// Emissive: float4 node_5363 = tex2D(_Emissive,TRANSFORM_TEX(i.uv0, _Emissive)); float4 node_3 = _Time + _TimeEditor; float3 node_5666 = saturate((node_5363.rgb*(sin((_FadeSpeed*node_3.g))+length((i.uv0*2.0+-1.0))))); float3 emissive = (_EmissivePower*node_5666); /// Final Color: float3 finalColor = diffuse + specular + emissive; fixed4 finalRGBA = fixed4(finalColor,1); UNITY_APPLY_FOG(i.fogCoord, finalRGBA); return finalRGBA; } ENDCG } Pass { Name "FORWARD_DELTA" Tags { "LightMode"="ForwardAdd" } Blend One One CGPROGRAM #pragma vertex vert #pragma fragment frag #define UNITY_PASS_FORWARDADD #define SHOULD_SAMPLE_SH ( defined (LIGHTMAP_OFF) && defined(DYNAMICLIGHTMAP_OFF) ) #define _GLOSSYENV 1 #include "UnityCG.cginc" #include "AutoLight.cginc" #include "Lighting.cginc" #include "UnityPBSLighting.cginc" #include "UnityStandardBRDF.cginc" #pragma multi_compile_fwdadd_fullshadows #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 d3d11_9x xbox360 xboxone ps3 ps4 psp2 #pragma target 3.0 uniform float4 _TimeEditor; uniform float4 _Color; uniform sampler2D _AlbedoOpacity; uniform float4 _AlbedoOpacity_ST; uniform sampler2D _NormalMap; uniform float4 _NormalMap_ST; uniform sampler2D _MetallicRoughness; uniform float4 _MetallicRoughness_ST; uniform sampler2D _Emissive; uniform float4 _Emissive_ST; uniform float _EmissivePower; uniform float _FadeSpeed; struct VertexInput { float4 vertex : POSITION; float3 normal : NORMAL; float4 tangent : TANGENT; 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; float3 tangentDir : TEXCOORD5; float3 bitangentDir : TEXCOORD6; 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.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); 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); float3 _BumpMap = UnpackNormal(tex2D(_NormalMap,TRANSFORM_TEX(i.uv0, _NormalMap))); float3 normalLocal = _BumpMap.rgb; 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; float Pi = 3.141592654; float InvPi = 0.31830988618; ///////// Gloss: float4 node_3368 = tex2D(_MetallicRoughness,TRANSFORM_TEX(i.uv0, _MetallicRoughness)); float gloss = node_3368.a; float specPow = exp2( gloss * 10.0+1.0); ////// Specular: float NdotL = max(0, dot( normalDirection, lightDirection )); float LdotH = max(0.0,dot(lightDirection, halfDirection)); float3 specularColor = node_3368.r; float specularMonochrome; float4 _MainTex = tex2D(_AlbedoOpacity,TRANSFORM_TEX(i.uv0, _AlbedoOpacity)); float3 diffuseColor = (_MainTex.rgb*_Color.rgb); // Need this for specular when using metallic diffuseColor = DiffuseAndSpecularFromMetallic( diffuseColor, specularColor, specularColor, specularMonochrome ); specularMonochrome = 1.0-specularMonochrome; float NdotV = max(0.0,dot( normalDirection, viewDirection )); float NdotH = max(0.0,dot( normalDirection, halfDirection )); float VdotH = max(0.0,dot( viewDirection, halfDirection )); float visTerm = SmithJointGGXVisibilityTerm( NdotL, NdotV, 1.0-gloss ); float normTerm = max(0.0, GGXTerm(NdotH, 1.0-gloss)); float specularPBL = (NdotL*visTerm*normTerm) * (UNITY_PI / 4); if (IsGammaSpace()) specularPBL = sqrt(max(1e-4h, specularPBL)); specularPBL = max(0, specularPBL * NdotL); float3 directSpecular = attenColor*specularPBL*FresnelTerm(specularColor, LdotH); float3 specular = directSpecular; /////// Diffuse: NdotL = max(0.0,dot( normalDirection, lightDirection )); half fd90 = 0.5 + 2 * LdotH * LdotH * (1-gloss); float nlPow5 = Pow5(1-NdotL); float nvPow5 = Pow5(1-NdotV); float3 directDiffuse = ((1 +(fd90 - 1)*nlPow5) * (1 + (fd90 - 1)*nvPow5) * NdotL) * attenColor; float3 diffuse = directDiffuse * diffuseColor; /// Final Color: float3 finalColor = diffuse + specular; fixed4 finalRGBA = fixed4(finalColor * 1,0); UNITY_APPLY_FOG(i.fogCoord, finalRGBA); return finalRGBA; } 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) ) #define _GLOSSYENV 1 #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 d3d11_9x xbox360 xboxone ps3 ps4 psp2 #pragma target 3.0 uniform float4 _TimeEditor; uniform float4 _Color; uniform sampler2D _AlbedoOpacity; uniform float4 _AlbedoOpacity_ST; uniform sampler2D _MetallicRoughness; uniform float4 _MetallicRoughness_ST; uniform sampler2D _Emissive; uniform float4 _Emissive_ST; uniform float _EmissivePower; uniform float _FadeSpeed; struct VertexInput { float4 vertex : POSITION; 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; }; VertexOutput vert (VertexInput v) { VertexOutput o = (VertexOutput)0; o.uv0 = v.texcoord0; o.uv1 = v.texcoord1; o.uv2 = v.texcoord2; 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 { float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz); UnityMetaInput o; UNITY_INITIALIZE_OUTPUT( UnityMetaInput, o ); float4 node_5363 = tex2D(_Emissive,TRANSFORM_TEX(i.uv0, _Emissive)); float4 node_3 = _Time + _TimeEditor; float3 node_5666 = saturate((node_5363.rgb*(sin((_FadeSpeed*node_3.g))+length((i.uv0*2.0+-1.0))))); o.Emission = (_EmissivePower*node_5666); float4 _MainTex = tex2D(_AlbedoOpacity,TRANSFORM_TEX(i.uv0, _AlbedoOpacity)); float3 diffColor = (_MainTex.rgb*_Color.rgb); float specularMonochrome; float3 specColor; float4 node_3368 = tex2D(_MetallicRoughness,TRANSFORM_TEX(i.uv0, _MetallicRoughness)); diffColor = DiffuseAndSpecularFromMetallic( diffColor, node_3368.r, specColor, specularMonochrome ); float roughness = 1.0 - node_3368.a; o.Albedo = diffColor + specColor * roughness * roughness * 0.5; return UnityMetaFragment( o ); } ENDCG } } FallBack "Standard" CustomEditor "ShaderForgeMaterialInspector" }