Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
137 lines (133 sloc) 8.19 KB
// Shader created with Shader Forge v1.37
// 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.37;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,cgin:,lico:1,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:0,bsrc:0,bdst:0,dpts:2,wrdp:False,dith:0,atcv:False,rfrpo:True,rfrpn:Refraction,coma:15,ufog:True,aust:True,igpj:True,qofs:0,qpre:3,rntp:2,fgom:False,fgoc:True,fgod:False,fgor:False,fgmd:0,fgcr:0,fgcg:0,fgcb:0,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:True,fnfb:True,fsmp:False;n:type:ShaderForge.SFN_Final,id:4795,x:33030,y:32968,varname:node_4795,prsc:2|custl-4501-OUT;n:type:ShaderForge.SFN_Color,id:797,x:32154,y:32949,ptovrint:True,ptlb:Color,ptin:_TintColor,varname:_TintColor,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.3602941,c2:0.03443987,c3:0.08163232,c4:1;n:type:ShaderForge.SFN_Color,id:4050,x:32342,y:32810,ptovrint:False,ptlb:node_4050,ptin:_node_4050,varname:_node_4050,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.1771735,c2:0.3169319,c3:0.8308824,c4:1;n:type:ShaderForge.SFN_Fresnel,id:1562,x:32453,y:33606,varname:node_1562,prsc:2|EXP-4128-OUT;n:type:ShaderForge.SFN_Color,id:6011,x:32441,y:33375,ptovrint:False,ptlb:node_6011,ptin:_node_6011,varname:_node_6011,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.3208261,c2:0.4809986,c3:0.9485294,c4:1;n:type:ShaderForge.SFN_Slider,id:4128,x:32099,y:33597,ptovrint:False,ptlb:node_4128,ptin:_node_4128,varname:_node_4128,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:1,max:10;n:type:ShaderForge.SFN_Multiply,id:6577,x:32685,y:33422,varname:node_6577,prsc:2|A-6011-RGB,B-1562-OUT;n:type:ShaderForge.SFN_LightVector,id:567,x:32058,y:33100,varname:node_567,prsc:2;n:type:ShaderForge.SFN_NormalVector,id:5104,x:32058,y:33230,prsc:2,pt:False;n:type:ShaderForge.SFN_Dot,id:2592,x:32233,y:33128,varname:node_2592,prsc:2,dt:0|A-567-OUT,B-5104-OUT;n:type:ShaderForge.SFN_Lerp,id:9295,x:32519,y:32979,varname:node_9295,prsc:2|A-4050-RGB,B-797-RGB,T-2592-OUT;n:type:ShaderForge.SFN_Multiply,id:6571,x:32720,y:32964,varname:node_6571,prsc:2|A-9295-OUT,B-9706-OUT,C-7815-RGB;n:type:ShaderForge.SFN_LightAttenuation,id:9706,x:32519,y:33134,varname:node_9706,prsc:2;n:type:ShaderForge.SFN_LightColor,id:7815,x:32615,y:33221,varname:node_7815,prsc:2;n:type:ShaderForge.SFN_Add,id:4501,x:32842,y:33163,varname:node_4501,prsc:2|A-6571-OUT,B-6577-OUT;proporder:797-4050-6011-4128;pass:END;sub:END;*/
Shader "Shader Forge/sphere_light" {
Properties {
_TintColor ("Color", Color) = (0.3602941,0.03443987,0.08163232,1)
_node_4050 ("node_4050", Color) = (0.1771735,0.3169319,0.8308824,1)
_node_6011 ("node_6011", Color) = (0.3208261,0.4809986,0.9485294,1)
_node_4128 ("node_4128", Range(0, 10)) = 1
}
SubShader {
Tags {
"IgnoreProjector"="True"
"Queue"="Transparent"
"RenderType"="Transparent"
}
Pass {
Name "FORWARD"
Tags {
"LightMode"="ForwardBase"
}
Blend One One
ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#define UNITY_PASS_FORWARDBASE
#include "UnityCG.cginc"
#include "Lighting.cginc"
#pragma multi_compile_fwdbase
#pragma multi_compile_fog
#pragma only_renderers d3d9 d3d11 glcore gles
#pragma target 3.0
uniform float4 _TintColor;
uniform float4 _node_4050;
uniform float4 _node_6011;
uniform float _node_4128;
struct VertexInput {
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float4 posWorld : TEXCOORD0;
float3 normalDir : TEXCOORD1;
UNITY_FOG_COORDS(2)
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.normalDir = UnityObjectToWorldNormal(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);
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
float3 normalDirection = i.normalDir;
float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
float3 lightColor = _LightColor0.rgb;
////// Lighting:
float attenuation = 1;
float3 finalColor = ((lerp(_node_4050.rgb,_TintColor.rgb,dot(lightDirection,i.normalDir))*attenuation*_LightColor0.rgb)+(_node_6011.rgb*pow(1.0-max(0,dot(normalDirection, viewDirection)),_node_4128)));
fixed4 finalRGBA = fixed4(finalColor,1);
UNITY_APPLY_FOG_COLOR(i.fogCoord, finalRGBA, fixed4(0,0,0,1));
return finalRGBA;
}
ENDCG
}
Pass {
Name "FORWARD_DELTA"
Tags {
"LightMode"="ForwardAdd"
}
Blend One One
ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#define UNITY_PASS_FORWARDADD
#include "UnityCG.cginc"
#include "AutoLight.cginc"
#include "Lighting.cginc"
#pragma multi_compile_fwdadd
#pragma multi_compile_fog
#pragma only_renderers d3d9 d3d11 glcore gles
#pragma target 3.0
uniform float4 _TintColor;
uniform float4 _node_4050;
uniform float4 _node_6011;
uniform float _node_4128;
struct VertexInput {
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float4 posWorld : TEXCOORD0;
float3 normalDir : TEXCOORD1;
LIGHTING_COORDS(2,3)
UNITY_FOG_COORDS(4)
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.normalDir = UnityObjectToWorldNormal(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);
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
float3 normalDirection = i.normalDir;
float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w));
float3 lightColor = _LightColor0.rgb;
////// Lighting:
float attenuation = LIGHT_ATTENUATION(i);
float3 finalColor = ((lerp(_node_4050.rgb,_TintColor.rgb,dot(lightDirection,i.normalDir))*attenuation*_LightColor0.rgb)+(_node_6011.rgb*pow(1.0-max(0,dot(normalDirection, viewDirection)),_node_4128)));
fixed4 finalRGBA = fixed4(finalColor * 1,0);
UNITY_APPLY_FOG_COLOR(i.fogCoord, finalRGBA, fixed4(0,0,0,1));
return finalRGBA;
}
ENDCG
}
}
CustomEditor "ShaderForgeMaterialInspector"
}