1963 lines
		
	
	
		
			64 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			1963 lines
		
	
	
		
			64 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| 
								 | 
							
								// Curved World <http://u3d.as/1W8h>
							 | 
						||
| 
								 | 
							
								// Copyright (c) Amazing Assets <https://amazingassets.world>
							 | 
						||
| 
								 | 
							
								 
							 | 
						||
| 
								 | 
							
								Shader "Amazing Assets/Curved World/Nature/SpeedTree"
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    Properties
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        [HideInInspector] [CurvedWorldSeparator]        _Separator("20", float) = 0
							 | 
						||
| 
								 | 
							
								        [HideInInspector] [CurvedWorldBendSettings]	  _CurvedWorldBendSettings("0|1|1", Vector) = (0, 0, 0, 0)
							 | 
						||
| 
								 | 
							
								        [HideInInspector] [CurvedWorldSeparator]        _Separator("20", float) = 0
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        _Color ("Main Color", Color) = (1,1,1,1)
							 | 
						||
| 
								 | 
							
								        _HueVariation ("Hue Variation", Color) = (1.0,0.5,0.0,0.1)
							 | 
						||
| 
								 | 
							
								        _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
							 | 
						||
| 
								 | 
							
								        _DetailTex ("Detail", 2D) = "black" {}
							 | 
						||
| 
								 | 
							
								        _BumpMap ("Normal Map", 2D) = "bump" {}
							 | 
						||
| 
								 | 
							
								        _Cutoff ("Alpha Cutoff", Range(0,1)) = 0.333
							 | 
						||
| 
								 | 
							
								        [MaterialEnum(Off,0,Front,1,Back,2)] _Cull ("Cull", Int) = 2
							 | 
						||
| 
								 | 
							
								        [MaterialEnum(None,0,Fastest,1,Fast,2,Better,3,Best,4,Palm,5)] _WindQuality ("Wind Quality", Range(0,5)) = 0
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    // targeting SM3.0+
							 | 
						||
| 
								 | 
							
								    SubShader
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        Tags
							 | 
						||
| 
								 | 
							
								        {
							 | 
						||
| 
								 | 
							
								            "Queue"="Geometry"
							 | 
						||
| 
								 | 
							
								            "IgnoreProjector"="True"
							 | 
						||
| 
								 | 
							
								            "RenderType"="TransparentCutout"
							 | 
						||
| 
								 | 
							
								            "DisableBatching"="LODFading"
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        LOD 400
							 | 
						||
| 
								 | 
							
								        Cull [_Cull]
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        
							 | 
						||
| 
								 | 
							
									// ------------------------------------------------------------
							 | 
						||
| 
								 | 
							
									// Surface shader code generated out of a CGPROGRAM block:
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									// ---- forward rendering base pass:
							 | 
						||
| 
								 | 
							
									Pass {
							 | 
						||
| 
								 | 
							
										Name "FORWARD"
							 | 
						||
| 
								 | 
							
										Tags { "LightMode" = "ForwardBase" }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								CGPROGRAM
							 | 
						||
| 
								 | 
							
								// compile directives
							 | 
						||
| 
								 | 
							
								#pragma vertex vert_surf
							 | 
						||
| 
								 | 
							
								#pragma fragment frag_surf
							 | 
						||
| 
								 | 
							
								#pragma target 3.0 LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								#pragma target 3.0
							 | 
						||
| 
								 | 
							
								#pragma instancing_options assumeuniformscaling maxcount:50
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_vertex LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_fragment __ LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_instancing
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_fog
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_fwdbase nodynlightmap nodirlightmap
							 | 
						||
| 
								 | 
							
								#include "HLSLSupport.cginc"
							 | 
						||
| 
								 | 
							
								#define UNITY_ASSUME_UNIFORM_SCALING
							 | 
						||
| 
								 | 
							
								#define UNITY_MAX_INSTANCE_COUNT 50
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LOD_FADE
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_SH
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LIGHTMAPSTS
							 | 
						||
| 
								 | 
							
								#include "UnityShaderVariables.cginc"
							 | 
						||
| 
								 | 
							
								#include "UnityShaderUtilities.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "UnityCG.cginc"
							 | 
						||
| 
								 | 
							
								#include "Lighting.cginc"
							 | 
						||
| 
								 | 
							
								#include "AutoLight.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#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) fixed3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local EFFECT_BUMP
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local EFFECT_HUE_VARIATION
							 | 
						||
| 
								 | 
							
								            #define ENABLE_WIND
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_ID_1
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
							 | 
						||
| 
								 | 
							
								#include "../../Core/CurvedWorldTransform.cginc"
							 | 
						||
| 
								 | 
							
								 
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #include "SpeedTreeCommon.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            void surf(Input IN, inout SurfaceOutput OUT)
							 | 
						||
| 
								 | 
							
								            {
							 | 
						||
| 
								 | 
							
								                SpeedTreeFragOut o;
							 | 
						||
| 
								 | 
							
								                SpeedTreeFrag(IN, o);
							 | 
						||
| 
								 | 
							
								                SPEEDTREE_COPY_FRAG(OUT, o)
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex-to-fragment interpolation data
							 | 
						||
| 
								 | 
							
								// no lightmaps:
							 | 
						||
| 
								 | 
							
								#ifndef LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								// half-precision fragment shader registers:
							 | 
						||
| 
								 | 
							
								#ifdef UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS
							 | 
						||
| 
								 | 
							
								#define FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								struct v2f_surf {
							 | 
						||
| 
								 | 
							
								  UNITY_POSITION(pos);
							 | 
						||
| 
								 | 
							
								  float4 tSpace0 : TEXCOORD0;
							 | 
						||
| 
								 | 
							
								  float4 tSpace1 : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								  float4 tSpace2 : TEXCOORD2;
							 | 
						||
| 
								 | 
							
								  half4 custompack0 : TEXCOORD3; // color
							 | 
						||
| 
								 | 
							
								  half3 custompack1 : TEXCOORD4; // interpolator1
							 | 
						||
| 
								 | 
							
								  #if UNITY_SHOULD_SAMPLE_SH
							 | 
						||
| 
								 | 
							
								  half3 sh : TEXCOORD5; // SH
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  UNITY_LIGHTING_COORDS(6,7)
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								// high-precision fragment shader registers:
							 | 
						||
| 
								 | 
							
								#ifndef UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS
							 | 
						||
| 
								 | 
							
								struct v2f_surf {
							 | 
						||
| 
								 | 
							
								  UNITY_POSITION(pos);
							 | 
						||
| 
								 | 
							
								  float4 tSpace0 : TEXCOORD0;
							 | 
						||
| 
								 | 
							
								  float4 tSpace1 : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								  float4 tSpace2 : TEXCOORD2;
							 | 
						||
| 
								 | 
							
								  half4 custompack0 : TEXCOORD3; // color
							 | 
						||
| 
								 | 
							
								  half3 custompack1 : TEXCOORD4; // interpolator1
							 | 
						||
| 
								 | 
							
								  #if UNITY_SHOULD_SAMPLE_SH
							 | 
						||
| 
								 | 
							
								  half3 sh : TEXCOORD5; // SH
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  UNITY_FOG_COORDS(6)
							 | 
						||
| 
								 | 
							
								  UNITY_SHADOW_COORDS(7)
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								// with lightmaps:
							 | 
						||
| 
								 | 
							
								#ifdef LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								// half-precision fragment shader registers:
							 | 
						||
| 
								 | 
							
								#ifdef UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS
							 | 
						||
| 
								 | 
							
								#define FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								struct v2f_surf {
							 | 
						||
| 
								 | 
							
								  UNITY_POSITION(pos);
							 | 
						||
| 
								 | 
							
								  float4 tSpace0 : TEXCOORD0;
							 | 
						||
| 
								 | 
							
								  float4 tSpace1 : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								  float4 tSpace2 : TEXCOORD2;
							 | 
						||
| 
								 | 
							
								  half4 custompack0 : TEXCOORD3; // color
							 | 
						||
| 
								 | 
							
								  half3 custompack1 : TEXCOORD4; // interpolator1
							 | 
						||
| 
								 | 
							
								  float4 lmap : TEXCOORD5;
							 | 
						||
| 
								 | 
							
								  UNITY_LIGHTING_COORDS(6,7)
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								// high-precision fragment shader registers:
							 | 
						||
| 
								 | 
							
								#ifndef UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS
							 | 
						||
| 
								 | 
							
								struct v2f_surf {
							 | 
						||
| 
								 | 
							
								  UNITY_POSITION(pos);
							 | 
						||
| 
								 | 
							
								  float4 tSpace0 : TEXCOORD0;
							 | 
						||
| 
								 | 
							
								  float4 tSpace1 : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								  float4 tSpace2 : TEXCOORD2;
							 | 
						||
| 
								 | 
							
								  half4 custompack0 : TEXCOORD3; // color
							 | 
						||
| 
								 | 
							
								  half3 custompack1 : TEXCOORD4; // interpolator1
							 | 
						||
| 
								 | 
							
								  float4 lmap : TEXCOORD5;
							 | 
						||
| 
								 | 
							
								  UNITY_FOG_COORDS(6)
							 | 
						||
| 
								 | 
							
								  UNITY_SHADOW_COORDS(7)
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex shader
							 | 
						||
| 
								 | 
							
								v2f_surf vert_surf (SpeedTreeVB v) {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(v);
							 | 
						||
| 
								 | 
							
								  v2f_surf o;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(v2f_surf,o);
							 | 
						||
| 
								 | 
							
								  UNITY_TRANSFER_INSTANCE_ID(v,o);
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
							 | 
						||
| 
								 | 
							
								  Input customInputData;
							 | 
						||
| 
								 | 
							
								  SpeedTreeVert (v, customInputData);
							 | 
						||
| 
								 | 
							
								  o.custompack0.xyzw = customInputData.color;
							 | 
						||
| 
								 | 
							
								  o.custompack1.xyz = customInputData.interpolator1;
							 | 
						||
| 
								 | 
							
								  o.pos = UnityObjectToClipPos(v.vertex);
							 | 
						||
| 
								 | 
							
								  float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldNormal = UnityObjectToWorldNormal(v.normal);
							 | 
						||
| 
								 | 
							
								  fixed3 worldTangent = UnityObjectToWorldDir(v.tangent.xyz);
							 | 
						||
| 
								 | 
							
								  fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w;
							 | 
						||
| 
								 | 
							
								  fixed3 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);
							 | 
						||
| 
								 | 
							
								  #ifdef LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								  o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // SH/ambient and vertex lights
							 | 
						||
| 
								 | 
							
								  #ifndef LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								    #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
							 | 
						||
| 
								 | 
							
								      o.sh = 0;
							 | 
						||
| 
								 | 
							
								      // Approximated illumination from non-important point lights
							 | 
						||
| 
								 | 
							
								      #ifdef VERTEXLIGHT_ON
							 | 
						||
| 
								 | 
							
								        o.sh += Shade4PointLights (
							 | 
						||
| 
								 | 
							
								          unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0,
							 | 
						||
| 
								 | 
							
								          unity_LightColor[0].rgb, unity_LightColor[1].rgb, unity_LightColor[2].rgb, unity_LightColor[3].rgb,
							 | 
						||
| 
								 | 
							
								          unity_4LightAtten0, worldPos, worldNormal);
							 | 
						||
| 
								 | 
							
								      #endif
							 | 
						||
| 
								 | 
							
								      o.sh = ShadeSHPerVertex (worldNormal, o.sh);
							 | 
						||
| 
								 | 
							
								    #endif
							 | 
						||
| 
								 | 
							
								  #endif // !LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  UNITY_TRANSFER_LIGHTING(o,v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader
							 | 
						||
| 
								 | 
							
								  #ifdef FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								    UNITY_TRANSFER_FOG_COMBINED_WITH_TSPACE(o,o.pos); // pass fog coordinates to pixel shader
							 | 
						||
| 
								 | 
							
								  #elif defined (FOG_COMBINED_WITH_WORLD_POS)
							 | 
						||
| 
								 | 
							
								    UNITY_TRANSFER_FOG_COMBINED_WITH_WORLD_POS(o,o.pos); // pass fog coordinates to pixel shader
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  return o;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// fragment shader
							 | 
						||
| 
								 | 
							
								fixed4 frag_surf (v2f_surf IN) : SV_Target {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(IN);
							 | 
						||
| 
								 | 
							
								  // prepare and unpack data
							 | 
						||
| 
								 | 
							
								  Input surfIN;
							 | 
						||
| 
								 | 
							
								  #ifdef FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_TSPACE(IN);
							 | 
						||
| 
								 | 
							
								  #elif defined (FOG_COMBINED_WITH_WORLD_POS)
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN);
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG(IN);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								    UNITY_RECONSTRUCT_TBN(IN);
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_TBN(IN);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(Input,surfIN);
							 | 
						||
| 
								 | 
							
								  surfIN.color.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.color = IN.custompack0.xyzw;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1 = IN.custompack1.xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldPos = float3(IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w);
							 | 
						||
| 
								 | 
							
								  #ifndef USING_DIRECTIONAL_LIGHT
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = normalize(UnityWorldSpaceLightDir(worldPos));
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = _WorldSpaceLightPos0.xyz;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef UNITY_COMPILER_HLSL
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o = (SurfaceOutput)0;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  o.Albedo = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Emission = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Specular = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Alpha = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Gloss = 0.0;
							 | 
						||
| 
								 | 
							
								  fixed3 normalWorldVertex = fixed3(0,0,1);
							 | 
						||
| 
								 | 
							
								  o.Normal = fixed3(0,0,1);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // call surface function
							 | 
						||
| 
								 | 
							
								  surf (surfIN, o);
							 | 
						||
| 
								 | 
							
								  UNITY_APPLY_DITHER_CROSSFADE(IN.pos.xy);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // compute lighting & shadowing factor
							 | 
						||
| 
								 | 
							
								  UNITY_LIGHT_ATTENUATION(atten, IN, worldPos)
							 | 
						||
| 
								 | 
							
								  fixed4 c = 0;
							 | 
						||
| 
								 | 
							
								  float3 worldN;
							 | 
						||
| 
								 | 
							
								  worldN.x = dot(_unity_tbn_0, o.Normal);
							 | 
						||
| 
								 | 
							
								  worldN.y = dot(_unity_tbn_1, o.Normal);
							 | 
						||
| 
								 | 
							
								  worldN.z = dot(_unity_tbn_2, o.Normal);
							 | 
						||
| 
								 | 
							
								  worldN = normalize(worldN);
							 | 
						||
| 
								 | 
							
								  o.Normal = worldN;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // Setup lighting environment
							 | 
						||
| 
								 | 
							
								  UnityGI gi;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(UnityGI, gi);
							 | 
						||
| 
								 | 
							
								  gi.indirect.diffuse = 0;
							 | 
						||
| 
								 | 
							
								  gi.indirect.specular = 0;
							 | 
						||
| 
								 | 
							
								  gi.light.color = _LightColor0.rgb;
							 | 
						||
| 
								 | 
							
								  gi.light.dir = lightDir;
							 | 
						||
| 
								 | 
							
								  // Call GI (lightmaps/SH/reflections) lighting function
							 | 
						||
| 
								 | 
							
								  UnityGIInput giInput;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput);
							 | 
						||
| 
								 | 
							
								  giInput.light = gi.light;
							 | 
						||
| 
								 | 
							
								  giInput.worldPos = worldPos;
							 | 
						||
| 
								 | 
							
								  giInput.atten = atten;
							 | 
						||
| 
								 | 
							
								  #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
							 | 
						||
| 
								 | 
							
								    giInput.lightmapUV = IN.lmap;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    giInput.lightmapUV = 0.0;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
							 | 
						||
| 
								 | 
							
								    giInput.ambient = IN.sh;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    giInput.ambient.rgb = 0.0;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  giInput.probeHDR[0] = unity_SpecCube0_HDR;
							 | 
						||
| 
								 | 
							
								  giInput.probeHDR[1] = unity_SpecCube1_HDR;
							 | 
						||
| 
								 | 
							
								  #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION)
							 | 
						||
| 
								 | 
							
								    giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef UNITY_SPECCUBE_BOX_PROJECTION
							 | 
						||
| 
								 | 
							
								    giInput.boxMax[0] = unity_SpecCube0_BoxMax;
							 | 
						||
| 
								 | 
							
								    giInput.probePosition[0] = unity_SpecCube0_ProbePosition;
							 | 
						||
| 
								 | 
							
								    giInput.boxMax[1] = unity_SpecCube1_BoxMax;
							 | 
						||
| 
								 | 
							
								    giInput.boxMin[1] = unity_SpecCube1_BoxMin;
							 | 
						||
| 
								 | 
							
								    giInput.probePosition[1] = unity_SpecCube1_ProbePosition;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  LightingLambert_GI(o, giInput, gi);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // realtime lighting: call lighting function
							 | 
						||
| 
								 | 
							
								  c += LightingLambert (o, gi);
							 | 
						||
| 
								 | 
							
								  UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog
							 | 
						||
| 
								 | 
							
								  UNITY_OPAQUE_ALPHA(c.a);
							 | 
						||
| 
								 | 
							
								  return c;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								ENDCG
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									// ---- forward rendering additive lights pass:
							 | 
						||
| 
								 | 
							
									Pass {
							 | 
						||
| 
								 | 
							
										Name "FORWARD"
							 | 
						||
| 
								 | 
							
										Tags { "LightMode" = "ForwardAdd" }
							 | 
						||
| 
								 | 
							
										ZWrite Off Blend One One
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								CGPROGRAM
							 | 
						||
| 
								 | 
							
								// compile directives
							 | 
						||
| 
								 | 
							
								#pragma vertex vert_surf
							 | 
						||
| 
								 | 
							
								#pragma fragment frag_surf
							 | 
						||
| 
								 | 
							
								#pragma target 3.0 LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								#pragma target 3.0
							 | 
						||
| 
								 | 
							
								#pragma instancing_options assumeuniformscaling maxcount:50
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_vertex LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_fragment __ LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_instancing
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_fog
							 | 
						||
| 
								 | 
							
								#pragma skip_variants INSTANCING_ON
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_fwdadd_fullshadows nodynlightmap nodirlightmap
							 | 
						||
| 
								 | 
							
								#include "HLSLSupport.cginc"
							 | 
						||
| 
								 | 
							
								#define UNITY_ASSUME_UNIFORM_SCALING
							 | 
						||
| 
								 | 
							
								#define UNITY_MAX_INSTANCE_COUNT 50
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LOD_FADE
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_SH
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LIGHTMAPSTS
							 | 
						||
| 
								 | 
							
								#include "UnityShaderVariables.cginc"
							 | 
						||
| 
								 | 
							
								#include "UnityShaderUtilities.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "UnityCG.cginc"
							 | 
						||
| 
								 | 
							
								#include "Lighting.cginc"
							 | 
						||
| 
								 | 
							
								#include "AutoLight.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#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) fixed3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local EFFECT_BUMP
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local EFFECT_HUE_VARIATION
							 | 
						||
| 
								 | 
							
								            #define ENABLE_WIND
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_ID_1
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
							 | 
						||
| 
								 | 
							
								#include "../../Core/CurvedWorldTransform.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #include "SpeedTreeCommon.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            void surf(Input IN, inout SurfaceOutput OUT)
							 | 
						||
| 
								 | 
							
								            {
							 | 
						||
| 
								 | 
							
								                SpeedTreeFragOut o;
							 | 
						||
| 
								 | 
							
								                SpeedTreeFrag(IN, o);
							 | 
						||
| 
								 | 
							
								                SPEEDTREE_COPY_FRAG(OUT, o)
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        
							 | 
						||
| 
								 | 
							
								             
							 | 
						||
| 
								 | 
							
								// vertex-to-fragment interpolation data
							 | 
						||
| 
								 | 
							
								struct v2f_surf {
							 | 
						||
| 
								 | 
							
								  UNITY_POSITION(pos);
							 | 
						||
| 
								 | 
							
								  float3 tSpace0 : TEXCOORD0;
							 | 
						||
| 
								 | 
							
								  float3 tSpace1 : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								  float3 tSpace2 : TEXCOORD2;
							 | 
						||
| 
								 | 
							
								  float3 worldPos : TEXCOORD3;
							 | 
						||
| 
								 | 
							
								  half4 custompack0 : TEXCOORD4; // color
							 | 
						||
| 
								 | 
							
								  half3 custompack1 : TEXCOORD5; // interpolator1
							 | 
						||
| 
								 | 
							
								  UNITY_LIGHTING_COORDS(6,7)
							 | 
						||
| 
								 | 
							
								  UNITY_FOG_COORDS(8)
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex shader
							 | 
						||
| 
								 | 
							
								v2f_surf vert_surf (SpeedTreeVB v) {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(v);
							 | 
						||
| 
								 | 
							
								  v2f_surf o;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(v2f_surf,o);
							 | 
						||
| 
								 | 
							
								  UNITY_TRANSFER_INSTANCE_ID(v,o);
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
							 | 
						||
| 
								 | 
							
								  Input customInputData;
							 | 
						||
| 
								 | 
							
								  SpeedTreeVert (v, customInputData);
							 | 
						||
| 
								 | 
							
								  o.custompack0.xyzw = customInputData.color;
							 | 
						||
| 
								 | 
							
								  o.custompack1.xyz = customInputData.interpolator1;
							 | 
						||
| 
								 | 
							
								  o.pos = UnityObjectToClipPos(v.vertex);
							 | 
						||
| 
								 | 
							
								  float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldNormal = UnityObjectToWorldNormal(v.normal);
							 | 
						||
| 
								 | 
							
								  fixed3 worldTangent = UnityObjectToWorldDir(v.tangent.xyz);
							 | 
						||
| 
								 | 
							
								  fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w;
							 | 
						||
| 
								 | 
							
								  fixed3 worldBinormal = cross(worldNormal, worldTangent) * tangentSign;
							 | 
						||
| 
								 | 
							
								  o.tSpace0 = float3(worldTangent.x, worldBinormal.x, worldNormal.x);
							 | 
						||
| 
								 | 
							
								  o.tSpace1 = float3(worldTangent.y, worldBinormal.y, worldNormal.y);
							 | 
						||
| 
								 | 
							
								  o.tSpace2 = float3(worldTangent.z, worldBinormal.z, worldNormal.z);
							 | 
						||
| 
								 | 
							
								  o.worldPos.xyz = worldPos;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  UNITY_TRANSFER_LIGHTING(o,v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader
							 | 
						||
| 
								 | 
							
								  UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader
							 | 
						||
| 
								 | 
							
								  return o;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// fragment shader
							 | 
						||
| 
								 | 
							
								fixed4 frag_surf (v2f_surf IN) : SV_Target {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(IN);
							 | 
						||
| 
								 | 
							
								  // prepare and unpack data
							 | 
						||
| 
								 | 
							
								  Input surfIN;
							 | 
						||
| 
								 | 
							
								  #ifdef FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_TSPACE(IN);
							 | 
						||
| 
								 | 
							
								  #elif defined (FOG_COMBINED_WITH_WORLD_POS)
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN);
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG(IN);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								    UNITY_RECONSTRUCT_TBN(IN);
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_TBN(IN);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(Input,surfIN);
							 | 
						||
| 
								 | 
							
								  surfIN.color.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.color = IN.custompack0.xyzw;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1 = IN.custompack1.xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldPos = IN.worldPos.xyz;
							 | 
						||
| 
								 | 
							
								  #ifndef USING_DIRECTIONAL_LIGHT
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = normalize(UnityWorldSpaceLightDir(worldPos));
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = _WorldSpaceLightPos0.xyz;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef UNITY_COMPILER_HLSL
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o = (SurfaceOutput)0;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  o.Albedo = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Emission = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Specular = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Alpha = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Gloss = 0.0;
							 | 
						||
| 
								 | 
							
								  fixed3 normalWorldVertex = fixed3(0,0,1);
							 | 
						||
| 
								 | 
							
								  o.Normal = fixed3(0,0,1);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // call surface function
							 | 
						||
| 
								 | 
							
								  surf (surfIN, o);
							 | 
						||
| 
								 | 
							
								  UNITY_APPLY_DITHER_CROSSFADE(IN.pos.xy);
							 | 
						||
| 
								 | 
							
								  UNITY_LIGHT_ATTENUATION(atten, IN, worldPos)
							 | 
						||
| 
								 | 
							
								  fixed4 c = 0;
							 | 
						||
| 
								 | 
							
								  float3 worldN;
							 | 
						||
| 
								 | 
							
								  worldN.x = dot(_unity_tbn_0, o.Normal);
							 | 
						||
| 
								 | 
							
								  worldN.y = dot(_unity_tbn_1, o.Normal);
							 | 
						||
| 
								 | 
							
								  worldN.z = dot(_unity_tbn_2, o.Normal);
							 | 
						||
| 
								 | 
							
								  worldN = normalize(worldN);
							 | 
						||
| 
								 | 
							
								  o.Normal = worldN;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // Setup lighting environment
							 | 
						||
| 
								 | 
							
								  UnityGI gi;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(UnityGI, gi);
							 | 
						||
| 
								 | 
							
								  gi.indirect.diffuse = 0;
							 | 
						||
| 
								 | 
							
								  gi.indirect.specular = 0;
							 | 
						||
| 
								 | 
							
								  gi.light.color = _LightColor0.rgb;
							 | 
						||
| 
								 | 
							
								  gi.light.dir = lightDir;
							 | 
						||
| 
								 | 
							
								  gi.light.color *= atten;
							 | 
						||
| 
								 | 
							
								  c += LightingLambert (o, gi);
							 | 
						||
| 
								 | 
							
								  c.a = 0.0;
							 | 
						||
| 
								 | 
							
								  UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog
							 | 
						||
| 
								 | 
							
								  UNITY_OPAQUE_ALPHA(c.a);
							 | 
						||
| 
								 | 
							
								  return c;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								ENDCG
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
									// ---- deferred shading pass:
							 | 
						||
| 
								 | 
							
									Pass {
							 | 
						||
| 
								 | 
							
										Name "DEFERRED"
							 | 
						||
| 
								 | 
							
										Tags { "LightMode" = "Deferred" }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								CGPROGRAM
							 | 
						||
| 
								 | 
							
								// compile directives
							 | 
						||
| 
								 | 
							
								#pragma vertex vert_surf
							 | 
						||
| 
								 | 
							
								#pragma fragment frag_surf
							 | 
						||
| 
								 | 
							
								#pragma target 3.0 LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								#pragma target 3.0
							 | 
						||
| 
								 | 
							
								#pragma instancing_options assumeuniformscaling maxcount:50
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_vertex LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_fragment __ LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_instancing
							 | 
						||
| 
								 | 
							
								#pragma exclude_renderers nomrt
							 | 
						||
| 
								 | 
							
								#pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_prepassfinal nodynlightmap nodirlightmap
							 | 
						||
| 
								 | 
							
								#include "HLSLSupport.cginc"
							 | 
						||
| 
								 | 
							
								#define UNITY_ASSUME_UNIFORM_SCALING
							 | 
						||
| 
								 | 
							
								#define UNITY_MAX_INSTANCE_COUNT 50
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LOD_FADE
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_SH
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LIGHTMAPSTS
							 | 
						||
| 
								 | 
							
								#include "UnityShaderVariables.cginc"
							 | 
						||
| 
								 | 
							
								#include "UnityShaderUtilities.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "UnityCG.cginc"
							 | 
						||
| 
								 | 
							
								#include "Lighting.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#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) fixed3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local EFFECT_BUMP
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local EFFECT_HUE_VARIATION
							 | 
						||
| 
								 | 
							
								            #define ENABLE_WIND
							 | 
						||
| 
								 | 
							
								             
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_ID_1
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
							 | 
						||
| 
								 | 
							
								#include "../../Core/CurvedWorldTransform.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #include "SpeedTreeCommon.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            void surf(Input IN, inout SurfaceOutput OUT)
							 | 
						||
| 
								 | 
							
								            {
							 | 
						||
| 
								 | 
							
								                SpeedTreeFragOut o;
							 | 
						||
| 
								 | 
							
								                SpeedTreeFrag(IN, o);
							 | 
						||
| 
								 | 
							
								                SPEEDTREE_COPY_FRAG(OUT, o)
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex-to-fragment interpolation data
							 | 
						||
| 
								 | 
							
								struct v2f_surf {
							 | 
						||
| 
								 | 
							
								  UNITY_POSITION(pos);
							 | 
						||
| 
								 | 
							
								  float4 tSpace0 : TEXCOORD0;
							 | 
						||
| 
								 | 
							
								  float4 tSpace1 : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								  float4 tSpace2 : TEXCOORD2;
							 | 
						||
| 
								 | 
							
								  half4 custompack0 : TEXCOORD3; // color
							 | 
						||
| 
								 | 
							
								  half3 custompack1 : TEXCOORD4; // interpolator1
							 | 
						||
| 
								 | 
							
								  float4 lmap : TEXCOORD5;
							 | 
						||
| 
								 | 
							
								#ifndef LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								  #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
							 | 
						||
| 
								 | 
							
								    half3 sh : TEXCOORD6; // SH
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								#else
							 | 
						||
| 
								 | 
							
								  #ifdef DIRLIGHTMAP_OFF
							 | 
						||
| 
								 | 
							
								    float4 lmapFadePos : TEXCOORD6;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex shader
							 | 
						||
| 
								 | 
							
								v2f_surf vert_surf (SpeedTreeVB v) {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(v);
							 | 
						||
| 
								 | 
							
								  v2f_surf o;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(v2f_surf,o);
							 | 
						||
| 
								 | 
							
								  UNITY_TRANSFER_INSTANCE_ID(v,o);
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
							 | 
						||
| 
								 | 
							
								  Input customInputData;
							 | 
						||
| 
								 | 
							
								  SpeedTreeVert (v, customInputData);
							 | 
						||
| 
								 | 
							
								  o.custompack0.xyzw = customInputData.color;
							 | 
						||
| 
								 | 
							
								  o.custompack1.xyz = customInputData.interpolator1;
							 | 
						||
| 
								 | 
							
								  o.pos = UnityObjectToClipPos(v.vertex);
							 | 
						||
| 
								 | 
							
								  float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldNormal = UnityObjectToWorldNormal(v.normal);
							 | 
						||
| 
								 | 
							
								  fixed3 worldTangent = UnityObjectToWorldDir(v.tangent.xyz);
							 | 
						||
| 
								 | 
							
								  fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w;
							 | 
						||
| 
								 | 
							
								  fixed3 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.lmap.zw = 0;
							 | 
						||
| 
								 | 
							
								#ifdef LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								  o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
							 | 
						||
| 
								 | 
							
								  #ifdef DIRLIGHTMAP_OFF
							 | 
						||
| 
								 | 
							
								    o.lmapFadePos.xyz = (mul(unity_ObjectToWorld, v.vertex).xyz - unity_ShadowFadeCenterAndType.xyz) * unity_ShadowFadeCenterAndType.w;
							 | 
						||
| 
								 | 
							
								    o.lmapFadePos.w = (-UnityObjectToViewPos(v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								#else
							 | 
						||
| 
								 | 
							
								  o.lmap.xy = 0;
							 | 
						||
| 
								 | 
							
								    #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
							 | 
						||
| 
								 | 
							
								      o.sh = 0;
							 | 
						||
| 
								 | 
							
								      o.sh = ShadeSHPerVertex (worldNormal, o.sh);
							 | 
						||
| 
								 | 
							
								    #endif
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								  return o;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#ifdef LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								float4 unity_LightmapFade;
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								fixed4 unity_Ambient;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// fragment shader
							 | 
						||
| 
								 | 
							
								void frag_surf (v2f_surf IN,
							 | 
						||
| 
								 | 
							
								    out half4 outGBuffer0 : SV_Target0,
							 | 
						||
| 
								 | 
							
								    out half4 outGBuffer1 : SV_Target1,
							 | 
						||
| 
								 | 
							
								    out half4 outGBuffer2 : SV_Target2,
							 | 
						||
| 
								 | 
							
								    out half4 outEmission : SV_Target3
							 | 
						||
| 
								 | 
							
								#if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4)
							 | 
						||
| 
								 | 
							
								    , out half4 outShadowMask : SV_Target4
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								) {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(IN);
							 | 
						||
| 
								 | 
							
								  // prepare and unpack data
							 | 
						||
| 
								 | 
							
								  Input surfIN;
							 | 
						||
| 
								 | 
							
								  #ifdef FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_TSPACE(IN);
							 | 
						||
| 
								 | 
							
								  #elif defined (FOG_COMBINED_WITH_WORLD_POS)
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN);
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG(IN);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								    UNITY_RECONSTRUCT_TBN(IN);
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_TBN(IN);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(Input,surfIN);
							 | 
						||
| 
								 | 
							
								  surfIN.color.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.color = IN.custompack0.xyzw;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1 = IN.custompack1.xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldPos = float3(IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w);
							 | 
						||
| 
								 | 
							
								  #ifndef USING_DIRECTIONAL_LIGHT
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = normalize(UnityWorldSpaceLightDir(worldPos));
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = _WorldSpaceLightPos0.xyz;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef UNITY_COMPILER_HLSL
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o = (SurfaceOutput)0;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  o.Albedo = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Emission = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Specular = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Alpha = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Gloss = 0.0;
							 | 
						||
| 
								 | 
							
								  fixed3 normalWorldVertex = fixed3(0,0,1);
							 | 
						||
| 
								 | 
							
								  o.Normal = fixed3(0,0,1);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // call surface function
							 | 
						||
| 
								 | 
							
								  surf (surfIN, o);
							 | 
						||
| 
								 | 
							
								  UNITY_APPLY_DITHER_CROSSFADE(IN.pos.xy);
							 | 
						||
| 
								 | 
							
								fixed3 originalNormal = o.Normal;
							 | 
						||
| 
								 | 
							
								  float3 worldN;
							 | 
						||
| 
								 | 
							
								  worldN.x = dot(_unity_tbn_0, o.Normal);
							 | 
						||
| 
								 | 
							
								  worldN.y = dot(_unity_tbn_1, o.Normal);
							 | 
						||
| 
								 | 
							
								  worldN.z = dot(_unity_tbn_2, o.Normal);
							 | 
						||
| 
								 | 
							
								  worldN = normalize(worldN);
							 | 
						||
| 
								 | 
							
								  o.Normal = worldN;
							 | 
						||
| 
								 | 
							
								  half atten = 1;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // Setup lighting environment
							 | 
						||
| 
								 | 
							
								  UnityGI gi;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(UnityGI, gi);
							 | 
						||
| 
								 | 
							
								  gi.indirect.diffuse = 0;
							 | 
						||
| 
								 | 
							
								  gi.indirect.specular = 0;
							 | 
						||
| 
								 | 
							
								  gi.light.color = 0;
							 | 
						||
| 
								 | 
							
								  gi.light.dir = half3(0,1,0);
							 | 
						||
| 
								 | 
							
								  // Call GI (lightmaps/SH/reflections) lighting function
							 | 
						||
| 
								 | 
							
								  UnityGIInput giInput;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput);
							 | 
						||
| 
								 | 
							
								  giInput.light = gi.light;
							 | 
						||
| 
								 | 
							
								  giInput.worldPos = worldPos;
							 | 
						||
| 
								 | 
							
								  giInput.atten = atten;
							 | 
						||
| 
								 | 
							
								  #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
							 | 
						||
| 
								 | 
							
								    giInput.lightmapUV = IN.lmap;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    giInput.lightmapUV = 0.0;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
							 | 
						||
| 
								 | 
							
								    giInput.ambient = IN.sh;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    giInput.ambient.rgb = 0.0;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  giInput.probeHDR[0] = unity_SpecCube0_HDR;
							 | 
						||
| 
								 | 
							
								  giInput.probeHDR[1] = unity_SpecCube1_HDR;
							 | 
						||
| 
								 | 
							
								  #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION)
							 | 
						||
| 
								 | 
							
								    giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef UNITY_SPECCUBE_BOX_PROJECTION
							 | 
						||
| 
								 | 
							
								    giInput.boxMax[0] = unity_SpecCube0_BoxMax;
							 | 
						||
| 
								 | 
							
								    giInput.probePosition[0] = unity_SpecCube0_ProbePosition;
							 | 
						||
| 
								 | 
							
								    giInput.boxMax[1] = unity_SpecCube1_BoxMax;
							 | 
						||
| 
								 | 
							
								    giInput.boxMin[1] = unity_SpecCube1_BoxMin;
							 | 
						||
| 
								 | 
							
								    giInput.probePosition[1] = unity_SpecCube1_ProbePosition;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  LightingLambert_GI(o, giInput, gi);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // call lighting function to output g-buffer
							 | 
						||
| 
								 | 
							
								  outEmission = LightingLambert_Deferred (o, gi, outGBuffer0, outGBuffer1, outGBuffer2);
							 | 
						||
| 
								 | 
							
								  #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4)
							 | 
						||
| 
								 | 
							
								    outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, worldPos);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifndef UNITY_HDR_ON
							 | 
						||
| 
								 | 
							
								  outEmission.rgb = exp2(-outEmission.rgb);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								ENDCG
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									// ---- meta information extraction pass:
							 | 
						||
| 
								 | 
							
									Pass {
							 | 
						||
| 
								 | 
							
										Name "Meta"
							 | 
						||
| 
								 | 
							
										Tags { "LightMode" = "Meta" }
							 | 
						||
| 
								 | 
							
										Cull Off
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								CGPROGRAM
							 | 
						||
| 
								 | 
							
								// compile directives
							 | 
						||
| 
								 | 
							
								#pragma vertex vert_surf
							 | 
						||
| 
								 | 
							
								#pragma fragment frag_surf
							 | 
						||
| 
								 | 
							
								#pragma target 3.0 LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								#pragma target 3.0
							 | 
						||
| 
								 | 
							
								#pragma instancing_options assumeuniformscaling maxcount:50
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_vertex LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_fragment __ LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_instancing
							 | 
						||
| 
								 | 
							
								#pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
							 | 
						||
| 
								 | 
							
								#pragma shader_feature EDITOR_VISUALIZATION
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "HLSLSupport.cginc"
							 | 
						||
| 
								 | 
							
								#define UNITY_ASSUME_UNIFORM_SCALING
							 | 
						||
| 
								 | 
							
								#define UNITY_MAX_INSTANCE_COUNT 50
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LOD_FADE
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_SH
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LIGHTMAPSTS
							 | 
						||
| 
								 | 
							
								#include "UnityShaderVariables.cginc"
							 | 
						||
| 
								 | 
							
								#include "UnityShaderUtilities.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "UnityCG.cginc"
							 | 
						||
| 
								 | 
							
								#include "Lighting.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#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) fixed3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local EFFECT_BUMP
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local EFFECT_HUE_VARIATION
							 | 
						||
| 
								 | 
							
								            #define ENABLE_WIND
							 | 
						||
| 
								 | 
							
								            #include "SpeedTreeCommon.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            void surf(Input IN, inout SurfaceOutput OUT)
							 | 
						||
| 
								 | 
							
								            {
							 | 
						||
| 
								 | 
							
								                SpeedTreeFragOut o;
							 | 
						||
| 
								 | 
							
								                SpeedTreeFrag(IN, o);
							 | 
						||
| 
								 | 
							
								                SPEEDTREE_COPY_FRAG(OUT, o)
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        
							 | 
						||
| 
								 | 
							
								#include "UnityMetaPass.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex-to-fragment interpolation data
							 | 
						||
| 
								 | 
							
								struct v2f_surf {
							 | 
						||
| 
								 | 
							
								  UNITY_POSITION(pos);
							 | 
						||
| 
								 | 
							
								  float4 tSpace0 : TEXCOORD0;
							 | 
						||
| 
								 | 
							
								  float4 tSpace1 : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								  float4 tSpace2 : TEXCOORD2;
							 | 
						||
| 
								 | 
							
								  half4 custompack0 : TEXCOORD3; // color
							 | 
						||
| 
								 | 
							
								  half3 custompack1 : TEXCOORD4; // interpolator1
							 | 
						||
| 
								 | 
							
								#ifdef EDITOR_VISUALIZATION
							 | 
						||
| 
								 | 
							
								  float2 vizUV : TEXCOORD5;
							 | 
						||
| 
								 | 
							
								  float4 lightCoord : TEXCOORD6;
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex shader
							 | 
						||
| 
								 | 
							
								v2f_surf vert_surf (SpeedTreeVB v) {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(v);
							 | 
						||
| 
								 | 
							
								  v2f_surf o;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(v2f_surf,o);
							 | 
						||
| 
								 | 
							
								  UNITY_TRANSFER_INSTANCE_ID(v,o);
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
							 | 
						||
| 
								 | 
							
								  Input customInputData;
							 | 
						||
| 
								 | 
							
								  SpeedTreeVert (v, customInputData);
							 | 
						||
| 
								 | 
							
								  o.custompack0.xyzw = customInputData.color;
							 | 
						||
| 
								 | 
							
								  o.custompack1.xyz = customInputData.interpolator1;
							 | 
						||
| 
								 | 
							
								  o.pos = UnityMetaVertexPosition(v.vertex, v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST);
							 | 
						||
| 
								 | 
							
								#ifdef EDITOR_VISUALIZATION
							 | 
						||
| 
								 | 
							
								  o.vizUV = 0;
							 | 
						||
| 
								 | 
							
								  o.lightCoord = 0;
							 | 
						||
| 
								 | 
							
								  if (unity_VisualizationMode == EDITORVIZ_TEXTURE)
							 | 
						||
| 
								 | 
							
								    o.vizUV = UnityMetaVizUV(unity_EditorViz_UVIndex, v.texcoord.xy, v.texcoord1.xy, v.texcoord2.xy, unity_EditorViz_Texture_ST);
							 | 
						||
| 
								 | 
							
								  else if (unity_VisualizationMode == EDITORVIZ_SHOWLIGHTMASK)
							 | 
						||
| 
								 | 
							
								  {
							 | 
						||
| 
								 | 
							
								    o.vizUV = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
							 | 
						||
| 
								 | 
							
								    o.lightCoord = mul(unity_EditorViz_WorldToLight, mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1)));
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								  float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldNormal = UnityObjectToWorldNormal(v.normal);
							 | 
						||
| 
								 | 
							
								  fixed3 worldTangent = UnityObjectToWorldDir(v.tangent.xyz);
							 | 
						||
| 
								 | 
							
								  fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w;
							 | 
						||
| 
								 | 
							
								  fixed3 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);
							 | 
						||
| 
								 | 
							
								  return o;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// fragment shader
							 | 
						||
| 
								 | 
							
								fixed4 frag_surf (v2f_surf IN) : SV_Target {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(IN);
							 | 
						||
| 
								 | 
							
								  // prepare and unpack data
							 | 
						||
| 
								 | 
							
								  Input surfIN;
							 | 
						||
| 
								 | 
							
								  #ifdef FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_TSPACE(IN);
							 | 
						||
| 
								 | 
							
								  #elif defined (FOG_COMBINED_WITH_WORLD_POS)
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN);
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG(IN);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								    UNITY_RECONSTRUCT_TBN(IN);
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_TBN(IN);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(Input,surfIN);
							 | 
						||
| 
								 | 
							
								  surfIN.color.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.color = IN.custompack0.xyzw;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1 = IN.custompack1.xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldPos = float3(IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w);
							 | 
						||
| 
								 | 
							
								  #ifndef USING_DIRECTIONAL_LIGHT
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = normalize(UnityWorldSpaceLightDir(worldPos));
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = _WorldSpaceLightPos0.xyz;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef UNITY_COMPILER_HLSL
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o = (SurfaceOutput)0;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  o.Albedo = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Emission = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Specular = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Alpha = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Gloss = 0.0;
							 | 
						||
| 
								 | 
							
								  fixed3 normalWorldVertex = fixed3(0,0,1);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // call surface function
							 | 
						||
| 
								 | 
							
								  surf (surfIN, o);
							 | 
						||
| 
								 | 
							
								  UNITY_APPLY_DITHER_CROSSFADE(IN.pos.xy);
							 | 
						||
| 
								 | 
							
								  UnityMetaInput metaIN;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(UnityMetaInput, metaIN);
							 | 
						||
| 
								 | 
							
								  metaIN.Albedo = o.Albedo;
							 | 
						||
| 
								 | 
							
								  metaIN.Emission = o.Emission;
							 | 
						||
| 
								 | 
							
								  metaIN.SpecularColor = o.Specular;
							 | 
						||
| 
								 | 
							
								#ifdef EDITOR_VISUALIZATION
							 | 
						||
| 
								 | 
							
								  metaIN.VizUV = IN.vizUV;
							 | 
						||
| 
								 | 
							
								  metaIN.LightCoord = IN.lightCoord;
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								  return UnityMetaFragment(metaIN);
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								ENDCG
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        Pass
							 | 
						||
| 
								 | 
							
								        {
							 | 
						||
| 
								 | 
							
								            Tags { "LightMode" = "ShadowCaster" }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            CGPROGRAM
							 | 
						||
| 
								 | 
							
								#include "HLSLSupport.cginc"
							 | 
						||
| 
								 | 
							
								#define UNITY_ASSUME_UNIFORM_SCALING
							 | 
						||
| 
								 | 
							
								#define UNITY_MAX_INSTANCE_COUNT 50
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LOD_FADE
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_SH
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LIGHTMAPSTS
							 | 
						||
| 
								 | 
							
								#include "UnityShaderVariables.cginc"
							 | 
						||
| 
								 | 
							
								#include "UnityShaderUtilities.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                #pragma vertex vert
							 | 
						||
| 
								 | 
							
								                #pragma fragment frag
							 | 
						||
| 
								 | 
							
								                #pragma target 3.0
							 | 
						||
| 
								 | 
							
								                #pragma instancing_options assumeuniformscaling maxcount:50
							 | 
						||
| 
								 | 
							
								                #pragma multi_compile_vertex LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								                #pragma multi_compile_fragment __ LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								                #pragma multi_compile_instancing
							 | 
						||
| 
								 | 
							
								                #pragma shader_feature_local GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH
							 | 
						||
| 
								 | 
							
								                #pragma multi_compile_shadowcaster
							 | 
						||
| 
								 | 
							
								                #define ENABLE_WIND
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_ID_1
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
							 | 
						||
| 
								 | 
							
								#include "../../Core/CurvedWorldTransform.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                #include "SpeedTreeCommon.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                struct v2f
							 | 
						||
| 
								 | 
							
								                {
							 | 
						||
| 
								 | 
							
								                    V2F_SHADOW_CASTER;
							 | 
						||
| 
								 | 
							
								                    #ifdef SPEEDTREE_ALPHATEST
							 | 
						||
| 
								 | 
							
								                        float2 uv : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								                    #endif
							 | 
						||
| 
								 | 
							
								                    UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								                    UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								                };
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                v2f vert(SpeedTreeVB v)
							 | 
						||
| 
								 | 
							
								                {
							 | 
						||
| 
								 | 
							
								                    v2f o;
							 | 
						||
| 
								 | 
							
								                    UNITY_SETUP_INSTANCE_ID(v);
							 | 
						||
| 
								 | 
							
								                    UNITY_TRANSFER_INSTANCE_ID(v, o);
							 | 
						||
| 
								 | 
							
								                    UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                    #ifdef SPEEDTREE_ALPHATEST
							 | 
						||
| 
								 | 
							
								                        o.uv = v.texcoord.xy;
							 | 
						||
| 
								 | 
							
								                    #endif
							 | 
						||
| 
								 | 
							
								                    OffsetSpeedTreeVertex(v, unity_LODFade.x);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#if defined(CURVEDWORLD_IS_INSTALLED) && !defined(CURVEDWORLD_DISABLED_ON)
							 | 
						||
| 
								 | 
							
								   CURVEDWORLD_TRANSFORM_VERTEX(v.vertex)
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                    TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                    return o;
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                float4 frag(v2f i) : SV_Target
							 | 
						||
| 
								 | 
							
								                {
							 | 
						||
| 
								 | 
							
								                    UNITY_SETUP_INSTANCE_ID(i);
							 | 
						||
| 
								 | 
							
								                    #ifdef SPEEDTREE_ALPHATEST
							 | 
						||
| 
								 | 
							
								                        clip(tex2D(_MainTex, i.uv).a * _Color.a - _Cutoff);
							 | 
						||
| 
								 | 
							
								                    #endif
							 | 
						||
| 
								 | 
							
								                    UNITY_APPLY_DITHER_CROSSFADE(i.pos.xy);
							 | 
						||
| 
								 | 
							
								                    SHADOW_CASTER_FRAGMENT(i)
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								            ENDCG
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#LINE 118
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        Pass
							 | 
						||
| 
								 | 
							
								        {
							 | 
						||
| 
								 | 
							
								            Tags { "LightMode" = "Vertex" }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            CGPROGRAM
							 | 
						||
| 
								 | 
							
								#include "HLSLSupport.cginc"
							 | 
						||
| 
								 | 
							
								#define UNITY_ASSUME_UNIFORM_SCALING
							 | 
						||
| 
								 | 
							
								#define UNITY_MAX_INSTANCE_COUNT 50
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LOD_FADE
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_SH
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LIGHTMAPSTS
							 | 
						||
| 
								 | 
							
								#include "UnityShaderVariables.cginc"
							 | 
						||
| 
								 | 
							
								#include "UnityShaderUtilities.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                #pragma vertex vert
							 | 
						||
| 
								 | 
							
								                #pragma fragment frag
							 | 
						||
| 
								 | 
							
								                #pragma target 3.0
							 | 
						||
| 
								 | 
							
								                #pragma instancing_options assumeuniformscaling maxcount:50
							 | 
						||
| 
								 | 
							
								                #pragma multi_compile_fog
							 | 
						||
| 
								 | 
							
								                #pragma multi_compile_vertex LOD_FADE_PERCENTAGE LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								                #pragma multi_compile_fragment __ LOD_FADE_CROSSFADE
							 | 
						||
| 
								 | 
							
								                #pragma multi_compile_instancing
							 | 
						||
| 
								 | 
							
								                #pragma shader_feature_local GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH
							 | 
						||
| 
								 | 
							
								                #pragma shader_feature_local EFFECT_HUE_VARIATION
							 | 
						||
| 
								 | 
							
								                #define ENABLE_WIND
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_ID_1
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
							 | 
						||
| 
								 | 
							
								#include "../../Core/CurvedWorldTransform.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                #include "SpeedTreeCommon.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                struct v2f
							 | 
						||
| 
								 | 
							
								                {
							 | 
						||
| 
								 | 
							
								                    UNITY_POSITION(vertex);
							 | 
						||
| 
								 | 
							
								                    UNITY_FOG_COORDS(0)
							 | 
						||
| 
								 | 
							
								                    Input data      : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								                    UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								                    UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								                };
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                v2f vert(SpeedTreeVB v)
							 | 
						||
| 
								 | 
							
								                {
							 | 
						||
| 
								 | 
							
								                    v2f o;
							 | 
						||
| 
								 | 
							
								                    UNITY_SETUP_INSTANCE_ID(v);
							 | 
						||
| 
								 | 
							
								                    UNITY_TRANSFER_INSTANCE_ID(v, o);
							 | 
						||
| 
								 | 
							
								                    UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
							 | 
						||
| 
								 | 
							
								                    SpeedTreeVert(v, o.data);
							 | 
						||
| 
								 | 
							
								                    o.data.color.rgb *= ShadeVertexLightsFull(v.vertex, v.normal, 4, true);
							 | 
						||
| 
								 | 
							
								                    o.vertex = UnityObjectToClipPos(v.vertex);
							 | 
						||
| 
								 | 
							
								                    UNITY_TRANSFER_FOG(o,o.vertex);
							 | 
						||
| 
								 | 
							
								                    return o;
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                fixed4 frag(v2f i) : SV_Target
							 | 
						||
| 
								 | 
							
								                {
							 | 
						||
| 
								 | 
							
								                    UNITY_SETUP_INSTANCE_ID(i);
							 | 
						||
| 
								 | 
							
								                    SpeedTreeFragOut o;
							 | 
						||
| 
								 | 
							
								                    SpeedTreeFrag(i.data, o);
							 | 
						||
| 
								 | 
							
								                    UNITY_APPLY_DITHER_CROSSFADE(i.vertex.xy);
							 | 
						||
| 
								 | 
							
								                    fixed4 c = fixed4(o.Albedo, o.Alpha);
							 | 
						||
| 
								 | 
							
								                    UNITY_APPLY_FOG(i.fogCoord, c);
							 | 
						||
| 
								 | 
							
								                    return c;
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								            ENDCG
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        }		
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    // targeting SM2.0: Normal-mapping, Hue variation and Wind animation are turned off for less instructions
							 | 
						||
| 
								 | 
							
								    SubShader
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        Tags
							 | 
						||
| 
								 | 
							
								        {
							 | 
						||
| 
								 | 
							
								            "Queue"="Geometry"
							 | 
						||
| 
								 | 
							
								            "IgnoreProjector"="True"
							 | 
						||
| 
								 | 
							
								            "RenderType"="TransparentCutout"
							 | 
						||
| 
								 | 
							
								            "DisableBatching"="LODFading"
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        LOD 400
							 | 
						||
| 
								 | 
							
								        Cull [_Cull]
							 | 
						||
| 
								 | 
							
								         
							 | 
						||
| 
								 | 
							
								        
							 | 
						||
| 
								 | 
							
									// ------------------------------------------------------------
							 | 
						||
| 
								 | 
							
									// Surface shader code generated out of a CGPROGRAM block:
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									// ---- forward rendering base pass:
							 | 
						||
| 
								 | 
							
									Pass {
							 | 
						||
| 
								 | 
							
										Name "FORWARD"
							 | 
						||
| 
								 | 
							
										Tags { "LightMode" = "ForwardBase" }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								CGPROGRAM
							 | 
						||
| 
								 | 
							
								// compile directives
							 | 
						||
| 
								 | 
							
								#pragma vertex vert_surf
							 | 
						||
| 
								 | 
							
								#pragma fragment frag_surf
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_vertex LOD_FADE_PERCENTAGE
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_fog
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_fwdbase nodynlightmap nodirlightmap
							 | 
						||
| 
								 | 
							
								#include "HLSLSupport.cginc"
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LOD_FADE
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_SH
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LIGHTMAPSTS
							 | 
						||
| 
								 | 
							
								#include "UnityShaderVariables.cginc"
							 | 
						||
| 
								 | 
							
								#include "UnityShaderUtilities.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "UnityCG.cginc"
							 | 
						||
| 
								 | 
							
								#include "Lighting.cginc"
							 | 
						||
| 
								 | 
							
								#include "AutoLight.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define INTERNAL_DATA
							 | 
						||
| 
								 | 
							
								#define WorldReflectionVector(data,normal) data.worldRefl
							 | 
						||
| 
								 | 
							
								#define WorldNormalVector(data,normal) normal
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_ID_1
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
							 | 
						||
| 
								 | 
							
								#include "../../Core/CurvedWorldTransform.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #include "SpeedTreeCommon.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            void surf(Input IN, inout SurfaceOutput OUT)
							 | 
						||
| 
								 | 
							
								            {
							 | 
						||
| 
								 | 
							
								                SpeedTreeFragOut o;
							 | 
						||
| 
								 | 
							
								                SpeedTreeFrag(IN, o);
							 | 
						||
| 
								 | 
							
								                SPEEDTREE_COPY_FRAG(OUT, o)
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex-to-fragment interpolation data
							 | 
						||
| 
								 | 
							
								// no lightmaps:
							 | 
						||
| 
								 | 
							
								#ifndef LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								// half-precision fragment shader registers:
							 | 
						||
| 
								 | 
							
								#ifdef UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS
							 | 
						||
| 
								 | 
							
								#define FOG_COMBINED_WITH_WORLD_POS
							 | 
						||
| 
								 | 
							
								struct v2f_surf {
							 | 
						||
| 
								 | 
							
								  UNITY_POSITION(pos);
							 | 
						||
| 
								 | 
							
								  float3 worldNormal : TEXCOORD0;
							 | 
						||
| 
								 | 
							
								  float4 worldPos : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								  half4 custompack0 : TEXCOORD2; // color
							 | 
						||
| 
								 | 
							
								  half3 custompack1 : TEXCOORD3; // interpolator1
							 | 
						||
| 
								 | 
							
								  #if UNITY_SHOULD_SAMPLE_SH
							 | 
						||
| 
								 | 
							
								  half3 sh : TEXCOORD4; // SH
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  UNITY_LIGHTING_COORDS(5,6)
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								// high-precision fragment shader registers:
							 | 
						||
| 
								 | 
							
								#ifndef UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS
							 | 
						||
| 
								 | 
							
								struct v2f_surf {
							 | 
						||
| 
								 | 
							
								  UNITY_POSITION(pos);
							 | 
						||
| 
								 | 
							
								  float3 worldNormal : TEXCOORD0;
							 | 
						||
| 
								 | 
							
								  float3 worldPos : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								  half4 custompack0 : TEXCOORD2; // color
							 | 
						||
| 
								 | 
							
								  half3 custompack1 : TEXCOORD3; // interpolator1
							 | 
						||
| 
								 | 
							
								  #if UNITY_SHOULD_SAMPLE_SH
							 | 
						||
| 
								 | 
							
								  half3 sh : TEXCOORD4; // SH
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  UNITY_FOG_COORDS(5)
							 | 
						||
| 
								 | 
							
								  UNITY_SHADOW_COORDS(6)
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								// with lightmaps:
							 | 
						||
| 
								 | 
							
								#ifdef LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								// half-precision fragment shader registers:
							 | 
						||
| 
								 | 
							
								#ifdef UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS
							 | 
						||
| 
								 | 
							
								#define FOG_COMBINED_WITH_WORLD_POS
							 | 
						||
| 
								 | 
							
								struct v2f_surf {
							 | 
						||
| 
								 | 
							
								  UNITY_POSITION(pos);
							 | 
						||
| 
								 | 
							
								  float3 worldNormal : TEXCOORD0;
							 | 
						||
| 
								 | 
							
								  float4 worldPos : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								  half4 custompack0 : TEXCOORD2; // color
							 | 
						||
| 
								 | 
							
								  half3 custompack1 : TEXCOORD3; // interpolator1
							 | 
						||
| 
								 | 
							
								  float4 lmap : TEXCOORD4;
							 | 
						||
| 
								 | 
							
								  UNITY_LIGHTING_COORDS(5,6)
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								// high-precision fragment shader registers:
							 | 
						||
| 
								 | 
							
								#ifndef UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS
							 | 
						||
| 
								 | 
							
								struct v2f_surf {
							 | 
						||
| 
								 | 
							
								  UNITY_POSITION(pos);
							 | 
						||
| 
								 | 
							
								  float3 worldNormal : TEXCOORD0;
							 | 
						||
| 
								 | 
							
								  float3 worldPos : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								  half4 custompack0 : TEXCOORD2; // color
							 | 
						||
| 
								 | 
							
								  half3 custompack1 : TEXCOORD3; // interpolator1
							 | 
						||
| 
								 | 
							
								  float4 lmap : TEXCOORD4;
							 | 
						||
| 
								 | 
							
								  UNITY_FOG_COORDS(5)
							 | 
						||
| 
								 | 
							
								  UNITY_SHADOW_COORDS(6)
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex shader
							 | 
						||
| 
								 | 
							
								v2f_surf vert_surf (SpeedTreeVB v) {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(v);
							 | 
						||
| 
								 | 
							
								  v2f_surf o;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(v2f_surf,o);
							 | 
						||
| 
								 | 
							
								  UNITY_TRANSFER_INSTANCE_ID(v,o);
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
							 | 
						||
| 
								 | 
							
								  Input customInputData;
							 | 
						||
| 
								 | 
							
								  SpeedTreeVert (v, customInputData);
							 | 
						||
| 
								 | 
							
								  o.custompack0.xyzw = customInputData.color;
							 | 
						||
| 
								 | 
							
								  o.custompack1.xyz = customInputData.interpolator1;
							 | 
						||
| 
								 | 
							
								  o.pos = UnityObjectToClipPos(v.vertex);
							 | 
						||
| 
								 | 
							
								  float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldNormal = UnityObjectToWorldNormal(v.normal);
							 | 
						||
| 
								 | 
							
								  #if defined(LIGHTMAP_ON) && defined(DIRLIGHTMAP_COMBINED)
							 | 
						||
| 
								 | 
							
								  fixed3 worldTangent = UnityObjectToWorldDir(v.tangent.xyz);
							 | 
						||
| 
								 | 
							
								  fixed tangentSign = v.tangent.w * unity_WorldTransformParams.w;
							 | 
						||
| 
								 | 
							
								  fixed3 worldBinormal = cross(worldNormal, worldTangent) * tangentSign;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #if defined(LIGHTMAP_ON) && defined(DIRLIGHTMAP_COMBINED) && !defined(UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS)
							 | 
						||
| 
								 | 
							
								  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);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  o.worldPos.xyz = worldPos;
							 | 
						||
| 
								 | 
							
								  o.worldNormal = worldNormal;
							 | 
						||
| 
								 | 
							
								  #ifdef LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								  o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // SH/ambient and vertex lights
							 | 
						||
| 
								 | 
							
								  #ifndef LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								    #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
							 | 
						||
| 
								 | 
							
								      o.sh = 0;
							 | 
						||
| 
								 | 
							
								      // Approximated illumination from non-important point lights
							 | 
						||
| 
								 | 
							
								      #ifdef VERTEXLIGHT_ON
							 | 
						||
| 
								 | 
							
								        o.sh += Shade4PointLights (
							 | 
						||
| 
								 | 
							
								          unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0,
							 | 
						||
| 
								 | 
							
								          unity_LightColor[0].rgb, unity_LightColor[1].rgb, unity_LightColor[2].rgb, unity_LightColor[3].rgb,
							 | 
						||
| 
								 | 
							
								          unity_4LightAtten0, worldPos, worldNormal);
							 | 
						||
| 
								 | 
							
								      #endif
							 | 
						||
| 
								 | 
							
								      o.sh = ShadeSHPerVertex (worldNormal, o.sh);
							 | 
						||
| 
								 | 
							
								    #endif
							 | 
						||
| 
								 | 
							
								  #endif // !LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  UNITY_TRANSFER_LIGHTING(o,v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader
							 | 
						||
| 
								 | 
							
								  #ifdef FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								    UNITY_TRANSFER_FOG_COMBINED_WITH_TSPACE(o,o.pos); // pass fog coordinates to pixel shader
							 | 
						||
| 
								 | 
							
								  #elif defined (FOG_COMBINED_WITH_WORLD_POS)
							 | 
						||
| 
								 | 
							
								    UNITY_TRANSFER_FOG_COMBINED_WITH_WORLD_POS(o,o.pos); // pass fog coordinates to pixel shader
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  return o;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// fragment shader
							 | 
						||
| 
								 | 
							
								fixed4 frag_surf (v2f_surf IN) : SV_Target {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(IN);
							 | 
						||
| 
								 | 
							
								  // prepare and unpack data
							 | 
						||
| 
								 | 
							
								  Input surfIN;
							 | 
						||
| 
								 | 
							
								  #ifdef FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_TSPACE(IN);
							 | 
						||
| 
								 | 
							
								  #elif defined (FOG_COMBINED_WITH_WORLD_POS)
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN);
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG(IN);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(Input,surfIN);
							 | 
						||
| 
								 | 
							
								  surfIN.color.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.color = IN.custompack0.xyzw;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1 = IN.custompack1.xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldPos = IN.worldPos.xyz;
							 | 
						||
| 
								 | 
							
								  #ifndef USING_DIRECTIONAL_LIGHT
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = normalize(UnityWorldSpaceLightDir(worldPos));
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = _WorldSpaceLightPos0.xyz;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef UNITY_COMPILER_HLSL
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o = (SurfaceOutput)0;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  o.Albedo = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Emission = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Specular = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Alpha = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Gloss = 0.0;
							 | 
						||
| 
								 | 
							
								  fixed3 normalWorldVertex = fixed3(0,0,1);
							 | 
						||
| 
								 | 
							
								  o.Normal = IN.worldNormal;
							 | 
						||
| 
								 | 
							
								  normalWorldVertex = IN.worldNormal;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // call surface function
							 | 
						||
| 
								 | 
							
								  surf (surfIN, o);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // compute lighting & shadowing factor
							 | 
						||
| 
								 | 
							
								  UNITY_LIGHT_ATTENUATION(atten, IN, worldPos)
							 | 
						||
| 
								 | 
							
								  fixed4 c = 0;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // Setup lighting environment
							 | 
						||
| 
								 | 
							
								  UnityGI gi;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(UnityGI, gi);
							 | 
						||
| 
								 | 
							
								  gi.indirect.diffuse = 0;
							 | 
						||
| 
								 | 
							
								  gi.indirect.specular = 0;
							 | 
						||
| 
								 | 
							
								  gi.light.color = _LightColor0.rgb;
							 | 
						||
| 
								 | 
							
								  gi.light.dir = lightDir;
							 | 
						||
| 
								 | 
							
								  // Call GI (lightmaps/SH/reflections) lighting function
							 | 
						||
| 
								 | 
							
								  UnityGIInput giInput;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput);
							 | 
						||
| 
								 | 
							
								  giInput.light = gi.light;
							 | 
						||
| 
								 | 
							
								  giInput.worldPos = worldPos;
							 | 
						||
| 
								 | 
							
								  giInput.atten = atten;
							 | 
						||
| 
								 | 
							
								  #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
							 | 
						||
| 
								 | 
							
								    giInput.lightmapUV = IN.lmap;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    giInput.lightmapUV = 0.0;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
							 | 
						||
| 
								 | 
							
								    giInput.ambient = IN.sh;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    giInput.ambient.rgb = 0.0;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  giInput.probeHDR[0] = unity_SpecCube0_HDR;
							 | 
						||
| 
								 | 
							
								  giInput.probeHDR[1] = unity_SpecCube1_HDR;
							 | 
						||
| 
								 | 
							
								  #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION)
							 | 
						||
| 
								 | 
							
								    giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef UNITY_SPECCUBE_BOX_PROJECTION
							 | 
						||
| 
								 | 
							
								    giInput.boxMax[0] = unity_SpecCube0_BoxMax;
							 | 
						||
| 
								 | 
							
								    giInput.probePosition[0] = unity_SpecCube0_ProbePosition;
							 | 
						||
| 
								 | 
							
								    giInput.boxMax[1] = unity_SpecCube1_BoxMax;
							 | 
						||
| 
								 | 
							
								    giInput.boxMin[1] = unity_SpecCube1_BoxMin;
							 | 
						||
| 
								 | 
							
								    giInput.probePosition[1] = unity_SpecCube1_ProbePosition;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  LightingLambert_GI(o, giInput, gi);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // realtime lighting: call lighting function
							 | 
						||
| 
								 | 
							
								  c += LightingLambert (o, gi);
							 | 
						||
| 
								 | 
							
								  UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog
							 | 
						||
| 
								 | 
							
								  UNITY_OPAQUE_ALPHA(c.a);
							 | 
						||
| 
								 | 
							
								  return c;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								ENDCG
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									// ---- forward rendering additive lights pass:
							 | 
						||
| 
								 | 
							
									Pass {
							 | 
						||
| 
								 | 
							
										Name "FORWARD"
							 | 
						||
| 
								 | 
							
										Tags { "LightMode" = "ForwardAdd" }
							 | 
						||
| 
								 | 
							
										ZWrite Off Blend One One
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								CGPROGRAM
							 | 
						||
| 
								 | 
							
								// compile directives
							 | 
						||
| 
								 | 
							
								#pragma vertex vert_surf
							 | 
						||
| 
								 | 
							
								#pragma fragment frag_surf
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_vertex LOD_FADE_PERCENTAGE
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_fog
							 | 
						||
| 
								 | 
							
								#pragma skip_variants INSTANCING_ON
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_fwdadd_fullshadows nodynlightmap nodirlightmap
							 | 
						||
| 
								 | 
							
								#include "HLSLSupport.cginc"
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LOD_FADE
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_SH
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LIGHTMAPSTS
							 | 
						||
| 
								 | 
							
								#include "UnityShaderVariables.cginc"
							 | 
						||
| 
								 | 
							
								#include "UnityShaderUtilities.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "UnityCG.cginc"
							 | 
						||
| 
								 | 
							
								#include "Lighting.cginc"
							 | 
						||
| 
								 | 
							
								#include "AutoLight.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define INTERNAL_DATA
							 | 
						||
| 
								 | 
							
								#define WorldReflectionVector(data,normal) data.worldRefl
							 | 
						||
| 
								 | 
							
								#define WorldNormalVector(data,normal) normal
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_ID_1
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
							 | 
						||
| 
								 | 
							
								#include "../../Core/CurvedWorldTransform.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #include "SpeedTreeCommon.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            void surf(Input IN, inout SurfaceOutput OUT)
							 | 
						||
| 
								 | 
							
								            {
							 | 
						||
| 
								 | 
							
								                SpeedTreeFragOut o;
							 | 
						||
| 
								 | 
							
								                SpeedTreeFrag(IN, o);
							 | 
						||
| 
								 | 
							
								                SPEEDTREE_COPY_FRAG(OUT, o)
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex-to-fragment interpolation data
							 | 
						||
| 
								 | 
							
								struct v2f_surf {
							 | 
						||
| 
								 | 
							
								  UNITY_POSITION(pos);
							 | 
						||
| 
								 | 
							
								  float3 worldNormal : TEXCOORD0;
							 | 
						||
| 
								 | 
							
								  float3 worldPos : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								  half4 custompack0 : TEXCOORD2; // color
							 | 
						||
| 
								 | 
							
								  half3 custompack1 : TEXCOORD3; // interpolator1
							 | 
						||
| 
								 | 
							
								  UNITY_LIGHTING_COORDS(4,5)
							 | 
						||
| 
								 | 
							
								  UNITY_FOG_COORDS(6)
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex shader
							 | 
						||
| 
								 | 
							
								v2f_surf vert_surf (SpeedTreeVB v) {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(v);
							 | 
						||
| 
								 | 
							
								  v2f_surf o;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(v2f_surf,o);
							 | 
						||
| 
								 | 
							
								  UNITY_TRANSFER_INSTANCE_ID(v,o);
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
							 | 
						||
| 
								 | 
							
								  Input customInputData;
							 | 
						||
| 
								 | 
							
								  SpeedTreeVert (v, customInputData);
							 | 
						||
| 
								 | 
							
								  o.custompack0.xyzw = customInputData.color;
							 | 
						||
| 
								 | 
							
								  o.custompack1.xyz = customInputData.interpolator1;
							 | 
						||
| 
								 | 
							
								  o.pos = UnityObjectToClipPos(v.vertex);
							 | 
						||
| 
								 | 
							
								  float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldNormal = UnityObjectToWorldNormal(v.normal);
							 | 
						||
| 
								 | 
							
								  o.worldPos.xyz = worldPos;
							 | 
						||
| 
								 | 
							
								  o.worldNormal = worldNormal;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  UNITY_TRANSFER_LIGHTING(o,v.texcoord1.xy); // pass shadow and, possibly, light cookie coordinates to pixel shader
							 | 
						||
| 
								 | 
							
								  UNITY_TRANSFER_FOG(o,o.pos); // pass fog coordinates to pixel shader
							 | 
						||
| 
								 | 
							
								  return o;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// fragment shader
							 | 
						||
| 
								 | 
							
								fixed4 frag_surf (v2f_surf IN) : SV_Target {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(IN);
							 | 
						||
| 
								 | 
							
								  // prepare and unpack data
							 | 
						||
| 
								 | 
							
								  Input surfIN;
							 | 
						||
| 
								 | 
							
								  #ifdef FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_TSPACE(IN);
							 | 
						||
| 
								 | 
							
								  #elif defined (FOG_COMBINED_WITH_WORLD_POS)
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN);
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG(IN);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(Input,surfIN);
							 | 
						||
| 
								 | 
							
								  surfIN.color.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.color = IN.custompack0.xyzw;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1 = IN.custompack1.xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldPos = IN.worldPos.xyz;
							 | 
						||
| 
								 | 
							
								  #ifndef USING_DIRECTIONAL_LIGHT
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = normalize(UnityWorldSpaceLightDir(worldPos));
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = _WorldSpaceLightPos0.xyz;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef UNITY_COMPILER_HLSL
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o = (SurfaceOutput)0;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  o.Albedo = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Emission = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Specular = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Alpha = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Gloss = 0.0;
							 | 
						||
| 
								 | 
							
								  fixed3 normalWorldVertex = fixed3(0,0,1);
							 | 
						||
| 
								 | 
							
								  o.Normal = IN.worldNormal;
							 | 
						||
| 
								 | 
							
								  normalWorldVertex = IN.worldNormal;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // call surface function
							 | 
						||
| 
								 | 
							
								  surf (surfIN, o);
							 | 
						||
| 
								 | 
							
								  UNITY_LIGHT_ATTENUATION(atten, IN, worldPos)
							 | 
						||
| 
								 | 
							
								  fixed4 c = 0;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // Setup lighting environment
							 | 
						||
| 
								 | 
							
								  UnityGI gi;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(UnityGI, gi);
							 | 
						||
| 
								 | 
							
								  gi.indirect.diffuse = 0;
							 | 
						||
| 
								 | 
							
								  gi.indirect.specular = 0;
							 | 
						||
| 
								 | 
							
								  gi.light.color = _LightColor0.rgb;
							 | 
						||
| 
								 | 
							
								  gi.light.dir = lightDir;
							 | 
						||
| 
								 | 
							
								  gi.light.color *= atten;
							 | 
						||
| 
								 | 
							
								  c += LightingLambert (o, gi);
							 | 
						||
| 
								 | 
							
								  c.a = 0.0;
							 | 
						||
| 
								 | 
							
								  UNITY_APPLY_FOG(_unity_fogCoord, c); // apply fog
							 | 
						||
| 
								 | 
							
								  UNITY_OPAQUE_ALPHA(c.a);
							 | 
						||
| 
								 | 
							
								  return c;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								ENDCG
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									// ---- deferred shading pass:
							 | 
						||
| 
								 | 
							
									Pass {
							 | 
						||
| 
								 | 
							
										Name "DEFERRED"
							 | 
						||
| 
								 | 
							
										Tags { "LightMode" = "Deferred" }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								CGPROGRAM
							 | 
						||
| 
								 | 
							
								// compile directives
							 | 
						||
| 
								 | 
							
								#pragma vertex vert_surf
							 | 
						||
| 
								 | 
							
								#pragma fragment frag_surf
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_vertex LOD_FADE_PERCENTAGE
							 | 
						||
| 
								 | 
							
								#pragma exclude_renderers nomrt
							 | 
						||
| 
								 | 
							
								#pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_prepassfinal nodynlightmap nodirlightmap
							 | 
						||
| 
								 | 
							
								#include "HLSLSupport.cginc"
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LOD_FADE
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_SH
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LIGHTMAPSTS
							 | 
						||
| 
								 | 
							
								#include "UnityShaderVariables.cginc"
							 | 
						||
| 
								 | 
							
								#include "UnityShaderUtilities.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "UnityCG.cginc"
							 | 
						||
| 
								 | 
							
								#include "Lighting.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define INTERNAL_DATA
							 | 
						||
| 
								 | 
							
								#define WorldReflectionVector(data,normal) data.worldRefl
							 | 
						||
| 
								 | 
							
								#define WorldNormalVector(data,normal) normal
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_ID_1
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
							 | 
						||
| 
								 | 
							
								#include "../../Core/CurvedWorldTransform.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #include "SpeedTreeCommon.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            void surf(Input IN, inout SurfaceOutput OUT)
							 | 
						||
| 
								 | 
							
								            {
							 | 
						||
| 
								 | 
							
								                SpeedTreeFragOut o;
							 | 
						||
| 
								 | 
							
								                SpeedTreeFrag(IN, o);
							 | 
						||
| 
								 | 
							
								                SPEEDTREE_COPY_FRAG(OUT, o)
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex-to-fragment interpolation data
							 | 
						||
| 
								 | 
							
								struct v2f_surf {
							 | 
						||
| 
								 | 
							
								  UNITY_POSITION(pos);
							 | 
						||
| 
								 | 
							
								  float3 worldNormal : TEXCOORD0;
							 | 
						||
| 
								 | 
							
								  float3 worldPos : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								  half4 custompack0 : TEXCOORD2; // color
							 | 
						||
| 
								 | 
							
								  half3 custompack1 : TEXCOORD3; // interpolator1
							 | 
						||
| 
								 | 
							
								  float4 lmap : TEXCOORD4;
							 | 
						||
| 
								 | 
							
								#ifndef LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								  #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
							 | 
						||
| 
								 | 
							
								    half3 sh : TEXCOORD5; // SH
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								#else
							 | 
						||
| 
								 | 
							
								  #ifdef DIRLIGHTMAP_OFF
							 | 
						||
| 
								 | 
							
								    float4 lmapFadePos : TEXCOORD5;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex shader
							 | 
						||
| 
								 | 
							
								v2f_surf vert_surf (SpeedTreeVB v) {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(v);
							 | 
						||
| 
								 | 
							
								  v2f_surf o;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(v2f_surf,o);
							 | 
						||
| 
								 | 
							
								  UNITY_TRANSFER_INSTANCE_ID(v,o);
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
							 | 
						||
| 
								 | 
							
								  Input customInputData;
							 | 
						||
| 
								 | 
							
								  SpeedTreeVert (v, customInputData);
							 | 
						||
| 
								 | 
							
								  o.custompack0.xyzw = customInputData.color;
							 | 
						||
| 
								 | 
							
								  o.custompack1.xyz = customInputData.interpolator1;
							 | 
						||
| 
								 | 
							
								  o.pos = UnityObjectToClipPos(v.vertex);
							 | 
						||
| 
								 | 
							
								  float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldNormal = UnityObjectToWorldNormal(v.normal);
							 | 
						||
| 
								 | 
							
								  o.worldPos.xyz = worldPos;
							 | 
						||
| 
								 | 
							
								  o.worldNormal = worldNormal;
							 | 
						||
| 
								 | 
							
								  o.lmap.zw = 0;
							 | 
						||
| 
								 | 
							
								#ifdef LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								  o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
							 | 
						||
| 
								 | 
							
								  #ifdef DIRLIGHTMAP_OFF
							 | 
						||
| 
								 | 
							
								    o.lmapFadePos.xyz = (mul(unity_ObjectToWorld, v.vertex).xyz - unity_ShadowFadeCenterAndType.xyz) * unity_ShadowFadeCenterAndType.w;
							 | 
						||
| 
								 | 
							
								    o.lmapFadePos.w = (-UnityObjectToViewPos(v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								#else
							 | 
						||
| 
								 | 
							
								  o.lmap.xy = 0;
							 | 
						||
| 
								 | 
							
								    #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
							 | 
						||
| 
								 | 
							
								      o.sh = 0;
							 | 
						||
| 
								 | 
							
								      o.sh = ShadeSHPerVertex (worldNormal, o.sh);
							 | 
						||
| 
								 | 
							
								    #endif
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								  return o;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#ifdef LIGHTMAP_ON
							 | 
						||
| 
								 | 
							
								float4 unity_LightmapFade;
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								fixed4 unity_Ambient;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// fragment shader
							 | 
						||
| 
								 | 
							
								void frag_surf (v2f_surf IN,
							 | 
						||
| 
								 | 
							
								    out half4 outGBuffer0 : SV_Target0,
							 | 
						||
| 
								 | 
							
								    out half4 outGBuffer1 : SV_Target1,
							 | 
						||
| 
								 | 
							
								    out half4 outGBuffer2 : SV_Target2,
							 | 
						||
| 
								 | 
							
								    out half4 outEmission : SV_Target3
							 | 
						||
| 
								 | 
							
								#if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4)
							 | 
						||
| 
								 | 
							
								    , out half4 outShadowMask : SV_Target4
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								) {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(IN);
							 | 
						||
| 
								 | 
							
								  // prepare and unpack data
							 | 
						||
| 
								 | 
							
								  Input surfIN;
							 | 
						||
| 
								 | 
							
								  #ifdef FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_TSPACE(IN);
							 | 
						||
| 
								 | 
							
								  #elif defined (FOG_COMBINED_WITH_WORLD_POS)
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN);
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG(IN);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(Input,surfIN);
							 | 
						||
| 
								 | 
							
								  surfIN.color.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.color = IN.custompack0.xyzw;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1 = IN.custompack1.xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldPos = IN.worldPos.xyz;
							 | 
						||
| 
								 | 
							
								  #ifndef USING_DIRECTIONAL_LIGHT
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = normalize(UnityWorldSpaceLightDir(worldPos));
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = _WorldSpaceLightPos0.xyz;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef UNITY_COMPILER_HLSL
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o = (SurfaceOutput)0;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  o.Albedo = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Emission = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Specular = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Alpha = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Gloss = 0.0;
							 | 
						||
| 
								 | 
							
								  fixed3 normalWorldVertex = fixed3(0,0,1);
							 | 
						||
| 
								 | 
							
								  o.Normal = IN.worldNormal;
							 | 
						||
| 
								 | 
							
								  normalWorldVertex = IN.worldNormal;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // call surface function
							 | 
						||
| 
								 | 
							
								  surf (surfIN, o);
							 | 
						||
| 
								 | 
							
								fixed3 originalNormal = o.Normal;
							 | 
						||
| 
								 | 
							
								  half atten = 1;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // Setup lighting environment
							 | 
						||
| 
								 | 
							
								  UnityGI gi;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(UnityGI, gi);
							 | 
						||
| 
								 | 
							
								  gi.indirect.diffuse = 0;
							 | 
						||
| 
								 | 
							
								  gi.indirect.specular = 0;
							 | 
						||
| 
								 | 
							
								  gi.light.color = 0;
							 | 
						||
| 
								 | 
							
								  gi.light.dir = half3(0,1,0);
							 | 
						||
| 
								 | 
							
								  // Call GI (lightmaps/SH/reflections) lighting function
							 | 
						||
| 
								 | 
							
								  UnityGIInput giInput;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(UnityGIInput, giInput);
							 | 
						||
| 
								 | 
							
								  giInput.light = gi.light;
							 | 
						||
| 
								 | 
							
								  giInput.worldPos = worldPos;
							 | 
						||
| 
								 | 
							
								  giInput.atten = atten;
							 | 
						||
| 
								 | 
							
								  #if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
							 | 
						||
| 
								 | 
							
								    giInput.lightmapUV = IN.lmap;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    giInput.lightmapUV = 0.0;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #if UNITY_SHOULD_SAMPLE_SH && !UNITY_SAMPLE_FULL_SH_PER_PIXEL
							 | 
						||
| 
								 | 
							
								    giInput.ambient = IN.sh;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    giInput.ambient.rgb = 0.0;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  giInput.probeHDR[0] = unity_SpecCube0_HDR;
							 | 
						||
| 
								 | 
							
								  giInput.probeHDR[1] = unity_SpecCube1_HDR;
							 | 
						||
| 
								 | 
							
								  #if defined(UNITY_SPECCUBE_BLENDING) || defined(UNITY_SPECCUBE_BOX_PROJECTION)
							 | 
						||
| 
								 | 
							
								    giInput.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef UNITY_SPECCUBE_BOX_PROJECTION
							 | 
						||
| 
								 | 
							
								    giInput.boxMax[0] = unity_SpecCube0_BoxMax;
							 | 
						||
| 
								 | 
							
								    giInput.probePosition[0] = unity_SpecCube0_ProbePosition;
							 | 
						||
| 
								 | 
							
								    giInput.boxMax[1] = unity_SpecCube1_BoxMax;
							 | 
						||
| 
								 | 
							
								    giInput.boxMin[1] = unity_SpecCube1_BoxMin;
							 | 
						||
| 
								 | 
							
								    giInput.probePosition[1] = unity_SpecCube1_ProbePosition;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  LightingLambert_GI(o, giInput, gi);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // call lighting function to output g-buffer
							 | 
						||
| 
								 | 
							
								  outEmission = LightingLambert_Deferred (o, gi, outGBuffer0, outGBuffer1, outGBuffer2);
							 | 
						||
| 
								 | 
							
								  #if defined(SHADOWS_SHADOWMASK) && (UNITY_ALLOWED_MRT_COUNT > 4)
							 | 
						||
| 
								 | 
							
								    outShadowMask = UnityGetRawBakedOcclusions (IN.lmap.xy, worldPos);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifndef UNITY_HDR_ON
							 | 
						||
| 
								 | 
							
								  outEmission.rgb = exp2(-outEmission.rgb);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								ENDCG
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									// ---- meta information extraction pass:
							 | 
						||
| 
								 | 
							
									Pass {
							 | 
						||
| 
								 | 
							
										Name "Meta"
							 | 
						||
| 
								 | 
							
										Tags { "LightMode" = "Meta" }
							 | 
						||
| 
								 | 
							
										Cull Off
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								CGPROGRAM
							 | 
						||
| 
								 | 
							
								// compile directives
							 | 
						||
| 
								 | 
							
								#pragma vertex vert_surf
							 | 
						||
| 
								 | 
							
								#pragma fragment frag_surf
							 | 
						||
| 
								 | 
							
								#pragma multi_compile_vertex LOD_FADE_PERCENTAGE
							 | 
						||
| 
								 | 
							
								#pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
							 | 
						||
| 
								 | 
							
								#pragma shader_feature EDITOR_VISUALIZATION
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "HLSLSupport.cginc"
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LOD_FADE
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_SH
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LIGHTMAPSTS
							 | 
						||
| 
								 | 
							
								#include "UnityShaderVariables.cginc"
							 | 
						||
| 
								 | 
							
								#include "UnityShaderUtilities.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "UnityCG.cginc"
							 | 
						||
| 
								 | 
							
								#include "Lighting.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define INTERNAL_DATA
							 | 
						||
| 
								 | 
							
								#define WorldReflectionVector(data,normal) data.worldRefl
							 | 
						||
| 
								 | 
							
								#define WorldNormalVector(data,normal) normal
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #pragma shader_feature_local GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH
							 | 
						||
| 
								 | 
							
								             
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_ID_1
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
							 | 
						||
| 
								 | 
							
								#include "../../Core/CurvedWorldTransform.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            #include "SpeedTreeCommon.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            void surf(Input IN, inout SurfaceOutput OUT)
							 | 
						||
| 
								 | 
							
								            {
							 | 
						||
| 
								 | 
							
								                SpeedTreeFragOut o;
							 | 
						||
| 
								 | 
							
								                SpeedTreeFrag(IN, o);
							 | 
						||
| 
								 | 
							
								                SPEEDTREE_COPY_FRAG(OUT, o)
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        
							 | 
						||
| 
								 | 
							
								#include "UnityMetaPass.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex-to-fragment interpolation data
							 | 
						||
| 
								 | 
							
								struct v2f_surf {
							 | 
						||
| 
								 | 
							
								  UNITY_POSITION(pos);
							 | 
						||
| 
								 | 
							
								  float3 worldPos : TEXCOORD0;
							 | 
						||
| 
								 | 
							
								  half4 custompack0 : TEXCOORD1; // color
							 | 
						||
| 
								 | 
							
								  half3 custompack1 : TEXCOORD2; // interpolator1
							 | 
						||
| 
								 | 
							
								#ifdef EDITOR_VISUALIZATION
							 | 
						||
| 
								 | 
							
								  float2 vizUV : TEXCOORD3;
							 | 
						||
| 
								 | 
							
								  float4 lightCoord : TEXCOORD4;
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_INPUT_INSTANCE_ID
							 | 
						||
| 
								 | 
							
								  UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// vertex shader
							 | 
						||
| 
								 | 
							
								v2f_surf vert_surf (SpeedTreeVB v) {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(v);
							 | 
						||
| 
								 | 
							
								  v2f_surf o;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(v2f_surf,o);
							 | 
						||
| 
								 | 
							
								  UNITY_TRANSFER_INSTANCE_ID(v,o);
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
							 | 
						||
| 
								 | 
							
								  Input customInputData;
							 | 
						||
| 
								 | 
							
								  SpeedTreeVert (v, customInputData);
							 | 
						||
| 
								 | 
							
								  o.custompack0.xyzw = customInputData.color;
							 | 
						||
| 
								 | 
							
								  o.custompack1.xyz = customInputData.interpolator1;
							 | 
						||
| 
								 | 
							
								  o.pos = UnityMetaVertexPosition(v.vertex, v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST);
							 | 
						||
| 
								 | 
							
								#ifdef EDITOR_VISUALIZATION
							 | 
						||
| 
								 | 
							
								  o.vizUV = 0;
							 | 
						||
| 
								 | 
							
								  o.lightCoord = 0;
							 | 
						||
| 
								 | 
							
								  if (unity_VisualizationMode == EDITORVIZ_TEXTURE)
							 | 
						||
| 
								 | 
							
								    o.vizUV = UnityMetaVizUV(unity_EditorViz_UVIndex, v.texcoord.xy, v.texcoord1.xy, v.texcoord2.xy, unity_EditorViz_Texture_ST);
							 | 
						||
| 
								 | 
							
								  else if (unity_VisualizationMode == EDITORVIZ_SHOWLIGHTMASK)
							 | 
						||
| 
								 | 
							
								  {
							 | 
						||
| 
								 | 
							
								    o.vizUV = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
							 | 
						||
| 
								 | 
							
								    o.lightCoord = mul(unity_EditorViz_WorldToLight, mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1)));
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								  float3 worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldNormal = UnityObjectToWorldNormal(v.normal);
							 | 
						||
| 
								 | 
							
								  o.worldPos.xyz = worldPos;
							 | 
						||
| 
								 | 
							
								  return o;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// fragment shader
							 | 
						||
| 
								 | 
							
								fixed4 frag_surf (v2f_surf IN) : SV_Target {
							 | 
						||
| 
								 | 
							
								  UNITY_SETUP_INSTANCE_ID(IN);
							 | 
						||
| 
								 | 
							
								  // prepare and unpack data
							 | 
						||
| 
								 | 
							
								  Input surfIN;
							 | 
						||
| 
								 | 
							
								  #ifdef FOG_COMBINED_WITH_TSPACE
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_TSPACE(IN);
							 | 
						||
| 
								 | 
							
								  #elif defined (FOG_COMBINED_WITH_WORLD_POS)
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG_FROM_WORLD_POS(IN);
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    UNITY_EXTRACT_FOG(IN);
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(Input,surfIN);
							 | 
						||
| 
								 | 
							
								  surfIN.color.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1.x = 1.0;
							 | 
						||
| 
								 | 
							
								  surfIN.color = IN.custompack0.xyzw;
							 | 
						||
| 
								 | 
							
								  surfIN.interpolator1 = IN.custompack1.xyz;
							 | 
						||
| 
								 | 
							
								  float3 worldPos = IN.worldPos.xyz;
							 | 
						||
| 
								 | 
							
								  #ifndef USING_DIRECTIONAL_LIGHT
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = normalize(UnityWorldSpaceLightDir(worldPos));
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								    fixed3 lightDir = _WorldSpaceLightPos0.xyz;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  #ifdef UNITY_COMPILER_HLSL
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o = (SurfaceOutput)0;
							 | 
						||
| 
								 | 
							
								  #else
							 | 
						||
| 
								 | 
							
								  SurfaceOutput o;
							 | 
						||
| 
								 | 
							
								  #endif
							 | 
						||
| 
								 | 
							
								  o.Albedo = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Emission = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Specular = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Alpha = 0.0;
							 | 
						||
| 
								 | 
							
								  o.Gloss = 0.0;
							 | 
						||
| 
								 | 
							
								  fixed3 normalWorldVertex = fixed3(0,0,1);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // call surface function
							 | 
						||
| 
								 | 
							
								  surf (surfIN, o);
							 | 
						||
| 
								 | 
							
								  UnityMetaInput metaIN;
							 | 
						||
| 
								 | 
							
								  UNITY_INITIALIZE_OUTPUT(UnityMetaInput, metaIN);
							 | 
						||
| 
								 | 
							
								  metaIN.Albedo = o.Albedo;
							 | 
						||
| 
								 | 
							
								  metaIN.Emission = o.Emission;
							 | 
						||
| 
								 | 
							
								  metaIN.SpecularColor = o.Specular;
							 | 
						||
| 
								 | 
							
								#ifdef EDITOR_VISUALIZATION
							 | 
						||
| 
								 | 
							
								  metaIN.VizUV = IN.vizUV;
							 | 
						||
| 
								 | 
							
								  metaIN.LightCoord = IN.lightCoord;
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								  return UnityMetaFragment(metaIN);
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								ENDCG
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        Pass
							 | 
						||
| 
								 | 
							
								        {
							 | 
						||
| 
								 | 
							
								            Tags { "LightMode" = "ShadowCaster" }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            CGPROGRAM
							 | 
						||
| 
								 | 
							
								#include "HLSLSupport.cginc"
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LOD_FADE
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_SH
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LIGHTMAPSTS
							 | 
						||
| 
								 | 
							
								#include "UnityShaderVariables.cginc"
							 | 
						||
| 
								 | 
							
								#include "UnityShaderUtilities.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                #pragma vertex vert
							 | 
						||
| 
								 | 
							
								                #pragma fragment frag
							 | 
						||
| 
								 | 
							
								                #pragma multi_compile_vertex LOD_FADE_PERCENTAGE
							 | 
						||
| 
								 | 
							
								                #pragma shader_feature_local GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH
							 | 
						||
| 
								 | 
							
								                #pragma multi_compile_shadowcaster
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_ID_1
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
							 | 
						||
| 
								 | 
							
								#include "../../Core/CurvedWorldTransform.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                #include "SpeedTreeCommon.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                struct v2f
							 | 
						||
| 
								 | 
							
								                {
							 | 
						||
| 
								 | 
							
								                    V2F_SHADOW_CASTER;
							 | 
						||
| 
								 | 
							
								                    #ifdef SPEEDTREE_ALPHATEST
							 | 
						||
| 
								 | 
							
								                        float2 uv : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								                    #endif
							 | 
						||
| 
								 | 
							
								                };
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                v2f vert(SpeedTreeVB v)
							 | 
						||
| 
								 | 
							
								                {
							 | 
						||
| 
								 | 
							
								                    v2f o;
							 | 
						||
| 
								 | 
							
								                    #ifdef SPEEDTREE_ALPHATEST
							 | 
						||
| 
								 | 
							
								                        o.uv = v.texcoord.xy;
							 | 
						||
| 
								 | 
							
								                    #endif
							 | 
						||
| 
								 | 
							
								                    OffsetSpeedTreeVertex(v, unity_LODFade.x);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#if defined(CURVEDWORLD_IS_INSTALLED) && !defined(CURVEDWORLD_DISABLED_ON)
							 | 
						||
| 
								 | 
							
								   CURVEDWORLD_TRANSFORM_VERTEX(v.vertex)
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                    TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)
							 | 
						||
| 
								 | 
							
								                    return o;
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                float4 frag(v2f i) : SV_Target
							 | 
						||
| 
								 | 
							
								                {
							 | 
						||
| 
								 | 
							
								                    #ifdef SPEEDTREE_ALPHATEST
							 | 
						||
| 
								 | 
							
								                        clip(tex2D(_MainTex, i.uv).a * _Color.a - _Cutoff);
							 | 
						||
| 
								 | 
							
								                    #endif
							 | 
						||
| 
								 | 
							
								                    SHADOW_CASTER_FRAGMENT(i)
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								            ENDCG
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        Pass
							 | 
						||
| 
								 | 
							
								        {
							 | 
						||
| 
								 | 
							
								            Tags { "LightMode" = "Vertex" }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            CGPROGRAM
							 | 
						||
| 
								 | 
							
								#include "HLSLSupport.cginc"
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LOD_FADE
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_SH
							 | 
						||
| 
								 | 
							
								#define UNITY_INSTANCED_LIGHTMAPSTS
							 | 
						||
| 
								 | 
							
								#include "UnityShaderVariables.cginc"
							 | 
						||
| 
								 | 
							
								#include "UnityShaderUtilities.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                #pragma vertex vert
							 | 
						||
| 
								 | 
							
								                #pragma fragment frag
							 | 
						||
| 
								 | 
							
								                #pragma multi_compile_fog
							 | 
						||
| 
								 | 
							
								                #pragma multi_compile_vertex LOD_FADE_PERCENTAGE
							 | 
						||
| 
								 | 
							
								                #pragma shader_feature_local GEOM_TYPE_BRANCH GEOM_TYPE_BRANCH_DETAIL GEOM_TYPE_FROND GEOM_TYPE_LEAF GEOM_TYPE_MESH
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
							 | 
						||
| 
								 | 
							
								#define CURVEDWORLD_BEND_ID_1
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
							 | 
						||
| 
								 | 
							
								#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
							 | 
						||
| 
								 | 
							
								#include "../../Core/CurvedWorldTransform.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                #include "SpeedTreeCommon.cginc"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                struct v2f
							 | 
						||
| 
								 | 
							
								                {
							 | 
						||
| 
								 | 
							
								                    UNITY_POSITION(vertex);
							 | 
						||
| 
								 | 
							
								                    UNITY_FOG_COORDS(0)
							 | 
						||
| 
								 | 
							
								                    Input data      : TEXCOORD1;
							 | 
						||
| 
								 | 
							
								                    UNITY_VERTEX_OUTPUT_STEREO
							 | 
						||
| 
								 | 
							
								                };
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                v2f vert(SpeedTreeVB v)
							 | 
						||
| 
								 | 
							
								                {
							 | 
						||
| 
								 | 
							
								                    v2f o;
							 | 
						||
| 
								 | 
							
								                    UNITY_SETUP_INSTANCE_ID(v);
							 | 
						||
| 
								 | 
							
								                    UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
							 | 
						||
| 
								 | 
							
								                    SpeedTreeVert(v, o.data);
							 | 
						||
| 
								 | 
							
								                    o.data.color.rgb *= ShadeVertexLightsFull(v.vertex, v.normal, 2, false);
							 | 
						||
| 
								 | 
							
								                    o.vertex = UnityObjectToClipPos(v.vertex);
							 | 
						||
| 
								 | 
							
								                    UNITY_TRANSFER_FOG(o,o.vertex);
							 | 
						||
| 
								 | 
							
								                    return o;
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								                fixed4 frag(v2f i) : SV_Target
							 | 
						||
| 
								 | 
							
								                {
							 | 
						||
| 
								 | 
							
								                    SpeedTreeFragOut o;
							 | 
						||
| 
								 | 
							
								                    SpeedTreeFrag(i.data, o);
							 | 
						||
| 
								 | 
							
								                    fixed4 c = fixed4(o.Albedo, o.Alpha);
							 | 
						||
| 
								 | 
							
								                    UNITY_APPLY_FOG(i.fogCoord, c);
							 | 
						||
| 
								 | 
							
								                    return c;
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								            ENDCG
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    Dependency "BillboardShader" = "Amazing Assets/Curved World/Nature/SpeedTree Billboard"
							 | 
						||
| 
								 | 
							
								    FallBack "Hidden/Amazing Assets/Curved World/Fallback/VertexLit Cutout"
							 | 
						||
| 
								 | 
							
								    CustomEditor "AmazingAssets.CurvedWorld.Editor.SpeedTreeMaterialInspector"
							 | 
						||
| 
								 | 
							
								}
							 |