Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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:0,bsrc:0,bdst:1,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: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:3214,x:32927,y:32528,varname:node_3214,prsc:2|emission-2402-RGB;n:type:ShaderForge.SFN_SceneColor,id:2402,x:32662,y:32685,varname:node_2402,prsc:2|UVIN-5513-OUT;n:type:ShaderForge.SFN_Fresnel,id:3139,x:32034,y:32443,varname:node_3139,prsc:2;n:type:ShaderForge.SFN_ScreenParameters,id:1578,x:32298,y:32828,varname:node_1578,prsc:2;n:type:ShaderForge.SFN_ProjectionParameters,id:4596,x:32433,y:32867,varname:node_4596,prsc:2;n:type:ShaderForge.SFN_ScreenPos,id:8384,x:32088,y:32721,varname:node_8384,prsc:2,sctp:2;n:type:ShaderForge.SFN_Lerp,id:7573,x:32246,y:32561,varname:node_7573,prsc:2|A-7082-OUT,B-6405-OUT,T-3139-OUT;n:type:ShaderForge.SFN_Slider,id:6405,x:31744,y:32657,ptovrint:False,ptlb:node_6405,ptin:_node_6405,varname:node_6405,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0.485,max:1;n:type:ShaderForge.SFN_Vector1,id:7082,x:31874,y:32577,varname:node_7082,prsc:2,v1:0.5;n:type:ShaderForge.SFN_Blend,id:5513,x:32457,y:32603,varname:node_5513,prsc:2,blmd:10,clmp:True|SRC-8384-UVOUT,DST-7573-OUT;n:type:ShaderForge.SFN_Append,id:554,x:32651,y:32452,varname:node_554,prsc:2;n:type:ShaderForge.SFN_Add,id:500,x:32653,y:32269,varname:node_500,prsc:2|B-554-OUT;n:type:ShaderForge.SFN_Rotator,id:5782,x:32876,y:32269,varname:node_5782,prsc:2;n:type:ShaderForge.SFN_Append,id:3553,x:32638,y:32135,varname:node_3553,prsc:2;proporder:6405;pass:END;sub:END;*/
- Shader "Custom/Camouflage" {
- Properties {
- _node_6405 ("node_6405", Range(0, 1)) = 0.485
- }
- SubShader {
- Tags {
- "IgnoreProjector"="True"
- "Queue"="Transparent"
- "RenderType"="Transparent"
- }
- LOD 200
- GrabPass{ }
- Pass {
- Name "FORWARD"
- Tags {
- "LightMode"="ForwardBase"
- }
- ZWrite Off
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- #pragma multi_compile_instancing
- #include "UnityCG.cginc"
- #pragma multi_compile_fwdbase
- #pragma multi_compile_fog
- #pragma target 3.0
- uniform sampler2D _GrabTexture;
- UNITY_INSTANCING_BUFFER_START( Props )
- UNITY_DEFINE_INSTANCED_PROP( float, _node_6405)
- 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
- float4 posWorld : TEXCOORD0;
- float3 normalDir : TEXCOORD1;
- float4 projPos : TEXCOORD2;
- UNITY_FOG_COORDS(3)
- };
- VertexOutput vert (VertexInput v) {
- VertexOutput o = (VertexOutput)0;
- UNITY_SETUP_INSTANCE_ID( v );
- UNITY_TRANSFER_INSTANCE_ID( v, o );
- o.normalDir = UnityObjectToWorldNormal(v.normal);
- o.posWorld = mul(unity_ObjectToWorld, v.vertex);
- o.pos = UnityObjectToClipPos( v.vertex );
- UNITY_TRANSFER_FOG(o,o.pos);
- o.projPos = ComputeScreenPos (o.pos);
- COMPUTE_EYEDEPTH(o.projPos.z);
- return o;
- }
- float4 frag(VertexOutput i) : COLOR {
- UNITY_SETUP_INSTANCE_ID( i );
- i.normalDir = normalize(i.normalDir);
- float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
- float3 normalDirection = i.normalDir;
- float2 sceneUVs = (i.projPos.xy / i.projPos.w);
- float4 sceneColor = tex2D(_GrabTexture, sceneUVs);
- ////// Lighting:
- ////// Emissive:
- float _node_6405_var = UNITY_ACCESS_INSTANCED_PROP( Props, _node_6405 );
- float3 emissive = tex2D( _GrabTexture, saturate(( lerp(0.5,_node_6405_var,(1.0-max(0,dot(normalDirection, viewDirection)))) > 0.5 ? (1.0-(1.0-2.0*(lerp(0.5,_node_6405_var,(1.0-max(0,dot(normalDirection, viewDirection))))-0.5))*(1.0-sceneUVs.rg)) : (2.0*lerp(0.5,_node_6405_var,(1.0-max(0,dot(normalDirection, viewDirection))))*sceneUVs.rg) ))).rgb;
- float3 finalColor = emissive;
- fixed4 finalRGBA = fixed4(finalColor,1);
- UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
- return finalRGBA;
- }
- ENDCG
- }
- }
- FallBack "Diffuse"
- CustomEditor "ShaderForgeMaterialInspector"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement