void SetFogFeatures () {
		SetupAdvancedFoliageShader script = (SetupAdvancedFoliageShader)target;
		Debug.Log("set fog");
		bool Disable = false;
		bool Enable = true;

		string ShaderFolder = script.AFSShader_Folder;

		string[] ShaderPath = new string[] {
			"advancedFoliageShader IBL Raindrops v3.shader"
			/*"advancedFoliageShader IBL v3.shader",
			"advancedFoliageShader IBL Raindrops v3.shader",
			"advancedFoliageShader IBL TouchBending v3.shader",
			"advancedFoliageShader IBL TouchBending Raindrops v3.shader",

			"advancedFoliageShader GS IBL v3.shader",
			"advancedFoliageShader GS IBL TouchBending v3.shader",

			"advancedFoliageShader IBL Groundlighting v3.shader",

			"AfsSimpleTerrainTree IBL v3.shader",
			"AfsTreeCreatorBarkOptimized IBL v3.shader",
			"AfsTreeCreatorLeafsOptimized IBL v3.shader",

			"hidden Shaders/advancedFoliageShader for Terrain Engine v3 IBL.shader"*/
		};
		
		for( int i = 0; i < ShaderPath.Length; i ++ ) {
			if (System.IO.File.Exists(ShaderFolder+ShaderPath[i])) {
				string ShaderCode = System.IO.File.ReadAllText(ShaderFolder+ShaderPath[i]);

				// Linear
				if (script.AFSFog_Mode == 0) {
					SetShaderFeature (ref ShaderCode, "FogExpo", Disable);
					SetShaderFeature (ref ShaderCode, "FogExp2", Disable);
					SetShaderFeature (ref ShaderCode, "FogLinear", Enable);
				}
				// Exponential 
				else if (script.AFSFog_Mode == 1) {
					SetShaderFeature (ref ShaderCode, "FogExpo", Enable);
					SetShaderFeature (ref ShaderCode, "FogExp2", Disable);
					SetShaderFeature (ref ShaderCode, "FogLinear", Disable);

				}
				// Exp2 
				else if (script.AFSFog_Mode == 2) {
					SetShaderFeature (ref ShaderCode, "FogExpo", Disable);
					SetShaderFeature (ref ShaderCode, "FogExp2", Enable);
					SetShaderFeature (ref ShaderCode, "FogLinear", Disable);
				}
				// Write back modified shader
				System.IO.File.WriteAllText(ShaderFolder + ShaderPath[i], ShaderCode);
			}
			else {
				Debug.Log("Shader not found: " + ShaderFolder + ShaderPath);
			}
		}
		AssetDatabase.Refresh();
	}
Example #2
0
 private void Awake()
 {
     this.afs           = GameObject.FindWithTag("Afs").GetComponent <SetupAdvancedFoliageShader>();
     this.WindIntensity = 0f;
     this.UpdateFoliageShaderWind();
     this.windGustIntervalTimer = UnityEngine.Random.Range(15f, 120f);
     if (Application.isPlaying)
     {
         Shader.WarmupAllShaders();
     }
     this.OceanH = GameObject.FindWithTag("OceanHeight").transform;
     base.InvokeRepeating("ChangeFogAmount", 500f, 600f);
     base.InvokeRepeating("ChangeMoonLight", 10f, 10f);
 }
/*	void FindFirstDirectionalLight () {
		DirLights = FindObjectsOfType(typeof(Light)) as Light[];
		for (int i = 0; i < DirLights.Length; i ++) {
			//allTerrains[i].treeCrossFadeLength = resetValue;
			//Debug.Log(DirLights.transform.name);
		//	Debug.Log(DirLights.Length);
		//	Debug.Log(DirLights[i]);
		//	Debug.Log(DirLights[i].GetComponent<Light>().type);
			if(DirLights[i].GetComponent<Light>().type == LightType.Directional) {
				TerrianLight0.objectReferenceValue = DirLights[i]; //.transform.parent;
				//SetupAFS.TerrianLight0 = DirLights[i];
			//	SetupAFS.FindProperty("TerrianLight0") = TerrianLight0;
				SetupAFS.Update();
				//TerrianLight0.CopyFromSerializedProperty();

// warum klappt das nicht??

				Debug.Log("assigned " + TerrianLight0);
				
				//TerrianLight0 = SetupAFS.FindProperty("TerrianLight0");
				//break;
			}
		}

	} */

	void CheckShaderFeatures () {
		SetupAdvancedFoliageShader script = (SetupAdvancedFoliageShader)target;

		string ShaderFolder = script.AFSShader_Folder;

		string[] ShaderPath = new string[] {
			"advancedFoliageShader IBL v3.shader"
		};
		for( int i = 0; i < ShaderPath.Length; i ++ ) {
			if (System.IO.File.Exists(ShaderFolder+ShaderPath[i])) {
				string ShaderCode = System.IO.File.ReadAllText(ShaderFolder+ShaderPath[i]);
					
					SkyshopSHEnabled = CheckShaderFeature (ref ShaderCode, "DIFFCUBE_ON");

				Debug.Log(SkyshopSHEnabled);

			}
		}
	}
    public override void OnInspectorGUI()
    {
        SetupAdvancedFoliageShader script = (SetupAdvancedFoliageShader)target;
        //Color myBlue = new Color(0.5f,0.7f,1.0f,1.0f);
        Color    myCol          = Color.green;
        GUIStyle myFoldoutStyle = new GUIStyle(EditorStyles.foldout);

        myFoldoutStyle.fontStyle = FontStyle.Bold;

        GUILayout.Space(6);

        //	Wind settings
        GUILayout.Space(4);
        EditorGUILayout.BeginVertical("Box");
        GUI.color       = myCol;
        script.FoldWind = EditorGUILayout.Foldout(script.FoldWind, " Wind Settings", myFoldoutStyle);
        GUI.color       = Color.white;
        if (script.FoldWind)
        {
            GUILayout.Space(2);
            GUI.color = myCol;
            EditorGUILayout.LabelField("Overall Wind Settings");
            GUI.color = Color.white;
            GUILayout.Label("Wind Direction (xyz) Strength (w)");
            GUILayout.Space(-14);
            script.Wind = EditorGUILayout.Vector4Field("", script.Wind);
            GUILayout.Space(2);
            toolTip = "Frequency the wind changes over time. Effects grass and foliage.";
            script.WindFrequency = EditorGUILayout.Slider(
                new GUIContent("Wind Frequency", toolTip), script.WindFrequency, 0.0f, 10.0f);

            GUILayout.Space(4);
            GUI.color = myCol;
            GUILayout.Label("Wind Settings for the Foliage Shaders");
            GUI.color = Color.white;
            toolTip   = "The shader adds some variation to the bending taking the vertex position in world space and the 'Wave Size Foliage' " +
                        "parameter into account. So smaller wave sizes will add more variety to a given area but also lead to slightly different amounts of bending on each vertex even of a single mesh. This might cause some strange distortion of your models – especially large models. " +
                        "For this reason you should set the 'Wave Size' to at least 2 or even 3 times the bounding box size of the largest model.";
            script.WaveSizeFoliageShader = EditorGUILayout.Slider(new GUIContent("Wave Size Foliage", toolTip), script.WaveSizeFoliageShader, 0.0f, 50.0f);
            GUILayout.Space(4);
            GUI.color = myCol;
            GUILayout.Label("Wind Settings for the Grass Shaders");
            GUI.color = Color.white;
            toolTip   = "Factor to make the bending of the grass fit the bending of the foliage. " +
                        "Effects both: grass placed manually and grass placed within the terrain engine (if you use the 'atsVxx.WavingGrass vertexAlpha' shader).";
            script.WindMultiplierForGrassshader = EditorGUILayout.Slider(new GUIContent("Wind Multiplier Grass", toolTip), script.WindMultiplierForGrassshader, 0.0f, 5.0f);
            toolTip = "Similar to the 'Wave Size Foliage' parameter, but as grass models usually are pretty small even low values might look good. " +
                      "It effects both: grass placed manually and grass placed within the terrain engine (if you use the 'atsVxx.WavingGrass vertexAlpha' shader).";
            script.WaveSizeForGrassshader = EditorGUILayout.Slider(new GUIContent("Wave Size Grass", toolTip), script.WaveSizeForGrassshader, 0.0f, 50.0f);
        }
        EditorGUILayout.EndVertical();

        //	Rain Settings
        GUILayout.Space(4);
        EditorGUILayout.BeginVertical("Box");
        GUI.color       = myCol;
        script.FoldRain = EditorGUILayout.Foldout(script.FoldRain, " Rain Settings", myFoldoutStyle);
        GUI.color       = Color.white;
        if (script.FoldRain)
        {
            script.RainAmount = EditorGUILayout.Slider("Rain Amount", script.RainAmount, 0.0f, 1.0f);
            script.SpecPower  = EditorGUILayout.Slider("Specular Power", script.SpecPower, 0.0f, 8.0f);
        }
        EditorGUILayout.EndVertical();

        //	Terrain Detail Vegetation Settings
        GUILayout.Space(4);
        EditorGUILayout.BeginVertical("Box");
        GUI.color             = myCol;
        script.FoldVegTerrain = EditorGUILayout.Foldout(script.FoldVegTerrain, " Terrain Detail Vegetation Settings", myFoldoutStyle);
        GUI.color             = Color.white;
        if (script.FoldVegTerrain)
        {
            GUILayout.Space(2);
            script.VertexLitAlphaCutOff                = EditorGUILayout.Slider("Alpha Cut Off", script.VertexLitAlphaCutOff, 0.1f, 1.0f);
            script.VertexLitTranslucencyColor          = EditorGUILayout.ColorField("Translucency Color", script.VertexLitTranslucencyColor);
            script.VertexLitTranslucencyViewDependency = EditorGUILayout.Slider("Translucency View Dependency", script.VertexLitTranslucencyViewDependency, 0.1f, 1.0f);
            script.VertexLitShadowStrength             = EditorGUILayout.Slider("Shadow Strength", script.VertexLitShadowStrength, 0.1f, 1.0f);
            script.VertexLitShininess = EditorGUILayout.Slider("Shininess", script.VertexLitShininess, 0.03f, 1.0f);
        }
        EditorGUILayout.EndVertical();

        //	Grass, Tree and Billboard settings
        GUILayout.Space(4);
        EditorGUILayout.BeginVertical("Box");
        GUI.color            = myCol;
        script.FoldBillboard = EditorGUILayout.Foldout(script.FoldBillboard, " Grass, Tree and Billboard Settings", myFoldoutStyle);
        GUI.color            = Color.white;
        if (script.FoldBillboard)
        {
            GUILayout.Space(2);
            // General Billboard settings
            GUI.color = myCol;
            EditorGUILayout.LabelField("Sync Settings to Terrain");
            GUI.color = Color.white;

            EditorGUILayout.BeginHorizontal();
            script.AutoSyncToTerrain = EditorGUILayout.Toggle("", script.AutoSyncToTerrain, GUILayout.Width(14));
            EditorGUILayout.LabelField("Automatically sync with Terrain");
            EditorGUILayout.EndHorizontal();

            if (script.AutoSyncToTerrain)
            {
                script.SyncedTerrain = (Terrain)EditorGUILayout.ObjectField("Specify Terrain", script.SyncedTerrain, typeof(Terrain), true);
                if (script.SyncedTerrain != null)
                {
                    GUI.enabled = false;
                }
                else
                {
                    EditorGUILayout.HelpBox("Please assign a terrain.", MessageType.Warning, true);
                }
            }
            GUILayout.Space(4);
            script.BillboardStart = EditorGUILayout.Slider("Billboard Start", script.BillboardStart, 0.0f, 1000.0f);
            if (script.TreeBillboardShadows)
            {
                GUI.enabled = true;
            }
            script.BillboardFadeLenght = EditorGUILayout.Slider("Fade Length", script.BillboardFadeLenght, 0.0f, 30.0f);

            if (script.AutoSyncToTerrain)
            {
                GUI.enabled = false;
            }
            script.DetailDistanceForGrassShader = EditorGUILayout.Slider("Grass Fadeout Distance", script.DetailDistanceForGrassShader, 0.0f, 400.0f);
            script.GrassWavingTint = EditorGUILayout.ColorField("Grass Waving Tint", script.GrassWavingTint);
            if (script.AutoSyncToTerrain)
            {
                GUI.enabled = true;
            }
            // Grass Render settings
            GUILayout.Space(4);
            GUI.color = myCol;
            EditorGUILayout.LabelField("Grass Render Settings");
            GUI.color = Color.white;
            EditorGUILayout.BeginHorizontal();
            script.GrassAnimateNormal = EditorGUILayout.Toggle("", script.GrassAnimateNormal, GUILayout.Width(14));
            EditorGUILayout.LabelField("Enable Normal Animation on Grass");
            EditorGUILayout.EndHorizontal();


            // Tree and Billboard Render settings
            GUILayout.Space(4);
            GUI.color = myCol;
            EditorGUILayout.LabelField("Tree and Billboard Render Settings");
            GUI.color = Color.white;
            EditorGUILayout.BeginHorizontal();
            script.TreeShadowDissolve = EditorGUILayout.Toggle("", script.TreeShadowDissolve, GUILayout.Width(14));
            EditorGUILayout.LabelField("Enable Dissolve Shadows for Trees");
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(4);
            if (script.TreeShadowDissolve)
            {
                script.TreeBillboardShadows = false;
            }

            EditorGUILayout.BeginHorizontal();
            script.TreeBillboardShadows = EditorGUILayout.Toggle("", script.TreeBillboardShadows, GUILayout.Width(14));
            EditorGUILayout.LabelField("Enable Shadows casted by Billboards");
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(4);

                        #if UNITY_3_5
            EditorGUILayout.HelpBox("Unfortunately 'Enable/disable shadows casted by Billboards' does not work automatically in Unity 3.x.\nSee docs for further instructions.", MessageType.Warning, true);
                        #endif

            /*
             * EditorGUILayout.BeginHorizontal();
             * EditorGUILayout.LabelField("", GUILayout.Width(14));
             * script.AfsTreeBillboardShadowShader = (Shader)EditorGUILayout.ObjectField("Billboard Shader", script.AfsTreeBillboardShadowShader, typeof(Shader), true);
             * EditorGUILayout.EndHorizontal();
             */

            if (script.TreeBillboardShadows)
            {
                script.TreeShadowDissolve = false;

                EditorGUILayout.BeginVertical();
                //EditorGUI.indentLevel++;
                //



                //AfsTreeBillboardShadowShader


                //
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("", GUILayout.Width(14));
                toolTip = "Check this to fade out shadows casted by billboards towards the edges of the screen.";
                script.BillboardShadowEdgeFade = EditorGUILayout.Toggle("", script.BillboardShadowEdgeFade, GUILayout.Width(14));
                EditorGUILayout.LabelField(new GUIContent("Enable Shadow edgefade on Billboards", toolTip));
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("", GUILayout.Width(32));
                script.BillboardShadowEdgeFadeThreshold = EditorGUILayout.Slider("Threshold", script.BillboardShadowEdgeFadeThreshold, 0.01f, 0.5f);
                EditorGUILayout.EndHorizontal();
                //
                //EditorGUILayout.BeginHorizontal();
                //EditorGUILayout.LabelField("", GUILayout.Width(14));
                //script.TreeShadowEdgeFade = EditorGUILayout.Toggle("", script.TreeShadowEdgeFade, GUILayout.Width(14) );
                //EditorGUILayout.LabelField("Enable Shadow edgefade on Mesh Trees");
                //EditorGUILayout.EndHorizontal();
                //
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("", GUILayout.Width(14));
                EditorGUILayout.HelpBox("Please make sure that all trees use the right shaders and set up 'Fade Length' in the option group 'Automatically sync with Terrain' above.", MessageType.Warning, true);
                EditorGUILayout.EndHorizontal();
                GUILayout.Space(4);
                if (script.BillboardLightReference == null)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("", GUILayout.Width(14));
                    script.BillboardLightReference = (GameObject)EditorGUILayout.ObjectField("Light Reference", script.BillboardLightReference, typeof(GameObject), true);
                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("", GUILayout.Width(14));
                    EditorGUILayout.HelpBox("You have to specify a light reference.", MessageType.Error, true);
                    EditorGUILayout.EndHorizontal();
                    GUILayout.Space(4);
                }

                //
                if (!fadeLenghtReseted)
                {
                    ResetBillboardFadeLength();
                    fadeLenghtReseted = true;
                }
                //EditorGUI.indentLevel--;

                EditorGUILayout.EndVertical();
            }

            else
            {
                if (fadeLenghtReseted)
                {
                    RestoreBillboardFadeLength(script.BillboardFadeLenght);
                    fadeLenghtReseted = false;
                }
            }

            script.BillboardFadeOutLength = EditorGUILayout.Slider("Billboard Fade Out Length", script.BillboardFadeOutLength, 10.0f, 100.0f);
            EditorGUILayout.BeginHorizontal();
            script.BillboardAdjustToCamera = EditorGUILayout.Toggle("", script.BillboardAdjustToCamera, GUILayout.Width(14));
            EditorGUILayout.LabelField("Align Billboards to Camera");
            EditorGUILayout.EndHorizontal();
            if (script.BillboardAdjustToCamera)
            {
                script.BillboardAngleLimit = EditorGUILayout.Slider("Angle Limit", script.BillboardAngleLimit, 10.0f, 90.0f);
            }

            // Billboard RenderTex settings
            GUILayout.Space(4);
            GUI.color = myCol;
            EditorGUILayout.LabelField("Billboard Texture Settings");
            GUI.color = Color.white;
            script.BillboardTranslucencyFactor  = EditorGUILayout.Slider("Translucency Factor", script.BillboardTranslucencyFactor, 1.0f, 3.0f);
            script.BillboardLeafsLightingFactor = EditorGUILayout.Slider("Leaf Lighting Factor", script.BillboardLeafsLightingFactor, 1.0f, 3.0f);
            script.BillboardLeafsContrast       = EditorGUILayout.Slider("Leaf Contrast", script.BillboardLeafsContrast, .5f, 2.0f);
            //
            GUILayout.Space(4);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("");
            if (GUILayout.Button("Reset", GUILayout.MaxWidth(50)))
            {
                script.BillboardTranslucencyFactor  = 2.0f;
                script.BillboardLeafsLightingFactor = 2.0f;
                script.BillboardLeafsContrast       = 1.0f;
            }
            EditorGUILayout.EndHorizontal();

            // "Shaded" Billboard settings
            GUILayout.Space(4);
            GUI.color = myCol;
            EditorGUILayout.LabelField("Shaded Billboard Settings");
            GUI.color = Color.white;
            script.BillboardLightReference = (GameObject)EditorGUILayout.ObjectField("Light Reference", script.BillboardLightReference, typeof(GameObject), true);
            GUI.enabled = false;
            script.BillboardShadowColor = EditorGUILayout.ColorField("Shadow Color", script.BillboardShadowColor);
            GUI.enabled = true;
            script.BillboardAmbientLightFactor             = EditorGUILayout.Slider("Ambient Light Factor", script.BillboardAmbientLightFactor, 0.0f, 4.0f);
            script.BillboardAmbientLightDesaturationFactor = EditorGUILayout.Slider("Ambient Light Desaturation Factor", script.BillboardAmbientLightDesaturationFactor, 0.0f, 2.0f);
        }
        EditorGUILayout.EndVertical();

        //	Camera Layer Culling Settings
        GUILayout.Space(4);
        EditorGUILayout.BeginVertical("Box");
        GUI.color          = myCol;
        script.FoldCulling = EditorGUILayout.Foldout(script.FoldCulling, " Camera Culling Settings", myFoldoutStyle);
        GUI.color          = Color.white;
        if (script.FoldCulling)
        {
            EditorGUILayout.BeginHorizontal();
            script.EnableCameraLayerCulling = EditorGUILayout.Toggle("", script.EnableCameraLayerCulling, GUILayout.Width(14));
            EditorGUILayout.LabelField("Enable Layer Culling");
            EditorGUILayout.EndHorizontal();
            if (script.EnableCameraLayerCulling)
            {
                script.SmallDetailsDistance  = EditorGUILayout.IntSlider("Small Detail Distance", script.SmallDetailsDistance, 10, 300);
                script.MediumDetailsDistance = EditorGUILayout.IntSlider("Medium Detail Distance", script.MediumDetailsDistance, 10, 300);
            }
        }
        EditorGUILayout.EndVertical();

        //	Special Render Settings
        GUILayout.Space(4);
        EditorGUILayout.BeginVertical("Box");
        GUI.color         = myCol;
        script.FoldRender = EditorGUILayout.Foldout(script.FoldRender, " Special Render Settings", myFoldoutStyle);
        GUI.color         = Color.white;
        if (script.FoldRender)
        {
            EditorGUILayout.BeginHorizontal();
            script.AllGrassObjectsCombined = EditorGUILayout.Toggle("", script.AllGrassObjectsCombined, GUILayout.Width(14));
            EditorGUILayout.LabelField("All Grass Objects Combined");
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndVertical();

        GUILayout.Space(4);

        // update settings // we have to call it constantly to make the grass shaders work
        if (GUI.changed)
        {
            script.Update();
            SceneView.RepaintAll();
        }
    }
	public override void OnInspectorGUI () {
        SetupAFS = new SerializedObject(target);
		GetProperties();
		SetupAdvancedFoliageShader script = (SetupAdvancedFoliageShader)target;

//	///////////////////////////////////////////////////
//	Style Settings
		// Colors for Pro
		Color myCol = new Color(.5f, .8f, .0f, 1f); // Light Green // new Color(.6f, .9f, .22f, 1f); // Light Green
		Color myBgCol = myCol; //new Color(.5f, .75f, .24f, 1f);
		Color SplitterCol = new Color(1f, 1f, 1f, 0.075f);
		Color SplitterCol1 = new Color(.6f, .9f, .22f, .005f);
		// Colors for Indie
		if (!EditorGUIUtility.isProSkin) {
			myCol = new Color(0.05f,0.45f,0.0f,1.0f); // Dark Green
			myBgCol = new Color(0.94f,0.94f,0.94f,1.0f);
			SplitterCol = new Color(0f, 0f, 0f, 0.125f);
			SplitterCol1 = new Color(1f, 1f, 1f, 0.5f);
		}
		//Color myBlue = new Color(0.5f,0.7f,1.0f,1.0f);

		// Custom Foldout
		GUIStyle myFoldoutStyle = new GUIStyle(EditorStyles.foldout);
		myFoldoutStyle.fontStyle = FontStyle.Bold;
		myFoldoutStyle.fontSize = 12;

		myFoldoutStyle.normal.textColor = myCol;
		myFoldoutStyle.onNormal.textColor = myCol;
		//myFoldoutStyle.hover.textColor = Color.white;
		//myFoldoutStyle.onHover.textColor = Color.white;
		myFoldoutStyle.active.textColor = myCol;
		myFoldoutStyle.onActive.textColor = myCol;
		myFoldoutStyle.focused.textColor = myCol;
		myFoldoutStyle.onFocused.textColor = myCol;

		GUIStyle myRegularFoldoutStyle = new GUIStyle(myFoldoutStyle);
		myRegularFoldoutStyle.fontStyle = FontStyle.Normal;

		// Custom Label
		GUIStyle myLabel = new GUIStyle(EditorStyles.label);
		myLabel.normal.textColor = myCol;
		myLabel.onNormal.textColor = myCol;

		// Default icon Size
		EditorGUIUtility.SetIconSize( new Vector2(16,16));

		// Help Boxes
		//GUIStyle helpBoxes = GUI.skin.GetStyle("HelpBox");
		//RectOffset helpOffeset = new RectOffset(2, 3, 10, 10);
		//helpBoxes.richText = true;
		//helpBoxes.fontSize = 10;
		//helpBoxes.padding = helpOffeset;


//	///////////////////////////////////////////////////
		//CheckShaderFeatures ();

		MainCamera = Camera.main;
		if (MainCamera != null) {
			if(MainCamera.actualRenderingPath == RenderingPath.DeferredShading && !disableFoginShader.boolValue) {
				GUI.backgroundColor = Color.red;
				EditorGUILayout.HelpBox("Your Main Camera uses deferred shading but the AFS shaders still apply fog. That might end up in fog being applied two times to all plants and leaves.\nYou may want to update the shaders using the Fog Settings.", MessageType.Error, true);
				GUI.backgroundColor = Color.white;
			}
			GUILayout.Space(4);
		}

//	///////////////////////////////////////////////////
//	Lighting settings
		GUILayout.Space(4);
		GUI.backgroundColor = myBgCol;
		EditorGUILayout.BeginVertical("Box");
		// Foldout incl. Icon
		EditorGUILayout.BeginHorizontal();
			GUILayout.Space(-2);
			EditorGUI.indentLevel++;
			EditorGUILayout.BeginVertical();
				script.FoldLighting = EditorGUILayout.Foldout(script.FoldLighting, "Lighting Settings", myFoldoutStyle);
			EditorGUILayout.EndVertical();
			EditorGUI.indentLevel--;
			EditorGUILayout.BeginVertical(GUILayout.Width(20) );
				// Label needs width!
				EditorGUILayout.LabelField(new GUIContent(icnLight), GUILayout.Width(20), GUILayout.Height(20));
			EditorGUILayout.EndVertical();
			GUI.backgroundColor = Color.white;
		EditorGUILayout.EndHorizontal();
		GUILayout.Space(-2);
		EditorGUILayout.EndVertical();
		// FoldoutContent
		if (script.FoldLighting) {
			GUILayout.Space(-5);
			EditorGUILayout.BeginVertical("Box");
				DrawSplitter1(EditorGUILayout.GetControlRect(false, 4), SplitterCol1);
				EditorGUILayout.BeginHorizontal();
					GUILayout.Space(13);
					EditorGUILayout.BeginVertical();
						EditorGUILayout.LabelField("General Lighting Settings", myLabel);
						GUILayout.Space(2);
						EditorGUILayout.PropertyField(DirectionalLightReference, new GUIContent("Sun") );
						GUILayout.Space(6);
						EditorGUILayout.LabelField("Grass Lighting Settings", myLabel);
						if (DirectionalLightReference.objectReferenceValue == null) {
							GUI.enabled = false;
							GrassApproxTrans.boolValue = false;	
						}
						EditorGUILayout.BeginHorizontal();
							EditorGUILayout.PropertyField(GrassApproxTrans, GUIContent.none, GUILayout.Width(14) );
							EditorGUILayout.LabelField("Approximate Translucency on Grass");
						EditorGUILayout.EndHorizontal();
						if(GrassApproxTrans.boolValue){
							EditorGUILayout.HelpBox("Make sure you have assigned the 'Combined Normal/Translucency/Smoothness map' in the 'Terrain Vegetation Settings' below from which the translucency values will be picked.", MessageType.Warning, true);
						}
						GUI.enabled = true;

						//
						GUILayout.Space(6);
						EditorGUILayout.LabelField("Foliage specular Lighting Settings", myLabel);
						EditorGUI.BeginChangeCheck();
						specFade.x = EditorGUILayout.Slider("Specular Range", AfsSpecFade.vector2Value.x, 0.0f, 100.0f);
						specFade.y = EditorGUILayout.Slider("Specular Fade Lenght", AfsSpecFade.vector2Value.y, 0.0f, 100.0f);
						if (EditorGUI.EndChangeCheck()) {
							AfsSpecFade.vector2Value = specFade;
						}
						//
						GUILayout.Space(6);
						EditorGUILayout.LabelField("Tree Lighting Settings", myLabel);
						toolTip = "Fade length for translucency and real time shadows.";
						EditorGUILayout.PropertyField(BillboardFadeLenght, new GUIContent("Lighting Fade Length", toolTip) );
						//
					EditorGUILayout.EndVertical();
				EditorGUILayout.EndHorizontal();
				GUILayout.Space(2);
				EditorGUILayout.EndVertical();
		}

//	///////////////////////////////////////////////////
//	Wind settings
		GUILayout.Space(4);
		GUI.backgroundColor = myBgCol;
		EditorGUILayout.BeginVertical("Box");
		// Foldout incl. Icon
		EditorGUILayout.BeginHorizontal();
			GUILayout.Space(-2);
			EditorGUI.indentLevel++;
			EditorGUILayout.BeginVertical();
				script.FoldWind  = EditorGUILayout.Foldout(script.FoldWind, "Wind Settings", myFoldoutStyle);
			EditorGUILayout.EndVertical();
			EditorGUI.indentLevel--;
			EditorGUILayout.BeginVertical(GUILayout.Width(20) );
				// Label needs width!
				EditorGUILayout.LabelField(new GUIContent(icnWind), GUILayout.Width(20), GUILayout.Height(20));
			EditorGUILayout.EndVertical();
			GUI.backgroundColor = Color.white;
		EditorGUILayout.EndHorizontal();
		GUILayout.Space(-2);
		EditorGUILayout.EndVertical();
		// FoldoutContent
		if (script.FoldWind) {
			GUILayout.Space(-5);
			EditorGUILayout.BeginVertical("Box");
				DrawSplitter1(EditorGUILayout.GetControlRect(false, 4), SplitterCol1);
				EditorGUILayout.BeginHorizontal();
					GUILayout.Space(13);
					EditorGUILayout.BeginVertical();
						EditorGUILayout.LabelField("General Wind Settings", myLabel);
						GUILayout.Space(2);
						GUILayout.Label ("Wind Direction (XYZ) Strength (W)");
						tempWind = Wind.vector4Value;
						if (SyncWindDir.boolValue) {
							//GUILayout.Space(2);
							EditorGUILayout.BeginHorizontal();
								GUI.enabled = false;
									Vector3 temtempwind = new Vector3(tempWind.x, tempWind.y, tempWind.z);
										temtempwind = EditorGUILayout.Vector3Field("", temtempwind);
								GUI.enabled = true;
								EditorGUILayout.BeginHorizontal(GUILayout.MaxWidth(120));
									GUILayout.Label ("W", GUILayout.MaxWidth(14));
										EditorGUI.BeginChangeCheck();
										//tempWind.w = EditorGUILayout.FloatField("", tempWind.w, GUILayout.MaxWidth(104));
										tempWind.w = EditorGUILayout.Slider("", tempWind.w, 0.0f, 1.0f, GUILayout.MaxWidth(115));
										if (EditorGUI.EndChangeCheck()) {
											Wind.vector4Value = tempWind;
										}
								EditorGUILayout.EndHorizontal();	
							EditorGUILayout.EndHorizontal(); 
						}
						else {
							GUILayout.Space(-14);
							EditorGUI.BeginChangeCheck();
							tempWind = EditorGUILayout.Vector4Field("", Wind.vector4Value);
							if (EditorGUI.EndChangeCheck()) {
								Wind.vector4Value = tempWind;
							}
							GUILayout.Space(2);
						}
						EditorGUILayout.BeginHorizontal();
							EditorGUILayout.PropertyField(SyncWindDir, GUIContent.none, GUILayout.Width(14) );
							EditorGUILayout.LabelField("Sync Wind Direction to Rotation");
						EditorGUILayout.EndHorizontal();

						GUILayout.Space(4);
						toolTip = "Frequency the wind changes over time. Effects grass and foliage.";
						EditorGUILayout.PropertyField(WindFrequency, new GUIContent("Wind Frequency", toolTip) );
						
						GUILayout.Space(6);
						GUILayout.Label ("Wind Settings for Foliage Shaders", myLabel);
						GUILayout.Space(2);
						toolTip = "The shader adds some variation to the bending taking the vertex position in world space and the 'Wave Size Foliage' "+
							"parameter into account. So smaller wave sizes will add more variety to a given area but also lead to slightly different amounts of bending on each vertex even of a single mesh. This might cause some strange distortion of your models – especially large models. " +
							"For this reason you should set the 'Wave Size' to at least 2 or even 3 times the bounding box size of the largest model.";
						EditorGUILayout.PropertyField(WaveSizeFoliageShader, new GUIContent("Wave Size Foliage", toolTip) );
						toolTip = "Factor the original frequency of the secondary bending gets multiplied with. It determines the max frequency leaves might bend in when effected by strong winds.";
						EditorGUILayout.PropertyField(LeafTurbulenceFoliageShader, new GUIContent("Leaf Turbulence", toolTip) );
						GUILayout.Space(6);
						GUILayout.Label ("Wind Settings for Grass Shaders", myLabel);
						GUILayout.Space(2);
						
						toolTip = "Factor to make the main bending of the grass fit the bending of the foliage. " +
							"Effects both: grass placed manually and grass placed within the terrain engine (if you use the 'atsVxx.WavingGrass vertexAlpha' shader).";
						EditorGUILayout.PropertyField(WindMultiplierForGrassshader, new GUIContent("Main Wind Strength", toolTip) );

						toolTip = "Similar to the 'Wave Size Foliage' parameter, but as grass models usually are pretty small even low values might look good. "+
							"It effects both: grass placed manually and grass placed within the terrain engine (if you use the 'AfsGrassShader Terrain' shader).";
						EditorGUILayout.PropertyField(WaveSizeForGrassshader, new GUIContent("Wind Jitter Wave Size", toolTip) );

						toolTip = "Defines the Speed of the second wind animation that is added on top and gives you some more natural disturbance.";
						EditorGUILayout.PropertyField(WindJitterFrequencyForGrassshader, new GUIContent("Wind Jitter Frequency", toolTip) );

						toolTip = "Defines the Scale of the second wind animation that is added on top.";
						EditorGUILayout.PropertyField(WindJitterScaleForGrassshader, new GUIContent("Wind Jitter Amplitude", toolTip) );

						GUILayout.Space(6);
						GUILayout.Label ("Wind Multipliers for Tree Creator Shaders", myLabel);
						GUILayout.Space(2);

						toolTip = "Adjust bending of the tree creator shaders to match speedtree.";
						EditorGUILayout.PropertyField(WindMuliplierForTreeShaderPrimary, new GUIContent("Primary Bending", toolTip) );
						EditorGUILayout.PropertyField(WindMuliplierForTreeShaderSecondary, new GUIContent("Secondary Bending", toolTip) );
						Vector4 tempTreeWind = new Vector4(0.0f, 0.0f, WindMuliplierForTreeShaderPrimary.floatValue, WindMuliplierForTreeShaderSecondary.floatValue);
						WindMuliplierForTreeShader.vector4Value = tempTreeWind;


					EditorGUILayout.EndVertical();
				EditorGUILayout.EndHorizontal();
				GUILayout.Space(2);
				EditorGUILayout.EndVertical();
		}

//	///////////////////////////////////////////////////
//	Rain settings
		GUILayout.Space(4);
		GUI.backgroundColor = myBgCol;
		EditorGUILayout.BeginVertical("Box");
			// Foldout incl. Icon
			EditorGUILayout.BeginHorizontal();
				GUILayout.Space(-2);
				EditorGUI.indentLevel++;
				EditorGUILayout.BeginVertical();
					script.FoldRain  = EditorGUILayout.Foldout(script.FoldRain, "Rain Settings", myFoldoutStyle);
				EditorGUILayout.EndVertical();
				EditorGUI.indentLevel--;
				EditorGUILayout.BeginVertical(GUILayout.Width(20) );
					// Label needs width!
					EditorGUILayout.LabelField(new GUIContent(icnRain), GUILayout.Width(20), GUILayout.Height(20));
				EditorGUILayout.EndVertical();
				GUI.backgroundColor = Color.white;
			EditorGUILayout.EndHorizontal();
			GUILayout.Space(-2);
		EditorGUILayout.EndVertical();
		// FoldoutContent
		if (script.FoldRain) {
			GUILayout.Space(-5);
			EditorGUILayout.BeginVertical("Box");
				DrawSplitter1(EditorGUILayout.GetControlRect(false, 4), SplitterCol1);
				EditorGUILayout.BeginHorizontal();
					GUILayout.Space(13);
					EditorGUILayout.PropertyField(RainAmount, new GUIContent("Rain Amount") );
				EditorGUILayout.EndHorizontal();
			EditorGUILayout.EndVertical();
		}

//	///////////////////////////////////////////////////
//	Terrain Vegetation Settings	
		GUILayout.Space(4);
		GUI.backgroundColor = myBgCol;
		EditorGUILayout.BeginVertical("Box");
		// Foldout incl. Icon
		EditorGUILayout.BeginHorizontal();
			GUILayout.Space(-2);
			EditorGUI.indentLevel++;
			EditorGUILayout.BeginVertical();
				script.FoldVegTerrain  = EditorGUILayout.Foldout(script.FoldVegTerrain, "Terrain Vegetation Settings", myFoldoutStyle);
			EditorGUILayout.EndVertical();
			EditorGUI.indentLevel--;
			EditorGUILayout.BeginVertical(GUILayout.Width(20) );
				// GUILayout.Space(2);
				// Label needs width!
				EditorGUILayout.LabelField(new GUIContent(icnTerr), GUILayout.Width(20), GUILayout.Height(20));
			EditorGUILayout.EndVertical();
			GUI.backgroundColor = Color.white;
		EditorGUILayout.EndHorizontal();
		GUILayout.Space(-2);
		EditorGUILayout.EndVertical();
		// FoldoutContent
		if (script.FoldVegTerrain) {
			GUILayout.Space(-5);
			EditorGUILayout.BeginVertical("Box");
				DrawSplitter1(EditorGUILayout.GetControlRect(false, 4), SplitterCol1);
				EditorGUILayout.BeginHorizontal();
					GUILayout.Space(13);

					EditorGUILayout.BeginVertical();
						// General Billboard settings
						EditorGUILayout.LabelField("Sync Settings to Terrain", myLabel);
						GUILayout.Space(2);
					
						EditorGUILayout.BeginHorizontal();
							//script.AutoSyncToTerrain = EditorGUILayout.Toggle("", script.AutoSyncToTerrain, GUILayout.Width(14) );
							EditorGUILayout.PropertyField(AutoSyncToTerrain, GUIContent.none, GUILayout.Width(14) );
							EditorGUILayout.LabelField("Automatically sync with Terrain");
						EditorGUILayout.EndHorizontal();
					
						if(AutoSyncToTerrain.boolValue) {
							EditorGUILayout.PropertyField(SyncedTerrain, new GUIContent("Specify Terrain") );
							if(SyncedTerrain.objectReferenceValue != null){
								GUI.enabled = false;
							}
							else {
								EditorGUILayout.HelpBox("Please assign a terrain.", MessageType.Warning, true);
							}
						}
						GUILayout.Space(4);
							toolTip = "The distance (from camera) at which 3D tree objects will be replaced by billboard images (should fit your terrain’s settings).";
						EditorGUILayout.PropertyField(BillboardStart, new GUIContent("Billboard Start", toolTip));
						//if(TreeBillboardShadows.boolValue){
						//	GUI.enabled = true;
						//}
						GUI.enabled = true;
						
						if(AutoSyncToTerrain.boolValue) {
							GUI.enabled = false;
						}
							toolTip = "The distance (from camera) towards which grass will fade out (should fit your terrain’s settings).";
						EditorGUILayout.PropertyField(DetailDistanceForGrassShader, new GUIContent("Grass Fadeout Distance", toolTip));
							toolTip = "Overall color tint applied to grass objects (should fit your terrain’s settings).";
						EditorGUILayout.PropertyField(GrassWavingTint, new GUIContent("Grass Waving Tint", toolTip));
						if(AutoSyncToTerrain.boolValue) {
							GUI.enabled = true;
						}

						EditorGUILayout.BeginVertical();
							// General Vegetation settings
							GUILayout.Space(6);
							EditorGUILayout.LabelField("Terrain Detail Vegetation Settings", myLabel);
							GUILayout.Space(2);
								toolTip = "Cut off value for all models placed as 'detail mesh' using the built in terrain engine.";
							EditorGUILayout.PropertyField(VertexLitAlphaCutOff, new GUIContent("Alpha Cut Off", toolTip));
								toolTip = "Translucency Color for all models placed as 'detail mesh' using the built in terrain engine.";
							EditorGUILayout.PropertyField(VertexLitTranslucencyColor, new GUIContent("Translucency Color", toolTip));
								toolTip = "Translucency view dependency for all models placed as 'detail mesh' using the built in terrain engine.";
							EditorGUILayout.PropertyField(VertexLitTranslucencyViewDependency, new GUIContent("Translucency View Dependency", toolTip));
							//EditorGUILayout.PropertyField(VertexLitShadowStrength, new GUIContent("Shadow Strength") );
								toolTip = "Specular Reflectivity for all models placed as 'detail mesh' using the built in terrain engine.";
							EditorGUILayout.PropertyField(VertexLitSpecularReflectivity, new GUIContent("Specular Reflectivity", toolTip));
							//script.TerrainBendingMode = (TerrainBendingModes)EditorGUILayout.EnumPopup("Bending Parameters", script.TerrainBendingMode);
							GUILayout.Space(4);
							EditorGUILayout.BeginHorizontal();
								EditorGUI.BeginChangeCheck();
								tempTex = (Texture2D)EditorGUILayout.ObjectField(TerrainFoliageNrmSpecMap.objectReferenceValue, typeof(Texture2D), false, GUILayout.MinHeight(64), GUILayout.MinWidth(64), GUILayout.MaxWidth(64));
								if (EditorGUI.EndChangeCheck()) {
									TerrainFoliageNrmSpecMap.objectReferenceValue = tempTex;
								}
								EditorGUILayout.LabelField("Combined Normal/Translucency/Smoothness Map");
							EditorGUILayout.EndHorizontal();
							GUILayout.Space(2);
						EditorGUILayout.EndVertical();
					EditorGUILayout.EndVertical();
				EditorGUILayout.EndHorizontal();
			EditorGUILayout.EndVertical();
		}
		
//	///////////////////////////////////////////////////
//	Tree and Billboard settings
		GUILayout.Space(4);
		GUI.backgroundColor = myBgCol;
		EditorGUILayout.BeginVertical("Box");
		// Foldout incl. Icon
		EditorGUILayout.BeginHorizontal();
			GUILayout.Space(-2);
			EditorGUI.indentLevel++;
			EditorGUILayout.BeginVertical();
				script.FoldBillboard  = EditorGUILayout.Foldout(script.FoldBillboard, "Tree and Billboard Settings", myFoldoutStyle);
			EditorGUILayout.EndVertical();
			EditorGUI.indentLevel--;
			EditorGUILayout.BeginVertical(GUILayout.Width(20) );
				// GUILayout.Space(2);
				// Label needs width!
				EditorGUILayout.LabelField(new GUIContent(icnTree), GUILayout.Width(20), GUILayout.Height(20));
			EditorGUILayout.EndVertical();
			GUI.backgroundColor = Color.white;
		EditorGUILayout.EndHorizontal();
		GUILayout.Space(-2);
		EditorGUILayout.EndVertical();
		// FoldoutContent
		if (script.FoldBillboard) {
			GUILayout.Space(-5);
			EditorGUILayout.BeginVertical("Box");
				DrawSplitter1(EditorGUILayout.GetControlRect(false, 4), SplitterCol1);
				EditorGUILayout.BeginHorizontal();
					GUILayout.Space(13);
					EditorGUILayout.BeginVertical();
					
						// Tree and Billboard Render settings
						// GUILayout.Space(4);
						EditorGUILayout.LabelField("Tree and Billboard Render Settings", myLabel);
						GUILayout.Space(2);
						//
						EditorGUILayout.BeginHorizontal();
								toolTip = "Usually tree are simply tinted with black if you set the „color variation“ > 0 while painting trees. You may replace this color by any one you like using this color field.";
							EditorGUILayout.PropertyField(TreeColor, new GUIContent("Tint Color", toolTip));
						EditorGUILayout.EndHorizontal();
						GUILayout.Space(2);
						EditorGUILayout.BeginHorizontal();
							EditorGUILayout.PropertyField(BillboardAdjustToCamera, GUIContent.none, GUILayout.Width(14) );
							EditorGUILayout.LabelField("Align Billboards to Camera");
						EditorGUILayout.EndHorizontal();
						if (BillboardAdjustToCamera.boolValue) {
								toolTip = "Defines the angle (when viewed from above) the billboard shader will fade to the 'classical' upright oriented billboards in order to reduce distortion artifacts. The standard value is '30'.";
							EditorGUILayout.PropertyField(BillboardAngleLimit, new GUIContent("Angle Limit", toolTip));
						}
						GUILayout.Space(2);
						//
							toolTip = "Instead of simply culling the billboards beyond the 'Tree distance' specified in the terrain settings you may define a length over which the billboards will be smoothly faded out.";
						EditorGUILayout.PropertyField(BillboardFadeOutLength, new GUIContent("Billboard Fade Out Length", toolTip));
						GUILayout.Space(4);
						
						// "Shaded" Billboard settings
/*						GUILayout.Space(4);
						EditorGUILayout.LabelField("Shaded Billboard Settings", myLabel);
						GUILayout.Space(2);

						EditorGUILayout.PropertyField(DirectionalLightReference, new GUIContent("Light Reference") );
						EditorGUILayout.PropertyField(BillboardShadowColor, new GUIContent("Shadow Color") );
*/

					EditorGUILayout.EndVertical();
				EditorGUILayout.EndHorizontal();
			EditorGUILayout.EndVertical();

		}

//	///////////////////////////////////////////////////
//	Fog Settings
		GUILayout.Space(4);
		EditorGUILayout.BeginVertical("Box");
		// Foldout incl. Icon
		EditorGUILayout.BeginHorizontal();
			GUILayout.Space(-2);
			EditorGUI.indentLevel++;
			EditorGUILayout.BeginVertical();
				script.FoldFog  = EditorGUILayout.Foldout(script.FoldFog, "Fog Settings", myRegularFoldoutStyle);
			EditorGUILayout.EndVertical();
			EditorGUI.indentLevel--;
			EditorGUILayout.BeginVertical(GUILayout.Width(20) );
				GUILayout.Space(3);
				// Label needs width!
				EditorGUILayout.LabelField(new GUIContent(icnFog), GUILayout.Width(20), GUILayout.Height(20));
			EditorGUILayout.EndVertical();
		EditorGUILayout.EndHorizontal();
		// FoldoutContent
		if (script.FoldFog) {
			GUILayout.Space(-2);
			DrawSplitter(EditorGUILayout.GetControlRect(false, 4), SplitterCol);
			EditorGUILayout.BeginHorizontal();
				GUILayout.Space(13);

				EditorGUILayout.BeginHorizontal();
					EditorGUILayout.PropertyField(disableFoginShader, new GUIContent(""), GUILayout.Width(14));
					GUILayout.Label("Disable Fog in all AFS Shaders using the forward path.");
				EditorGUILayout.EndHorizontal();


			/*	EditorGUILayout.BeginVertical();
					EditorGUILayout.BeginHorizontal();
						EditorGUILayout.PropertyField(AFSShader_Folder, new GUIContent("AFS Shader Path"));
					EditorGUILayout.EndHorizontal();
					EditorGUILayout.BeginHorizontal();
						EditorGUILayout.BeginVertical();
							GUILayout.Space(4);
							EditorGUI.BeginChangeCheck();
							m_fogMode = (fogMode)EditorGUILayout.EnumPopup("Fog Mode", (fogMode)AFSFog_Mode.intValue );
							if (EditorGUI.EndChangeCheck()) {
								AFSFog_Mode.intValue = (int)m_fogMode;
							}
						EditorGUILayout.EndVertical();
						if (GUILayout.Button("Update Shaders", GUILayout.MaxWidth(110) )) {
								SetFogFeatures ();
							}
					EditorGUILayout.EndHorizontal();
				EditorGUILayout.EndVertical(); */
			EditorGUILayout.EndHorizontal();
			GUILayout.Space(6);
		}
		GUILayout.Space(-2);
		EditorGUILayout.EndVertical();


//	///////////////////////////////////////////////////
//	Layer Culling Settings
		GUILayout.Space(4);
		EditorGUILayout.BeginVertical("Box");
		// Foldout incl. Icon
		EditorGUILayout.BeginHorizontal();
			GUILayout.Space(-2);
			EditorGUI.indentLevel++;
			EditorGUILayout.BeginVertical();
				script.FoldCulling  = EditorGUILayout.Foldout(script.FoldCulling, "Layer Culling Settings", myRegularFoldoutStyle);
			EditorGUILayout.EndVertical();
			EditorGUI.indentLevel--;
			EditorGUILayout.BeginVertical(GUILayout.Width(20) );
				GUILayout.Space(3);
				// Label needs width!
				EditorGUILayout.LabelField(new GUIContent(icnCulling), GUILayout.Width(20), GUILayout.Height(20));
			EditorGUILayout.EndVertical();
		EditorGUILayout.EndHorizontal();
		// FoldoutContent
		if (script.FoldCulling) {
			DrawSplitter(EditorGUILayout.GetControlRect(false, 4), SplitterCol);
			EditorGUILayout.BeginHorizontal();
				GUILayout.Space(13);
				EditorGUILayout.BeginVertical();
					EditorGUILayout.BeginHorizontal();
						EditorGUILayout.PropertyField(EnableCameraLayerCulling, GUIContent.none, GUILayout.Width(14) );
						EditorGUILayout.LabelField("Enable Layer Culling");
					EditorGUILayout.EndHorizontal();
					if (EnableCameraLayerCulling.boolValue) {
						EditorGUILayout.PropertyField(SmallDetailsDistance, new GUIContent("Small Detail Distance") );
						EditorGUILayout.PropertyField(MediumDetailsDistance, new GUIContent("Medium Detail Distance") );
					}
				EditorGUILayout.EndVertical();
			EditorGUILayout.EndHorizontal();
			GUILayout.Space(4);
		}
		GUILayout.Space(-2);
		EditorGUILayout.EndVertical();

	//	Special Render Settings
		GUILayout.Space(4);
		EditorGUILayout.BeginVertical("Box");
		// Foldout incl. Icon
		EditorGUILayout.BeginHorizontal();
			GUILayout.Space(-2);
			EditorGUI.indentLevel++;
			EditorGUILayout.BeginVertical();
				script.FoldRender  = EditorGUILayout.Foldout(script.FoldRender, "Special Render Settings", myRegularFoldoutStyle);
			EditorGUILayout.EndVertical();
			EditorGUI.indentLevel--;
			EditorGUILayout.BeginVertical(GUILayout.Width(20) );
				GUILayout.Space(3);
				// Label needs width!
				EditorGUILayout.LabelField(new GUIContent(icnCamera), GUILayout.Width(20), GUILayout.Height(20));
			EditorGUILayout.EndVertical();
		EditorGUILayout.EndHorizontal();
		// FoldoutContent
		if (script.FoldRender) {
			DrawSplitter(EditorGUILayout.GetControlRect(false, 4), SplitterCol);
			EditorGUILayout.BeginHorizontal();
				GUILayout.Space(13);
				EditorGUILayout.BeginVertical();
					EditorGUILayout.BeginHorizontal();
						EditorGUILayout.PropertyField(AllGrassObjectsCombined, GUIContent.none, GUILayout.Width(14) );
						EditorGUILayout.LabelField("All Grass Objects Combined");
					EditorGUILayout.EndHorizontal();
				EditorGUILayout.EndVertical();
			EditorGUILayout.EndHorizontal();
			GUILayout.Space(4);
		}
		GUILayout.Space(-2);
		EditorGUILayout.EndVertical();
		GUILayout.Space(4);

//	////////////////////////
		SetupAFS.ApplyModifiedProperties();
	}
 private void Awake()
 {
     this.afs = GameObject.FindWithTag("Afs").GetComponent<SetupAdvancedFoliageShader>();
     this.WindIntensity = 0f;
     this.UpdateFoliageShaderWind();
     this.windGustIntervalTimer = UnityEngine.Random.Range(15f, 120f);
     if (Application.isPlaying)
     {
         Shader.WarmupAllShaders();
     }
     this.OceanH = GameObject.FindWithTag("OceanHeight").transform;
     base.InvokeRepeating("ChangeFogAmount", 500f, 600f);
     base.InvokeRepeating("ChangeMoonLight", 10f, 10f);
 }