Advertisement
migero

Untitled

Aug 30th, 2023
2,058
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Shader created with Shader Forge v1.40
  2. // Shader Forge (c) Freya Holmer - http://www.acegikmo.com/shaderforge/
  3. // Note: Manually altering this data may prevent you from opening it in Shader Forge
  4. /*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;*/
  5.  
  6. Shader "Custom/Camouflage" {
  7.     Properties {
  8.         _node_6405 ("node_6405", Range(0, 1)) = 0.485
  9.     }
  10.     SubShader {
  11.         Tags {
  12.             "IgnoreProjector"="True"
  13.             "Queue"="Transparent"
  14.             "RenderType"="Transparent"
  15.         }
  16.         LOD 200
  17.         GrabPass{ }
  18.         Pass {
  19.             Name "FORWARD"
  20.             Tags {
  21.                 "LightMode"="ForwardBase"
  22.             }
  23.             ZWrite Off
  24.            
  25.             CGPROGRAM
  26.             #pragma vertex vert
  27.             #pragma fragment frag
  28.             #pragma multi_compile_instancing
  29.             #include "UnityCG.cginc"
  30.             #pragma multi_compile_fwdbase
  31.             #pragma multi_compile_fog
  32.             #pragma target 3.0
  33.             uniform sampler2D _GrabTexture;
  34.             UNITY_INSTANCING_BUFFER_START( Props )
  35.                 UNITY_DEFINE_INSTANCED_PROP( float, _node_6405)
  36.             UNITY_INSTANCING_BUFFER_END( Props )
  37.             struct VertexInput {
  38.                 UNITY_VERTEX_INPUT_INSTANCE_ID
  39.                 float4 vertex : POSITION;
  40.                 float3 normal : NORMAL;
  41.             };
  42.             struct VertexOutput {
  43.                 float4 pos : SV_POSITION;
  44.                 UNITY_VERTEX_INPUT_INSTANCE_ID
  45.                 float4 posWorld : TEXCOORD0;
  46.                 float3 normalDir : TEXCOORD1;
  47.                 float4 projPos : TEXCOORD2;
  48.                 UNITY_FOG_COORDS(3)
  49.             };
  50.             VertexOutput vert (VertexInput v) {
  51.                 VertexOutput o = (VertexOutput)0;
  52.                 UNITY_SETUP_INSTANCE_ID( v );
  53.                 UNITY_TRANSFER_INSTANCE_ID( v, o );
  54.                 o.normalDir = UnityObjectToWorldNormal(v.normal);
  55.                 o.posWorld = mul(unity_ObjectToWorld, v.vertex);
  56.                 o.pos = UnityObjectToClipPos( v.vertex );
  57.                 UNITY_TRANSFER_FOG(o,o.pos);
  58.                 o.projPos = ComputeScreenPos (o.pos);
  59.                 COMPUTE_EYEDEPTH(o.projPos.z);
  60.                 return o;
  61.             }
  62.             float4 frag(VertexOutput i) : COLOR {
  63.                 UNITY_SETUP_INSTANCE_ID( i );
  64.                 i.normalDir = normalize(i.normalDir);
  65.                 float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
  66.                 float3 normalDirection = i.normalDir;
  67.                 float2 sceneUVs = (i.projPos.xy / i.projPos.w);
  68.                 float4 sceneColor = tex2D(_GrabTexture, sceneUVs);
  69. ////// Lighting:
  70. ////// Emissive:
  71.                 float _node_6405_var = UNITY_ACCESS_INSTANCED_PROP( Props, _node_6405 );
  72.                 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;
  73.                 float3 finalColor = emissive;
  74.                 fixed4 finalRGBA = fixed4(finalColor,1);
  75.                 UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
  76.                 return finalRGBA;
  77.             }
  78.             ENDCG
  79.         }
  80.     }
  81.     FallBack "Diffuse"
  82.     CustomEditor "ShaderForgeMaterialInspector"
  83. }
  84.  
Tags: Shader
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement