protected override void UpdateMaterial()
        {
            base.UpdateMaterial();

            Bounds  b        = _renderer.bounds;
            Vector3 shrinker = b.size * -(1.0f - FogBoxPercentage);

            b.Expand(shrinker);
            FogMaterial.SetVector("_FogBoxMin", b.min);
            FogMaterial.SetVector("_FogBoxMax", b.max);
        }
        protected override void UpdateMaterial()
        {
            base.UpdateMaterial();

            Bounds  b        = fogRenderer.bounds;
            Vector3 shrinker = b.size * -(1.0f - FogBoxPercentage);

            b.Expand(shrinker);
            FogMaterial.SetVector("_FogBoxMin", b.min);
            FogMaterial.SetVector("_FogBoxMax", b.max);
            FogMaterial.SetVector("_FogBoxMinDir", (b.max - b.min).normalized);
            FogMaterial.SetVector("_FogBoxMaxDir", (b.min - b.max).normalized);
            fogRenderer.enabled = (FogDensity > 0.0f);
        }
        protected override void UpdateMaterial()
        {
            base.UpdateMaterial();

            Bounds  b        = fogRenderer.bounds;
            Vector3 shrinker = b.size * -(1.0f - FogSpherePercentage);

            b.Expand(shrinker);
            float   radius = transform.localScale.x * FogSpherePercentage;
            Vector4 pos    = transform.position;

            pos.w = radius * radius;
            FogMaterial.SetVector("_FogSpherePosition", pos);
            fogRenderer.enabled = (FogDensity > 0.0f);
        }
        protected override void LateUpdate()
        {
            base.LateUpdate();

            Bounds  b        = fogRenderer.bounds;
            Vector3 shrinker = b.size * -(1.0f - FogProfile.FogPercentage);

            b.Expand(shrinker);
            FogMaterial.SetVector("_FogBoxMin", b.min);
            FogMaterial.SetVector("_FogBoxMax", b.max);
            FogMaterial.SetVector("_FogBoxMinDir", (b.max - b.min).normalized);
            FogMaterial.SetVector("_FogBoxMaxDir", (b.min - b.max).normalized);
            FogMaterial.SetFloat("_FogBoxDiameter", Vector3.Distance(b.min, b.max));
            fogRenderer.enabled = (FogProfile.FogDensity > 0.0f);
        }
        private void RenderFog(RenderTexture fogRenderTexture, RenderTexture src)
        {
            if (m_EnableRayleighScattering)
            {
                ShaderFeatureHelper(FogMaterial, Shader_RAYLEIGH_SCATTERING, true);
                FogMaterial.SetFloat(ShaderIDs.RayleighScatteringCoeff, m_RayleighScatteringCoeff);
            }
            else
            {
                ShaderFeatureHelper(FogMaterial, Shader_RAYLEIGH_SCATTERING, false);
            }

            ShaderFeatureHelper(FogMaterial, Shader_LIMIT_FOG_SIZE, m_LimitFogSize);
            ShaderFeatureHelper(FogMaterial, Shader_HEIGHTFOG, m_HeightFogEnabled);

            var rmsr = CalculateRaymarchStepRation();

            FogMaterial.SetFloat(ShaderIDs.RayMarchingSteps, m_RayMarchingSteps * Mathf.Pow(rmsr, 2));
            FogMaterial.SetFloat(ShaderIDs.FogDensity, m_FogDensityCoeff);
            FogMaterial.SetFloat(ShaderIDs.NoiseScale, m_NoiseScale);

            FogMaterial.SetFloat(ShaderIDs.ExtinctionCoeff, m_ExtinctionCoeff);
            FogMaterial.SetFloat(ShaderIDs.Anisotropy, m_Anisotropy);
            FogMaterial.SetFloat(ShaderIDs.BaseHeightDensity, m_BaseHeightDensity);

            FogMaterial.SetVector(ShaderIDs.FogWorldPosition, m_FogWorldPosition);
            FogMaterial.SetFloat(ShaderIDs.FogSize, m_FogSize);
            FogMaterial.SetFloat(ShaderIDs.LightIntensity, m_LightIntensity);

            FogMaterial.SetColor(ShaderIDs.FogColor, m_Light.GetComponent <Light>().color);
            FogMaterial.SetColor(ShaderIDs.ShadowColor, m_FogInShadowColor);
            FogMaterial.SetColor(ShaderIDs.FogColor, m_UseLightColor ? m_Light.GetComponent <Light>().color : m_FogInLightColor);

            FogMaterial.SetVector(ShaderIDs.LightDir, m_Light.GetComponent <Light>().transform.forward);
            FogMaterial.SetFloat(ShaderIDs.AmbientFog, m_AmbientFog);

            FogMaterial.SetVector(ShaderIDs.FogDirection, m_WindDirection);
            FogMaterial.SetFloat(ShaderIDs.FogSpeed, m_WindSpeed);

            FogMaterial.SetTexture(ShaderIDs.BlurNoiseTexture, m_BlurNoiseTexture2D);

            Graphics.Blit(src, fogRenderTexture, FogMaterial);
        }