Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Made with Amplify Shader Editor v1.9.1.2
- // Available at the Unity Asset Store - http://u3d.as/y3X
- Shader "ViewSpaceFloor"
- {
- Properties
- {
- _Texture0("Texture 0", 2D) = "white" {}
- _ScreenOffset("ScreenOffset", Vector) = (0,0,0,0)
- _Scale("Scale", Vector) = (1,1,0,0)
- _Tint("Tint", Color) = (1,1,1,1)
- _VertexStartOffset("VertexStartOffset", Vector) = (0,0,0,0)
- _VertexScale("VertexScale", Vector) = (0,0,0,0)
- _Range("Range", Float) = 0.05
- _TargetPosition("TargetPosition", Float) = 0
- [HideInInspector] __dirty( "", Int ) = 1
- }
- SubShader
- {
- Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+0" }
- Cull Back
- CGPROGRAM
- #include "UnityPBSLighting.cginc"
- #include "UnityShaderVariables.cginc"
- #pragma target 3.0
- #pragma surface surf StandardCustomLighting keepalpha addshadow fullforwardshadows
- struct Input
- {
- float4 screenPos;
- float3 worldPos;
- };
- struct SurfaceOutputCustomLightingCustom
- {
- half3 Albedo;
- half3 Normal;
- half3 Emission;
- half Metallic;
- half Smoothness;
- half Occlusion;
- half Alpha;
- Input SurfInput;
- UnityGIInput GIData;
- };
- uniform sampler2D _Texture0;
- uniform float2 _Scale;
- uniform float2 _ScreenOffset;
- uniform float3 _VertexScale;
- uniform float _TargetPosition;
- uniform float _Range;
- uniform float3 _VertexStartOffset;
- uniform float4 _Tint;
- inline half4 LightingStandardCustomLighting( inout SurfaceOutputCustomLightingCustom s, half3 viewDir, UnityGI gi )
- {
- UnityGIInput data = s.GIData;
- Input i = s.SurfInput;
- half4 c = 0;
- #ifdef UNITY_PASS_FORWARDBASE
- float ase_lightAtten = data.atten;
- if( _LightColor0.a == 0)
- ase_lightAtten = 0;
- #else
- float3 ase_lightAttenRGB = gi.light.color / ( ( _LightColor0.rgb ) + 0.000001 );
- float ase_lightAtten = max( max( ase_lightAttenRGB.r, ase_lightAttenRGB.g ), ase_lightAttenRGB.b );
- #endif
- #if defined(HANDLE_SHADOWS_BLENDING_IN_GI)
- half bakedAtten = UnitySampleBakedOcclusion(data.lightmapUV.xy, data.worldPos);
- float zDist = dot(_WorldSpaceCameraPos - data.worldPos, UNITY_MATRIX_V[2].xyz);
- float fadeDist = UnityComputeShadowFadeDistance(data.worldPos, zDist);
- ase_lightAtten = UnityMixRealtimeAndBakedShadows(data.atten, bakedAtten, UnityComputeShadowFade(fadeDist));
- #endif
- float4 ase_screenPos = float4( i.screenPos.xyz , i.screenPos.w + 0.00000000001 );
- float4 ase_screenPosNorm = ase_screenPos / ase_screenPos.w;
- ase_screenPosNorm.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? ase_screenPosNorm.z : ase_screenPosNorm.z * 0.5 + 0.5;
- float clampResult83 = clamp( ( ( _TargetPosition - ase_screenPosNorm.y ) / _Range ) , 0.0 , 1.0 );
- float4 appendResult88 = (float4(_VertexScale.x , ( _VertexScale.y * clampResult83 ) , _VertexScale.z , 0.0));
- float3 ase_vertex3Pos = mul( unity_WorldToObject, float4( i.worldPos , 1 ) );
- c.rgb = ( ( tex2D( _Texture0, ( ( ( ase_screenPosNorm * float4( _Scale, 0.0 , 0.0 ) ) + float4( _ScreenOffset, 0.0 , 0.0 ) ) + ( appendResult88 * float4( ( ase_vertex3Pos + _VertexStartOffset ) , 0.0 ) ) ).xy ) * _Tint ) * ase_lightAtten ).rgb;
- c.a = 1;
- return c;
- }
- inline void LightingStandardCustomLighting_GI( inout SurfaceOutputCustomLightingCustom s, UnityGIInput data, inout UnityGI gi )
- {
- s.GIData = data;
- }
- void surf( Input i , inout SurfaceOutputCustomLightingCustom o )
- {
- o.SurfInput = i;
- }
- ENDCG
- }
- Fallback "Diffuse"
- CustomEditor "ASEMaterialInspector"
- }
- /*ASEBEGIN
- Version=19102
- Node;AmplifyShaderEditor.CommentaryNode;98;-985.8995,-135.2;Inherit;False;613.4502;425.1021;XY View Space scaling and offseting, to fit the render with the background texture;5;5;6;8;9;4;;1,1,1,1;0;0
- Node;AmplifyShaderEditor.CommentaryNode;97;-1483.371,316.1996;Inherit;False;1278.052;677.4745;Y View Space - with a height clamp where we want the distortion effect to end;4;16;86;93;94;;1,1,1,1;0;0
- Node;AmplifyShaderEditor.CommentaryNode;96;53.70387,245.4827;Inherit;False;363.6272;260.347;This allows shadows to work;2;92;90;;1,1,1,1;0;0
- Node;AmplifyShaderEditor.CommentaryNode;94;-835.142,662.4852;Inherit;False;368.3609;330.7082;Mesh Vertex Offset;3;13;12;40;;1,1,1,1;0;0
- Node;AmplifyShaderEditor.CommentaryNode;93;-999.3121,359.6997;Inherit;False;461.5712;285.72;Scaling;3;18;88;87;;1,1,1,1;0;0
- Node;AmplifyShaderEditor.CommentaryNode;86;-1476.271,654.1996;Inherit;False;615.27;294.1062;Vertial positioning;6;80;79;81;83;84;85;;1,1,1,1;0;0
- Node;AmplifyShaderEditor.SimpleMultiplyOpNode;87;-823.3145,551.6996;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
- Node;AmplifyShaderEditor.DynamicAppendNode;88;-663.3145,423.6997;Inherit;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0
- Node;AmplifyShaderEditor.SimpleDivideOpNode;85;-1127.312,718.1996;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
- Node;AmplifyShaderEditor.SimpleSubtractOpNode;84;-1255.312,702.1996;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
- Node;AmplifyShaderEditor.SimpleAddOpNode;40;-577.7234,726.3027;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0
- Node;AmplifyShaderEditor.PosVertexDataNode;12;-796.584,712.4852;Inherit;False;0;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
- Node;AmplifyShaderEditor.Vector3Node;13;-807.2419,850.7735;Inherit;False;Property;_VertexStartOffset;VertexStartOffset;4;0;Create;True;0;0;0;False;0;False;0,0,0;0,2.4,0;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
- Node;AmplifyShaderEditor.ClampOpNode;83;-999.3121,702.1996;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0
- Node;AmplifyShaderEditor.LightAttenuation;90;66.00387,430.7693;Inherit;False;0;1;FLOAT;0
- Node;AmplifyShaderEditor.Vector3Node;18;-994.1121,405.0997;Inherit;False;Property;_VertexScale;VertexScale;5;0;Create;True;0;0;0;False;0;False;0,0,0;0,-0.05,0;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
- Node;AmplifyShaderEditor.ScreenPosInputsNode;4;-935.8995,-85.20001;Float;False;0;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
- Node;AmplifyShaderEditor.SimpleMultiplyOpNode;9;-695.8995,58.8;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT2;0,0;False;1;FLOAT4;0
- Node;AmplifyShaderEditor.Vector2Node;8;-932.785,86.91755;Inherit;False;Property;_Scale;Scale;2;0;Create;True;0;0;0;False;0;False;1,1;0.9535,0.916;0;3;FLOAT2;0;FLOAT;1;FLOAT;2
- Node;AmplifyShaderEditor.SimpleAddOpNode;6;-510.7396,74.55874;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT2;0,0;False;1;FLOAT4;0
- Node;AmplifyShaderEditor.Vector2Node;5;-698.7629,171.3221;Inherit;False;Property;_ScreenOffset;ScreenOffset;1;0;Create;True;0;0;0;False;0;False;0,0;0.0234,0.065;0;3;FLOAT2;0;FLOAT;1;FLOAT;2
- Node;AmplifyShaderEditor.SimpleMultiplyOpNode;92;286.3511,290.2823;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
- Node;AmplifyShaderEditor.TexturePropertyNode;1;-367.2188,-128.7771;Inherit;True;Property;_Texture0;Texture 0;0;0;Create;True;0;0;0;False;0;False;None;983d44bd067c45f439d18542afe67d47;False;white;Auto;Texture2D;-1;0;2;SAMPLER2D;0;SAMPLERSTATE;1
- Node;AmplifyShaderEditor.SamplerNode;2;-137.266,-127.3966;Inherit;True;Property;_TextureSample0;Texture Sample 0;1;0;Create;True;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
- Node;AmplifyShaderEditor.ColorNode;10;-69.27036,62.85463;Inherit;False;Property;_Tint;Tint;3;0;Create;True;0;0;0;False;0;False;1,1,1,1;1,1,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
- Node;AmplifyShaderEditor.SimpleMultiplyOpNode;11;178.3978,81.24503;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
- Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;454.1351,-113.4529;Float;False;True;-1;2;ASEMaterialInspector;0;0;CustomLighting;ViewSpaceFloor;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;Back;0;False;;0;False;;False;0;False;;0;False;;False;0;Opaque;0.5;True;True;0;False;Opaque;;Geometry;All;12;all;True;True;True;True;0;False;;False;0;False;;255;False;;255;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;0;False;;False;2;15;10;25;False;0.5;True;0;0;False;;3;False;;0;0;False;;0;False;;0;False;;0;False;;0;False;0;0,0,0,0;VertexOffset;True;False;Cylindrical;False;True;Relative;0;;-1;-1;-1;-1;0;False;0;0;False;;-1;0;False;;0;0;0;False;0.1;False;;0;False;;False;15;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;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
- Node;AmplifyShaderEditor.SimpleAddOpNode;17;-195.186,252.4631;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;FLOAT4;0
- Node;AmplifyShaderEditor.RangedFloatNode;81;-1445.448,700.8519;Inherit;False;Property;_TargetPosition;TargetPosition;7;0;Create;True;0;0;0;False;0;False;0;0.13;0;0;0;1;FLOAT;0
- Node;AmplifyShaderEditor.RangedFloatNode;80;-1261.878,839.6336;Inherit;False;Property;_Range;Range;6;0;Create;True;0;0;0;False;0;False;0.05;0.1;0;0;0;1;FLOAT;0
- Node;AmplifyShaderEditor.SimpleMultiplyOpNode;16;-435.5105,499.9633;Inherit;True;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT4;0
- Node;AmplifyShaderEditor.ScreenPosInputsNode;79;-1465.663,783.5473;Float;False;0;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
- WireConnection;87;0;18;2
- WireConnection;87;1;83;0
- WireConnection;88;0;18;1
- WireConnection;88;1;87;0
- WireConnection;88;2;18;3
- WireConnection;85;0;84;0
- WireConnection;85;1;80;0
- WireConnection;84;0;81;0
- WireConnection;84;1;79;2
- WireConnection;40;0;12;0
- WireConnection;40;1;13;0
- WireConnection;83;0;85;0
- WireConnection;9;0;4;0
- WireConnection;9;1;8;0
- WireConnection;6;0;9;0
- WireConnection;6;1;5;0
- WireConnection;92;0;11;0
- WireConnection;92;1;90;0
- WireConnection;2;0;1;0
- WireConnection;2;1;17;0
- WireConnection;11;0;2;0
- WireConnection;11;1;10;0
- WireConnection;0;13;92;0
- WireConnection;17;0;6;0
- WireConnection;17;1;16;0
- WireConnection;16;0;88;0
- WireConnection;16;1;40;0
- ASEEND*/
- //CHKSM=5864C468B0D127EDCDBFAE96590D4A84141602F3
Advertisement
Add Comment
Please, Sign In to add comment