void OnPreRender() { #if UNITY_EDITOR UpdateParams(); if (ThisCamera == null) { ThisCamera = gameObject.GetComponent <Camera>(); } #endif if (_Downsample > 0 && _FogVolumeCamera) { SurrogateMaterial.SetInt("_SrcBlend", (int)_BlendMode); Shader.EnableKeyword("_FOG_LOWRES_RENDERER"); Shader.DisableKeyword("RENDER_SCENE_VIEW"); // Profiler.BeginSample("FogVolume Render"); _FogVolumeCamera.Render(); // Profiler.EndSample(); // TexelUpdate(); if (!RenderableInSceneView) { Shader.EnableKeyword("RENDER_SCENE_VIEW"); } Shader.DisableKeyword("_FOG_LOWRES_RENDERER"); } else { Shader.DisableKeyword("_FOG_LOWRES_RENDERER"); Shader.DisableKeyword("RENDER_SCENE_VIEW"); } }
void OnPreRender() { int InitialpixelLights = QualitySettings.pixelLightCount; ShadowQuality InitialShadows = QualitySettings.shadows; QualitySettings.pixelLightCount = 0; QualitySettings.shadows = ShadowQuality.Disable; #if UNITY_EDITOR UpdateParams(); if (ThisCamera == null) { ThisCamera = gameObject.GetComponent <Camera>(); } #endif if (_Downsample > 1 && _FogVolumeCamera) { SurrogateMaterial.SetInt("_SrcBlend", (int)_BlendMode); Shader.EnableKeyword("_FOG_LOWRES_RENDERER"); // Profiler.BeginSample("FogVolume Render"); _FogVolumeCamera.Render(); // Profiler.EndSample(); // TexelUpdate(); Shader.DisableKeyword("_FOG_LOWRES_RENDERER"); } else { Shader.DisableKeyword("_FOG_LOWRES_RENDERER"); } QualitySettings.pixelLightCount = InitialpixelLights; QualitySettings.shadows = InitialShadows; }