You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
6.5 KiB

  1. // Upgrade NOTE: commented out 'sampler2D unity_Lightmap', a built-in variable
  2. // Upgrade NOTE: replaced tex2D unity_Lightmap with UNITY_SAMPLE_TEX2D
  3. // Made with Amplify Shader Editor
  4. // Available at the Unity Asset Store - http://u3d.as/y3X
  5. Shader "UnlitWithLightmap"
  6. {
  7. Properties
  8. {
  9. _MainTex("MainTex", 2D) = "white" {}
  10. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  11. }
  12. SubShader
  13. {
  14. Tags { "RenderType"="Opaque" }
  15. LOD 100
  16. CGINCLUDE
  17. #pragma target 3.0
  18. ENDCG
  19. Blend Off
  20. Cull Back
  21. ColorMask RGBA
  22. ZWrite On
  23. ZTest LEqual
  24. Offset 0 , 0
  25. Pass
  26. {
  27. Tags { "LightMode"="VertexLMRGBM" "RenderType"="Opaque" }
  28. Name "Unlit LM"
  29. CGPROGRAM
  30. #pragma target 2.0
  31. #pragma vertex vert
  32. #pragma fragment frag
  33. #include "UnityCG.cginc"
  34. struct appdata
  35. {
  36. float4 vertex : POSITION;
  37. UNITY_VERTEX_INPUT_INSTANCE_ID
  38. float4 ase_texcoord1 : TEXCOORD1;
  39. float4 ase_texcoord : TEXCOORD0;
  40. };
  41. struct v2f
  42. {
  43. float4 vertex : SV_POSITION;
  44. UNITY_VERTEX_OUTPUT_STEREO
  45. float4 ase_texcoord : TEXCOORD0;
  46. };
  47. // uniform sampler2D unity_Lightmap;
  48. uniform sampler2D _MainTex;
  49. uniform float4 _MainTex_ST;
  50. v2f vert ( appdata v )
  51. {
  52. v2f o;
  53. UNITY_SETUP_INSTANCE_ID(v);
  54. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  55. float2 uv2_g5 = v.ase_texcoord1 * float2( 1,1 ) + float2( 0,0 );
  56. float2 vertexToFrag10_g5 = ( ( uv2_g5 * (unity_LightmapST).xy ) + (unity_LightmapST).zw );
  57. o.ase_texcoord.xy = vertexToFrag10_g5;
  58. o.ase_texcoord.zw = v.ase_texcoord.xy;
  59. v.vertex.xyz += float3(0,0,0) ;
  60. o.vertex = UnityObjectToClipPos(v.vertex);
  61. return o;
  62. }
  63. fixed4 frag (v2f i ) : SV_Target
  64. {
  65. fixed4 finalColor;
  66. float2 vertexToFrag10_g5 = i.ase_texcoord.xy;
  67. float3 decodeLightMap6_g5 = DecodeLightmap( UNITY_SAMPLE_TEX2D( unity_Lightmap, vertexToFrag10_g5 ) );
  68. float2 uv_MainTex = i.ase_texcoord.zw * _MainTex_ST.xy + _MainTex_ST.zw;
  69. float4 appendResult8 = (float4(( decodeLightMap6_g5 * (tex2D( _MainTex, uv_MainTex )).rgb ) , 1.0));
  70. finalColor = appendResult8;
  71. return finalColor;
  72. }
  73. ENDCG
  74. }
  75. Pass
  76. {
  77. Tags { "LightMode"="VertexLM" "RenderType"="Opaque" }
  78. Name "Unlit LM Mobile"
  79. CGPROGRAM
  80. #pragma target 2.0
  81. #pragma vertex vert
  82. #pragma fragment frag
  83. #include "UnityCG.cginc"
  84. struct appdata
  85. {
  86. float4 vertex : POSITION;
  87. UNITY_VERTEX_INPUT_INSTANCE_ID
  88. float4 ase_texcoord1 : TEXCOORD1;
  89. float4 ase_texcoord : TEXCOORD0;
  90. };
  91. struct v2f
  92. {
  93. float4 vertex : SV_POSITION;
  94. UNITY_VERTEX_OUTPUT_STEREO
  95. float4 ase_texcoord : TEXCOORD0;
  96. };
  97. // uniform sampler2D unity_Lightmap;
  98. uniform sampler2D _MainTex;
  99. uniform float4 _MainTex_ST;
  100. v2f vert ( appdata v )
  101. {
  102. v2f o;
  103. UNITY_SETUP_INSTANCE_ID(v);
  104. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  105. float2 uv2_g5 = v.ase_texcoord1 * float2( 1,1 ) + float2( 0,0 );
  106. float2 vertexToFrag10_g5 = ( ( uv2_g5 * (unity_LightmapST).xy ) + (unity_LightmapST).zw );
  107. o.ase_texcoord.xy = vertexToFrag10_g5;
  108. o.ase_texcoord.zw = v.ase_texcoord.xy;
  109. v.vertex.xyz += float3(0,0,0) ;
  110. o.vertex = UnityObjectToClipPos(v.vertex);
  111. return o;
  112. }
  113. fixed4 frag (v2f i ) : SV_Target
  114. {
  115. fixed4 finalColor;
  116. float2 vertexToFrag10_g5 = i.ase_texcoord.xy;
  117. float3 decodeLightMap6_g5 = DecodeLightmap( UNITY_SAMPLE_TEX2D( unity_Lightmap, vertexToFrag10_g5 ) );
  118. float2 uv_MainTex = i.ase_texcoord.zw * _MainTex_ST.xy + _MainTex_ST.zw;
  119. float4 appendResult8 = (float4(( decodeLightMap6_g5 * (tex2D( _MainTex, uv_MainTex )).rgb ) , 1.0));
  120. finalColor = appendResult8;
  121. return finalColor;
  122. }
  123. ENDCG
  124. }
  125. }
  126. CustomEditor "ASEMaterialInspector"
  127. }
  128. /*ASEBEGIN
  129. Version=16105
  130. 289;92;953;701;432.0117;130.2233;1;True;False
  131. Node;AmplifyShaderEditor.SamplerNode;5;-466.1202,154.9717;Float;True;Property;_MainTex;MainTex;2;0;Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;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;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  132. Node;AmplifyShaderEditor.FunctionNode;29;-179.4124,-139.861;Float;False;FetchLightmapValue;0;;5;43de3d4ae59f645418fdd020d1b8e78e;0;0;1;FLOAT3;0
  133. Node;AmplifyShaderEditor.ComponentMaskNode;6;-109.2208,156.4722;Float;False;True;True;True;False;1;0;COLOR;0,0,0,0;False;1;FLOAT3;0
  134. Node;AmplifyShaderEditor.RangedFloatNode;9;-7.021393,247.4722;Float;False;Constant;_Float0;Float 0;1;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0
  135. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;7;92.27861,-34.62788;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0
  136. Node;AmplifyShaderEditor.DynamicAppendNode;8;231.3786,62.87191;Float;False;FLOAT4;4;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0
  137. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;17;371.8,-33.8;Float;False;False;2;Float;ASEMaterialInspector;0;8;ASECustomTemplateShaders/UnlitLM;899e609c083c74c4ca567477c39edef0;0;1;Unlit LM Mobile;0;True;0;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;True;0;False;-1;0;False;-1;True;False;True;0;False;-1;True;True;True;True;True;0;False;-1;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;RenderType=Opaque=RenderType;True;2;0;False;False;False;False;False;False;False;False;False;True;2;LightMode=VertexLM;RenderType=Opaque=RenderType;True;0;0;;0;0;Standard;0;2;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0,0,0;False;0
  138. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;16;441.9998,-13;Float;False;True;2;Float;ASEMaterialInspector;0;11;UnlitWithLightmap;899e609c083c74c4ca567477c39edef0;0;0;Unlit LM;2;True;0;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;True;0;False;-1;0;False;-1;True;False;True;0;False;-1;True;True;True;True;True;0;False;-1;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;True;1;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;1;RenderType=Opaque=RenderType;True;2;0;False;False;False;False;False;False;False;False;False;True;2;LightMode=VertexLMRGBM;RenderType=Opaque=RenderType;True;0;0;;0;0;Standard;0;2;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0,0,0;False;0
  139. WireConnection;6;0;5;0
  140. WireConnection;7;0;29;0
  141. WireConnection;7;1;6;0
  142. WireConnection;8;0;7;0
  143. WireConnection;8;3;9;0
  144. WireConnection;16;0;8;0
  145. ASEEND*/
  146. //CHKSM=3F5EBC414FBDA00CBCA1EDEAD64B5686D4C9546F