123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- // Made with Amplify Shader Editor
- // Available at the Unity Asset Store - http://u3d.as/y3X
- Shader "SyntyStudios/Triplanar_ObjectSpace"
- {
- Properties
- {
- _Texture("Texture", 2D) = "white" {}
- _Decal("Decal", 2D) = "white" {}
- _Emiss("Emiss", 2D) = "white" {}
- _Spec("Spec", 2D) = "white" {}
- _Overlay("Overlay", 2D) = "white" {}
- _Tiling("Tiling", Float) = 0
- _Falloff("Falloff", Float) = 0
- _OverlayAmount("OverlayAmount", Float) = 0
- _Smoothness("Smoothness", Color) = (0,0,0,0)
- [HideInInspector] _texcoord2( "", 2D ) = "white" {}
- [HideInInspector] _texcoord( "", 2D ) = "white" {}
- [HideInInspector] __dirty( "", Int ) = 1
- }
- SubShader
- {
- Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+0" "IsEmissive" = "true" }
- Cull Back
- CGINCLUDE
- #include "UnityPBSLighting.cginc"
- #include "Lighting.cginc"
- #pragma target 3.0
- #ifdef UNITY_PASS_SHADOWCASTER
- #undef INTERNAL_DATA
- #undef WorldReflectionVector
- #undef WorldNormalVector
- #define INTERNAL_DATA half3 internalSurfaceTtoW0; half3 internalSurfaceTtoW1; half3 internalSurfaceTtoW2;
- #define WorldReflectionVector(data,normal) reflect (data.worldRefl, half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal)))
- #define WorldNormalVector(data,normal) half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))
- #endif
- struct Input
- {
- float2 uv2_texcoord2;
- float2 uv_texcoord;
- float3 worldPos;
- float3 worldNormal;
- INTERNAL_DATA
- };
- uniform sampler2D _Decal;
- uniform float4 _Decal_ST;
- uniform sampler2D _Texture;
- uniform float4 _Texture_ST;
- uniform sampler2D _Overlay;
- uniform float _Tiling;
- uniform float _Falloff;
- uniform float _OverlayAmount;
- uniform sampler2D _Emiss;
- uniform float4 _Emiss_ST;
- uniform sampler2D _Spec;
- uniform float4 _Spec_ST;
- uniform float4 _Smoothness;
- inline float4 TriplanarSamplingCF( sampler2D topTexMap, sampler2D midTexMap, sampler2D botTexMap, float3 worldPos, float3 worldNormal, float falloff, float tilling, float3 normalScale, float3 index )
- {
- float3 projNormal = ( pow( abs( worldNormal ), falloff ) );
- projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;
- float3 nsign = sign( worldNormal );
- float negProjNormalY = max( 0, projNormal.y * -nsign.y );
- projNormal.y = max( 0, projNormal.y * nsign.y );
- half4 xNorm; half4 yNorm; half4 yNormN; half4 zNorm;
- xNorm = ( tex2D( midTexMap, tilling * worldPos.zy * float2( nsign.x, 1.0 ) ) );
- yNorm = ( tex2D( topTexMap, tilling * worldPos.xz * float2( nsign.y, 1.0 ) ) );
- yNormN = ( tex2D( botTexMap, tilling * worldPos.xz * float2( nsign.y, 1.0 ) ) );
- zNorm = ( tex2D( midTexMap, tilling * worldPos.xy * float2( -nsign.z, 1.0 ) ) );
- return xNorm * projNormal.x + yNorm * projNormal.y + yNormN * negProjNormalY + zNorm * projNormal.z;
- }
- void surf( Input i , inout SurfaceOutputStandard o )
- {
- o.Normal = float3(0,0,1);
- float2 uv2_Decal = i.uv2_texcoord2 * _Decal_ST.xy + _Decal_ST.zw;
- float2 uv_Texture = i.uv_texcoord * _Texture_ST.xy + _Texture_ST.zw;
- float4 blendOpSrc28 = tex2D( _Decal, uv2_Decal );
- float4 blendOpDest28 = tex2D( _Texture, uv_Texture );
- float3 ase_worldPos = i.worldPos;
- float3 ase_worldNormal = WorldNormalVector( i, float3( 0, 0, 1 ) );
- float3 localPos = mul( unity_WorldToObject, float4( ase_worldPos, 1 ) );
- float3 localNormal = mul( unity_WorldToObject, float4( ase_worldNormal, 0 ) );
- float4 triplanar5 = TriplanarSamplingCF( _Overlay, _Overlay, _Overlay, localPos, localNormal, _Falloff, _Tiling, float3( 1,1,1 ), float3(0,0,0) );
- o.Albedo = ( ( saturate( ( blendOpSrc28 * blendOpDest28 ) )) * ( triplanar5 * _OverlayAmount ) ).rgb;
- float2 uv_Emiss = i.uv_texcoord * _Emiss_ST.xy + _Emiss_ST.zw;
- float4 tex2DNode25 = tex2D( _Emiss, uv_Emiss );
- o.Emission = tex2DNode25.rgb;
- float2 uv_Spec = i.uv_texcoord * _Spec_ST.xy + _Spec_ST.zw;
- float4 tex2DNode39 = tex2D( _Spec, uv_Spec );
- o.Metallic = tex2DNode39.r;
- o.Smoothness = _Smoothness.r;
- o.Alpha = 1;
- }
- ENDCG
- CGPROGRAM
- #pragma surface surf Standard keepalpha fullforwardshadows
- ENDCG
- Pass
- {
- Name "ShadowCaster"
- Tags{ "LightMode" = "ShadowCaster" }
- ZWrite On
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- #pragma target 3.0
- #pragma multi_compile_shadowcaster
- #pragma multi_compile UNITY_PASS_SHADOWCASTER
- #pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
- #include "HLSLSupport.cginc"
- #if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )
- #define CAN_SKIP_VPOS
- #endif
- #include "UnityCG.cginc"
- #include "Lighting.cginc"
- #include "UnityPBSLighting.cginc"
- struct v2f
- {
- V2F_SHADOW_CASTER;
- float4 customPack1 : TEXCOORD1;
- float4 tSpace0 : TEXCOORD2;
- float4 tSpace1 : TEXCOORD3;
- float4 tSpace2 : TEXCOORD4;
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- v2f vert( appdata_full v )
- {
- v2f o;
- UNITY_SETUP_INSTANCE_ID( v );
- UNITY_INITIALIZE_OUTPUT( v2f, o );
- UNITY_TRANSFER_INSTANCE_ID( v, o );
- Input customInputData;
- float3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
- half3 worldNormal = UnityObjectToWorldNormal( v.normal );
- half3 worldTangent = UnityObjectToWorldDir( v.tangent.xyz );
- half tangentSign = v.tangent.w * unity_WorldTransformParams.w;
- half3 worldBinormal = cross( worldNormal, worldTangent ) * tangentSign;
- o.tSpace0 = float4( worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x );
- o.tSpace1 = float4( worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y );
- o.tSpace2 = float4( worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z );
- o.customPack1.xy = customInputData.uv2_texcoord2;
- o.customPack1.xy = v.texcoord1;
- o.customPack1.zw = customInputData.uv_texcoord;
- o.customPack1.zw = v.texcoord;
- TRANSFER_SHADOW_CASTER_NORMALOFFSET( o )
- return o;
- }
- half4 frag( v2f IN
- #if !defined( CAN_SKIP_VPOS )
- , UNITY_VPOS_TYPE vpos : VPOS
- #endif
- ) : SV_Target
- {
- UNITY_SETUP_INSTANCE_ID( IN );
- Input surfIN;
- UNITY_INITIALIZE_OUTPUT( Input, surfIN );
- surfIN.uv2_texcoord2 = IN.customPack1.xy;
- surfIN.uv_texcoord = IN.customPack1.zw;
- float3 worldPos = float3( IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w );
- half3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );
- surfIN.worldPos = worldPos;
- surfIN.worldNormal = float3( IN.tSpace0.z, IN.tSpace1.z, IN.tSpace2.z );
- surfIN.internalSurfaceTtoW0 = IN.tSpace0.xyz;
- surfIN.internalSurfaceTtoW1 = IN.tSpace1.xyz;
- surfIN.internalSurfaceTtoW2 = IN.tSpace2.xyz;
- SurfaceOutputStandard o;
- UNITY_INITIALIZE_OUTPUT( SurfaceOutputStandard, o )
- surf( surfIN, o );
- #if defined( CAN_SKIP_VPOS )
- float2 vpos = IN.pos;
- #endif
- SHADOW_CASTER_FRAGMENT( IN )
- }
- ENDCG
- }
- }
- Fallback "Diffuse"
- CustomEditor "ASEMaterialInspector"
- }
- /*ASEBEGIN
- Version=16200
- 2567;32;2546;1397;2593.814;439.5397;1.255;True;False
- Node;AmplifyShaderEditor.TexturePropertyNode;6;-1466.299,58.7578;Float;True;Property;_Overlay;Overlay;6;0;Create;True;0;0;False;0;None;93e718fcc411432439749387d41fa07a;False;white;Auto;Texture2D;0;1;SAMPLER2D;0
- Node;AmplifyShaderEditor.RangedFloatNode;7;-1453.889,253.0376;Float;False;Property;_Tiling;Tiling;7;0;Create;True;0;0;False;0;0;2.74;0;0;0;1;FLOAT;0
- Node;AmplifyShaderEditor.RangedFloatNode;13;-1445.5,344.5002;Float;False;Property;_Falloff;Falloff;9;0;Create;True;0;0;False;0;0;10;0;0;0;1;FLOAT;0
- Node;AmplifyShaderEditor.SamplerNode;4;-1645.439,-227.072;Float;True;Property;_Texture;Texture;0;0;Create;True;0;0;False;0;84508b93f15f2b64386ec07486afc7a3;84508b93f15f2b64386ec07486afc7a3;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;1;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
- Node;AmplifyShaderEditor.SamplerNode;29;-1661.991,-456.7638;Float;True;Property;_Decal;Decal;1;0;Create;True;0;0;False;0;84508b93f15f2b64386ec07486afc7a3;84508b93f15f2b64386ec07486afc7a3;True;1;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;1;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
- Node;AmplifyShaderEditor.RangedFloatNode;27;-948.991,334.2362;Float;False;Property;_OverlayAmount;OverlayAmount;11;0;Create;True;0;0;False;0;0;2.76;0;0;0;1;FLOAT;0
- Node;AmplifyShaderEditor.TriplanarNode;5;-1198.82,95.44791;Float;True;Cylindrical;Object;False;Top Texture 0;_TopTexture0;white;2;None;Mid Texture 0;_MidTexture0;white;1;None;Bot Texture 0;_BotTexture0;white;2;None;Triplanar Sampler;False;9;0;SAMPLER2D;;False;5;FLOAT;1;False;1;SAMPLER2D;;False;6;FLOAT;0;False;2;SAMPLER2D;;False;7;FLOAT;0;False;8;FLOAT3;1,1,1;False;3;FLOAT;1;False;4;FLOAT;100;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
- Node;AmplifyShaderEditor.SimpleMultiplyOpNode;26;-713.991,94.93617;Float;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT;0;False;1;FLOAT4;0
- Node;AmplifyShaderEditor.BlendOpsNode;28;-803.991,-384.7638;Float;True;Multiply;True;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
- Node;AmplifyShaderEditor.SamplerNode;15;-1829.302,783.0169;Float;True;Global;Normals;Normals;10;0;Create;True;0;0;False;0;None;None;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;0,0;False;1;FLOAT2;1,0;False;2;FLOAT;1;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
- Node;AmplifyShaderEditor.NormalizeNode;16;-1606.605,1051.917;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0
- Node;AmplifyShaderEditor.PowerNode;22;-877.9045,1014.717;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
- Node;AmplifyShaderEditor.SamplerNode;42;-1215.82,494.1794;Float;True;Property;_Emis2;Emis2;3;0;Create;True;0;0;False;0;84508b93f15f2b64386ec07486afc7a3;84508b93f15f2b64386ec07486afc7a3;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;1;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
- Node;AmplifyShaderEditor.RangedFloatNode;20;-1167.304,1106.717;Float;False;Property;_RimPower;RimPower;8;0;Create;True;0;0;False;0;0;6.11;0;10;0;1;FLOAT;0
- Node;AmplifyShaderEditor.ColorNode;21;-884.1041,1194.516;Float;False;Property;_RimColor;RimColor;5;0;Create;True;0;0;False;0;0,0,0,0;0.5810912,0.3900843,0.8161765,0;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
- Node;AmplifyShaderEditor.ViewDirInputsCoordNode;14;-1829.302,1055.017;Float;False;Tangent;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
- Node;AmplifyShaderEditor.SimpleAddOpNode;41;-787.8645,613.4051;Float;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
- Node;AmplifyShaderEditor.OneMinusNode;19;-1070.702,991.3159;Float;False;1;0;FLOAT;0;False;1;FLOAT;0
- Node;AmplifyShaderEditor.SimpleMultiplyOpNode;23;-703.5043,1025.916;Float;False;2;2;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
- Node;AmplifyShaderEditor.SaturateNode;18;-1239.705,949.0169;Float;False;1;0;FLOAT;1.23;False;1;FLOAT;0
- Node;AmplifyShaderEditor.DotProductOpNode;17;-1414.905,973.5169;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0
- Node;AmplifyShaderEditor.SimpleAddOpNode;24;-539.549,532.8794;Float;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
- Node;AmplifyShaderEditor.ColorNode;31;-244.2706,459.1009;Float;False;Property;_Smoothness;Smoothness;12;0;Create;True;0;0;False;0;0,0,0,0;0.5955882,0.5955882,0.5955882,0;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
- Node;AmplifyShaderEditor.SimpleMultiplyOpNode;40;7.771705,50.4398;Float;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
- Node;AmplifyShaderEditor.SamplerNode;25;-1212.115,695.0443;Float;True;Property;_Emiss;Emiss;2;0;Create;True;0;0;False;0;84508b93f15f2b64386ec07486afc7a3;84508b93f15f2b64386ec07486afc7a3;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;1;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
- Node;AmplifyShaderEditor.SimpleMultiplyOpNode;11;-465.2369,-22.28335;Float;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;COLOR;0
- Node;AmplifyShaderEditor.SamplerNode;39;-276.618,654.6751;Float;True;Property;_Spec;Spec;4;0;Create;True;0;0;False;0;84508b93f15f2b64386ec07486afc7a3;84508b93f15f2b64386ec07486afc7a3;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;1;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
- Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;300.8402,-52.49501;Float;False;True;2;Float;ASEMaterialInspector;0;0;Standard;SyntyStudios/Triplanar_ObjectSpace;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;Back;0;False;-1;0;False;-1;False;0;False;-1;0;False;-1;False;0;Opaque;0.5;True;True;0;False;Opaque;;Geometry;All;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;0;False;-1;False;0;False;-1;255;False;-1;255;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;False;2;15;10;25;False;0.5;True;0;0;False;-1;0;False;-1;0;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;0;0,0,0,0;VertexOffset;True;False;Cylindrical;False;Relative;0;;-1;-1;-1;-1;0;False;0;0;False;-1;-1;0;False;-1;0;0;0;16;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0;False;9;FLOAT;0;False;10;FLOAT;0;False;13;FLOAT3;0,0,0;False;11;FLOAT3;0,0,0;False;12;FLOAT3;0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
- WireConnection;5;0;6;0
- WireConnection;5;1;6;0
- WireConnection;5;2;6;0
- WireConnection;5;3;7;0
- WireConnection;5;4;13;0
- WireConnection;26;0;5;0
- WireConnection;26;1;27;0
- WireConnection;28;0;29;0
- WireConnection;28;1;4;0
- WireConnection;16;0;14;0
- WireConnection;22;0;19;0
- WireConnection;22;1;20;0
- WireConnection;41;0;42;0
- WireConnection;41;1;25;0
- WireConnection;19;0;18;0
- WireConnection;23;0;22;0
- WireConnection;23;1;21;0
- WireConnection;18;0;17;0
- WireConnection;17;0;15;0
- WireConnection;17;1;16;0
- WireConnection;24;0;23;0
- WireConnection;24;1;41;0
- WireConnection;40;0;24;0
- WireConnection;40;1;39;0
- WireConnection;11;0;28;0
- WireConnection;11;1;26;0
- WireConnection;0;0;11;0
- WireConnection;0;2;25;0
- WireConnection;0;3;39;0
- WireConnection;0;4;31;0
- ASEEND*/
- //CHKSM=F6B89CEF18FD53AD9EFB8ED45A9168608E9E393C
|