void Start() { fog = Camera.main.GetComponent <GlobalFog>(); trigger.OnMagicTriggerStayOneTime += ToggleForward; trigger.OnNegativeMagicTriggerStayOneTime += ToggleBackward; }
protected override void InitValue() { slider.value = Convert.ToInt32(GameSettings.Instance.rendering.fog); valueLabel.text = GameSettings.Instance.rendering.fog.ToString(); RenderSettings.fog = GameSettings.Instance.rendering.fog; fogComponent = cam.GetComponent <GlobalFog>(); fogComponent.enabled = GameSettings.Instance.rendering.fog; }
private void OnLowFps() { GlobalFog globalFog = ff9.world.GlobalFog; globalFog.enabled = false; ff9.world.Settings.EnableFog = true; RenderSettings.fog = true; }
public UnderwaterFog() { mainCamera = GameManager.Instance.MainCamera; globalFog = mainCamera.GetComponent <GlobalFog>(); globalFog.enabled = true; sky = GameManager.Instance.SkyRig; waterFogColor = new Color(0.25f, 0.55f, 0.79f, 1); fogDensityMin = 0f; fogDensityMax = 0.23f; }
public static void Setup() { try { globalFogEffect = Util.GetComponentVar <GlobalFog, GlobalFogDef>(globalFogEffect); } catch (Exception e) { Debug.Log("Can't set fog!"); Debug.LogError(e); } }
public static void InitMemberByInstance(GlobalFog fog) { fogMode = fog.fogMode; globalDensity = fog.globalDensity; height = fog.height; heightScale = fog.heightScale; startDistance = fog.startDistance; globalFogColor = fog.globalFogColor; texGlobalFogColor.SetPixel(0, 0, globalFogColor); texGlobalFogColor.Apply(); }
void OnSetState(TankControlState ts) { tankControlState = ts; if (tankControlState == TankControlState.AutoDrive) { GetComponent <TankSpecialCameraController>().enabled = false; GetComponent <TankCanonBehaviour>().enabled = false; foreach (UserInfoClass a in GlobalInfo.userInfoList) { if (a.playerViewID.Equals(networkView.viewID)) { nam = a.name; } } } else { aimCross = (Texture)Resources.Load("GUI/GunSights/TankGunSight"); v_AimCross = (Texture)Resources.Load("GUI/GunSights/W_1"); h_AimCross = (Texture)Resources.Load("GUI/GunSights/W_2"); aimCrossPos = new Vector2(Screen.width / 2.0f, Screen.height / 2.0f); camPos = Camera.main.transform; GlobalInfo.playerCamera = Camera.main; sm = camPos.GetComponent <SmoothFollow>(); sm.enabled = true; sm.target = transform; sm.distance = camDistance; sm.height = camHeight; df = camPos.GetComponent <DepthOfField34>(); df.enabled = false; urc = camPos.GetComponent <UltraRedRayCamera>(); urc.enabled = false; Camera.main.SendMessage("OnSetWather", SendMessageOptions.DontRequireReceiver); gf = camPos.GetComponent <GlobalFog>(); GameObject go = GameObject.Find("Snow"); if (go != null) { for (int i = 0; i < 4; i++) { camPos.GetChild(i).particleEmitter.emit = true; } } go = GameObject.Find("Rain"); if (go != null) { for (int i = 0; i < 4; i++) { camPos.GetChild(i).particleEmitter.emit = true; } } } }
// Use this for initialization void Start() { if (networkView.isMine) { GlobalInfo.playerCamera = cam.camera; aimCross = (Texture)Resources.Load("GUI/GunSights/HeliGunSight"); aimCrossPos = new Vector2(Screen.width / 2.0f, Screen.height / 2.0f); GlobalFog gf = Camera.main.GetComponent <GlobalFog>(); GlobalFog gf1 = cam.gameObject.AddComponent <GlobalFog>(); gf1.globalDensity = 0.05f; if (GlobalInfo.fogFlag) { gf1.fogMode = gf.fogMode; gf1.fogShader = gf.fogShader; gf1.globalDensity = 0.15f; gf1.globalFogColor = gf.globalFogColor; gf1.height = gf.height; gf1.heightScale = gf.heightScale; gf1.startDistance = gf.startDistance; } GameObject go = GameObject.Find("Snow"); if (go != null) { for (int i = 0; i < 4; i++) { go = (GameObject)GameObject.Instantiate(snowParticle, Vector3.zero, Quaternion.identity); go.transform.parent = cam; go.transform.localPosition = Camera.main.transform.GetChild(i).localPosition; Camera.main.transform.GetChild(i).particleEmitter.emit = false; } } go = GameObject.Find("Rain"); if (go != null) { for (int i = 0; i < 4; i++) { go = (GameObject)GameObject.Instantiate(rainParticle, Vector3.zero, Quaternion.identity); go.transform.parent = cam; go.transform.localPosition = Camera.main.transform.GetChild(i).localPosition; Camera.main.transform.GetChild(i).particleEmitter.emit = false; } } cam.GetComponent <ColorCorrectionCurves> ().saturation = Camera.main.GetComponent <ColorCorrectionCurves> ().saturation; } else { cam.gameObject.SetActive(false); enabled = false; return; } }
public UnderwaterFog() { mainCamera = GameManager.Instance.MainCamera; globalFog = mainCamera.GetComponent <GlobalFog>(); globalFog.enabled = true; sky = GameManager.Instance.SkyRig; waterFogColor = new Color(0.25f, 0.55f, 0.79f, 1); fogDensityMin = 0f; fogDensityMax = 0.23f; // get initial (backup) values - will be overwritten (this is just a safety net mechanism so we start out with some values) originalFogMode = RenderSettings.fogMode; originalFogDensity = RenderSettings.fogDensity; originalFogStartDistance = RenderSettings.fogStartDistance; originalFogEndDistance = RenderSettings.fogEndDistance; originalFogColor = RenderSettings.fogColor; }
void Start() { if (playerEnterExit == null) { playerEnterExit = GameManager.Instance.PlayerEnterExit; } if (mainCamera == null) { mainCamera = GameManager.Instance.MainCamera; } if (mainCamera != null) { globalFog = mainCamera.GetComponent <GlobalFog>(); } }
private void UpdateCheckingLowEndAndroidDevices() { if (Application.platform != RuntimePlatform.Android) { return; } GlobalFog globalFog = ff9.world.GlobalFog; if (!globalFog.enabled) { FF9StateSystem.World.HasLowFpsOnDevice = true; } if (FF9StateSystem.World.HasLowFpsOnDevice) { this.OnLowFps(); return; } }
public void Start() { Weather weather = FindObjectOfType <Weather>(); if (weather != null) { //set fog gradient GlobalFog f = FindObjectOfType <GlobalFog>(); f.fogGradient = weather.transform.FindChild("FogGradient").GetComponent <GradientToTexture>(); f.applyGradient(); //set skybox RenderSettings.skybox = weather.skybox; } storage = FindObjectOfType <PhotoStorage>(); fog = FindObjectOfType <GlobalFog>(); fogDefault = fog.endDistance; fog.endDistance = 0; }
public override void OnRenderImage(RenderTexture source, RenderTexture destination) { if (!this.CheckResources()) { Graphics.Blit(source, destination); } else { this.CAMERA_NEAR = this.camera.nearClipPlane; this.CAMERA_FAR = this.camera.farClipPlane; this.CAMERA_FOV = this.camera.fieldOfView; this.CAMERA_ASPECT_RATIO = this.camera.aspect; Matrix4x4 identity = Matrix4x4.identity; Vector4 vector = default(Vector4); Vector3 vector2 = default(Vector3); float num = this.CAMERA_FOV * 0.5f; Vector3 b = this.camera.transform.right * this.CAMERA_NEAR * Mathf.Tan(num * 0.0174532924f) * this.CAMERA_ASPECT_RATIO; Vector3 b2 = this.camera.transform.up * this.CAMERA_NEAR * Mathf.Tan(num * 0.0174532924f); Vector3 vector3 = this.camera.transform.forward * this.CAMERA_NEAR - b + b2; float num2 = vector3.magnitude * this.CAMERA_FAR / this.CAMERA_NEAR; vector3.Normalize(); vector3 *= num2; Vector3 vector4 = this.camera.transform.forward * this.CAMERA_NEAR + b + b2; vector4.Normalize(); vector4 *= num2; Vector3 vector5 = this.camera.transform.forward * this.CAMERA_NEAR + b - b2; vector5.Normalize(); vector5 *= num2; Vector3 vector6 = this.camera.transform.forward * this.CAMERA_NEAR - b - b2; vector6.Normalize(); vector6 *= num2; identity.SetRow(0, vector3); identity.SetRow(1, vector4); identity.SetRow(2, vector5); identity.SetRow(3, vector6); this.fogMaterial.SetMatrix("_FrustumCornersWS", identity); this.fogMaterial.SetVector("_CameraWS", this.camera.transform.position); this.fogMaterial.SetVector("_StartDistance", new Vector4(1f / this.startDistance, num2 - this.startDistance)); this.fogMaterial.SetVector("_Y", new Vector4(this.height, 1f / this.heightScale)); this.fogMaterial.SetFloat("_GlobalDensity", this.globalDensity * 0.01f); this.fogMaterial.SetColor("_FogColor", this.globalFogColor); GlobalFog.CustomGraphicsBlit(source, destination, this.fogMaterial, (int)this.fogMode); } }
public void Apply() { Executor.Sky.SkyColor = SkyColor; Executor.Sky.FogColorA = FogBrightColor; Executor.Sky.FogColorB = FogDarkColor; Executor.Sky.FogHeight = FogHeight; RenderSettings.fogMode = FogMode.Linear; RenderSettings.fogEndDistance = Mathf.Min(FogEndDistance, Executor.Settings.MaxFogEndDistance); float u = RenderSettings.fogEndDistance / FogEndDistance; RenderSettings.fogStartDistance = FogStartDistance * u; if (Executor.Underwater <= 0) { if (Executor.Settings.MainCamera != null) { Vector3 pos = Executor.Settings.MainCamera.transform.forward; pos.y = 0; RenderSettings.fogColor = Executor.Sky.FogColorAtPoint(pos, Executor.SunDirection, FogSkyInterpolator) * FogIntensity; } else { RenderSettings.fogColor = (FogDarkColor * 0.7f + FogBrightColor * 0.3f) * FogIntensity; } } else { RenderSettings.fogColor = WaterDepthColor; } Executor.Sky.UnityFogColor = RenderSettings.fogColor; Executor.Sky.SunBloomColor = SunGlowColor; Executor.Sky.SunPower = SunGlowPower; Executor.Sky.SunColor = SunBodyColor; Executor.Sky.SunSize = SunBodySize; Executor.Sky.Overcast = SkyOvercast; Executor.Sky.Apply(); Executor.Sun.SunLight.color = SunLightColor; Executor.Sun.SunLight.intensity = SunLightIntensity < SunlightIntensityBase ? SunlightIntensityBase : SunLightIntensity; Executor.SunCloudLayer.Color1 = CloudBrightColor1; Executor.SunCloudLayer.Color2 = CloudBrightColor2; Executor.SunCloudLayer.Color3 = CloudDarkColor1; Executor.SunCloudLayer.Color4 = CloudDarkColor2; Executor.RainCloudLayer.Color1 = CloudBrightColor1; Executor.RainCloudLayer.Color2 = CloudBrightColor2; Executor.RainCloudLayer.Color3 = CloudDarkColor1; Executor.RainCloudLayer.Color4 = CloudDarkColor2; Executor.RainCloudLayer.LayerMat.SetFloat("_CloudDensity", RainCloudDensity); Executor.SunCloudLayer.LayerMat.SetFloat("_CloudThreshold", Mathf.Max(RainCloudThreshold, 1.0f)); Executor.RainCloudLayer.LayerMat.SetFloat("_CloudThreshold", RainCloudThreshold); Executor.SunCloudLayer.LayerMat.SetFloat("_Overcast", RainCloudOvercast * 0.7f + 0.3f); Executor.RainCloudLayer.LayerMat.SetFloat("_Overcast", RainCloudOvercast); Executor.RainCloudLayer.LayerMat.SetFloat("_CloudTile", 7.5f); Material watermat = Executor.Settings.WaterMaterial; if (watermat != null) { if (!string.IsNullOrEmpty(Executor.Settings.WaterDepthColorProp)) { watermat.SetColor(Executor.Settings.WaterDepthColorProp, WaterDepthColor); } if (!string.IsNullOrEmpty(Executor.Settings.WaterReflectionColorProp)) { watermat.SetColor(Executor.Settings.WaterReflectionColorProp, WaterReflectionColor); } if (!string.IsNullOrEmpty(Executor.Settings.WaterFresnelColorProp)) { watermat.SetColor(Executor.Settings.WaterFresnelColorProp, WaterFresnelColor); } if (!string.IsNullOrEmpty(Executor.Settings.WaterSpecularColorProp)) { watermat.SetColor(Executor.Settings.WaterSpecularColorProp, WaterSpecularColor); } if (!string.IsNullOrEmpty(Executor.Settings.WaterFoamColorProp)) { watermat.SetColor(Executor.Settings.WaterFoamColorProp, WaterFoamColor); } if (!string.IsNullOrEmpty(Executor.Settings.WaterDepthDensityProp)) { watermat.SetVector(Executor.Settings.WaterDepthDensityProp, new Vector4(WaterDepthDensity, 0.1f, Mathf.Max(0.5f, Executor.UnderwaterDensity - 1), 0f)); } if (!string.IsNullOrEmpty(Executor.Settings.WaterReflectionBlendProp)) { watermat.SetFloat(Executor.Settings.WaterReflectionBlendProp, Mathf.Lerp(1f, WaterReflectionBlend, Executor.WaterReflectionMasterBlend)); } if (!string.IsNullOrEmpty(Executor.Settings.WaterSunLightDirProp)) { watermat.SetVector(Executor.Settings.WaterSunLightDirProp, -Executor.SunDirection); } } Executor.Sun.SunLight.shadowStrength = ShadowStrength; RenderSettings.ambientMode = UnityEngine.Rendering.AmbientMode.Trilight; RenderSettings.ambientSkyColor = AmbientSkyColor; RenderSettings.ambientEquatorColor = AmbientEquatorColor; RenderSettings.ambientGroundColor = AmbientGroundColor; RenderSettings.ambientIntensity = AmbientIntensity; if (Executor.Settings.MainCamera != null) { SunShafts ss = Executor.Settings.MainCamera.GetComponent <SunShafts>(); if (ss != null) { ss.sunTransform = Executor.Sun.SunLight.transform; ss.sunColor = SunShaftColor; ss.sunShaftIntensity = SunShaftIntensity; } Bloom bloom = Executor.Settings.MainCamera.GetComponent <Bloom>(); if (bloom != null) { bloom.bloomIntensity = BloomIntensity; bloom.bloomThreshold = BloomThreshold; } BlurOptimized blur = Executor.Settings.MainCamera.GetComponent <BlurOptimized>(); GlobalFog gf = Executor.Settings.MainCamera.GetComponent <GlobalFog>(); if (blur != null) { blur.enabled = Executor.Underwater > 0; } if (gf != null) { gf.enabled = Executor.Underwater > 0; } } Executor.UpdateCameraEffects(); }
void Awake() { playerCam = gameObject.GetComponentInChildren<Camera>(); fog = gameObject.GetComponentInChildren<GlobalFog>(); }
void InitialiseValues() { //if (EventManager.inst.currentLevel == "City Outskirts") //{ // whiteBackDrop = GameObject.Find("WhiteBackDrop").GetComponent<Image>(); //} EventManager.inst.memoryLookScalar = 1; EventManager.inst.memoryMoveScalar = 1; fadeToBlack = GameObject.Find("FadeToBlack").GetComponent<RawImage>(); waterObjs = GameObject.FindGameObjectsWithTag("Water"); if (waterObjs != null) { water = new Water[waterObjs.Length]; for (int i = 0; i < waterObjs.Length; i++) { water[i] = waterObjs[i].GetComponent<Water>(); } } if (EventManager.inst.currentLevel == "Coast") { dyingSFX = GameObject.Find("DyingSFX").GetComponent<AudioSource>(); } subUI1 = GameObject.Find("Subtitles1").GetComponent<Text>(); subUI2 = GameObject.Find("Subtitles2").GetComponent<Text>(); dialogueAudio = GameObject.Find("MemoryDialogue").GetComponent<AudioSource>(); bgmSource = GameObject.Find("BackGroundMusicSource").GetComponent<AudioSource>(); breathingSource = GameObject.Find("BreathingSFX").GetComponent<AudioSource>(); sceneLighting = GameObject.Find("Directional Light").GetComponent<Light>(); skySphere = GameObject.Find("skySphere"); memoryFlashObj = GameObject.Find("MemoryFlashObj").GetComponent<Image>(); if (EventManager.inst.currentLevel == "Coast") { endMusic = GameObject.Find("CreditsMusic").GetComponent<AudioSource>(); } gameCam = GameObject.Find("Camera").GetComponent<Camera>(); bloom = gameObject.GetComponent<BloomAndFlares>(); fog = gameObject.GetComponent<GlobalFog>(); whiteVignette = GameObject.Find("WhiteVignette"); if (whiteVignette != null) { whiteVignette.SetActive(false); } ambienceAudio = GameObject.Find("Ambience").GetComponent<AudioSource>(); ambienceAudioMaxVol = ambienceAudio.volume; bgmMaxVolume = bgmSource.volume; breathingMaxVolume = breathingSource.volume; dialogueVolume = dialogueAudio.volume; startBloom = bloom.bloomIntensity; startFog = fog.heightDensity; skipLerp = 5; if (exhaustionAudio != null) { exhaustionMaxVol = exhaustionAudio.gameObject.GetComponent<Exhaustion>().maxVol; } }
private void Start() { _fog = GetComponent<GlobalFog>(); _player = GameMainReferences.Instance.PlayerCharacter.transform; }
public void Awake() { //offset = transform.position - targetTrans.position; fog = GetComponent <GlobalFog>(); fog.startDistance = fogStartDist; }
//<summary> //Initializes the state at start //Grabs the default values and stores them into the appropriate variables //</summary> void Start() { //Cache referenced components on camera object bloom = gameObjects.mainCamera.GetComponent <Bloom>(); globalFog = gameObjects.mainCamera.GetComponent <GlobalFog>(); blur = gameObjects.mainCamera.GetComponent <BlurOptimized>(); vignette = gameObjects.mainCamera.GetComponent <VignetteAndChromaticAberration>(); noiseAndGrain = gameObjects.mainCamera.GetComponent <NoiseAndGrain>(); sunShafts = gameObjects.mainCamera.GetComponent <SunShafts>(); waterLensAudio = gameObjects.waterLens.GetComponent <AudioSource>(); airLensAudio = gameObjects.airLens.GetComponent <AudioSource>(); audioComp = GetComponent <AudioSource>(); cameraAudio = gameObjects.mainCamera.GetComponent <AudioSource>(); bubbleBehaviour = gameObjects.bubble.GetComponent <AQUAS_BubbleBehaviour>(); //Set initially active lenses gameObjects.airLens.SetActive(true); gameObjects.waterLens.SetActive(false); //Assign materials //waterLensMaterial = gameObjects.waterLens.GetComponent<Renderer> ().material; airLensMaterial = gameObjects.airLens.GetComponent <Renderer> ().material; waterPlaneMaterial = gameObjects.waterPlanes[0].GetComponent <Renderer> ().material; t = wetLens.wetTime + wetLens.dryingTime; t2 = 0; bubbleSpawnTimer = 0; //Initialize default values for --- //--- global fog defaultFog = RenderSettings.fog; defaultFogDensity = RenderSettings.fogDensity; defaultFogColor = RenderSettings.fogColor; /*if (globalFog != null) * { * globalFog.enabled = defaultFog; * }*/ //--- Some water parameters defaultFoamContrast = waterPlaneMaterial.GetFloat("_FoamContrast"); defaultSpecularity = waterPlaneMaterial.GetFloat("_Specular"); if (waterPlaneMaterial.HasProperty("_Refraction")) { defaultRefraction = waterPlaneMaterial.GetFloat("_Refraction"); } //--- image effects (if attached to the camera) if (bloom != null) { defaultBloomIntensity = bloom.bloomIntensity; } if (sunShafts != null) { defaultSunShaftsEnabled = sunShafts.enabled; } if (bloom != null) { defaultBloomEnabled = bloom.enabled; } if (blur != null) { defaultBlurEnabled = blur.enabled; } if (vignette != null) { defaultVignetteEnabled = vignette.enabled; } if (noiseAndGrain != null) { defaultNoiseEnabled = noiseAndGrain.enabled; } audioComp.clip = soundEffects.sounds[0]; audioComp.loop = true; audioComp.Stop(); airLensAudio.clip = soundEffects.sounds[1]; airLensAudio.loop = false; airLensAudio.Stop(); waterLensAudio.clip = soundEffects.sounds[2]; waterLensAudio.loop = false; waterLensAudio.Stop(); //Check if Tenkoku is in the scene if (GameObject.Find("Tenkoku DynamicSky") != null) { tenkokuObj = GameObject.Find("Tenkoku DynamicSky"); } }
void Awake() { if (EventManager.inst.currentLevel == "Coast") { exhaustion = GameObject.Find("Exhaustion"); endMemLerp = GameObject.Find("Memlookat").GetComponent<MemLookMovement>(); } dialogueAudio = GameObject.Find("MemoryDialogue").GetComponent<AudioSource>(); fog = GameObject.Find("Player").GetComponentInChildren<GlobalFog>(); // Assign string value for each level switch (levelSelect) { case LevelSelect.ONE: setLevel = "City Outskirts"; break; case LevelSelect.TWO: setLevel = "City"; break; case LevelSelect.THREE: setLevel = "Coast"; break; } }
protected override void DrawCore(RenderContext context, RenderDrawContext drawContext) { var viewport = drawContext.CommandList.Viewport; using (drawContext.PushRenderTargetsAndRestore()) { GlobalFog.PrepareFogConstantBuffer(context); // Render Shadow maps shadowMapRenderer?.Draw(drawContext); if (VRSettings.Enabled && VRSettings.VRDevice != null) { var isFullViewport = (int)viewport.X == 0 && (int)viewport.Y == 0 && (int)viewport.Width == drawContext.CommandList.RenderTarget.ViewWidth && (int)viewport.Height == drawContext.CommandList.RenderTarget.ViewHeight; if (!isFullViewport) { return; } bool hasPostEffects = PostEffects != null && PostEffects.Enabled, presentingVR = this == VRRenderers[VRRenderers.Count - 1]; Texture vrFullSurface; using (drawContext.PushRenderTargetsAndRestore()) { var currentRenderTarget = drawContext.CommandList.RenderTarget; var desiredRenderTargetSize = VRSettings.VRDevice.ActualRenderFrameSize; if (desiredRenderTargetSize.Width != currentRenderTarget.Width || desiredRenderTargetSize.Height != currentRenderTarget.Height) { drawContext.CommandList.SetRenderTargets(null, null); // force to create and bind a new render target } PrepareRenderTargets(drawContext, desiredRenderTargetSize); vrFullSurface = viewOutputTarget; //draw per eye using (context.SaveViewportAndRestore()) using (drawContext.PushRenderTargetsAndRestore()) { ViewCount = 2; for (var i = 0; i < 2; i++) { drawContext.CommandList.SetRenderTargets(currentDepthStencil, currentRenderTargets.Count, currentRenderTargets.Items); var frameSize = VRSettings.VRDevice.ActualRenderFrameSize; drawContext.CommandList.SetViewport(new Viewport(i * frameSize.Width / 2, 0, frameSize.Width / 2, frameSize.Height)); using (context.PushRenderViewAndRestore(VRSettings.RenderViews[i])) { // Clear render target and depth stencil if (i == 0) { Clear?.Draw(drawContext); } ViewIndex = i; // draw view, but skip post processing (it will not do it, since eye count > 1) DrawView(context, drawContext, i, 2); // last eye, draw post effects over both eyes if we have some if (hasPostEffects && i == 1) { if (presentingVR) { var renderTargetDescription = TextureDescription.New2D(frameSize.Width, frameSize.Height, 1, PixelFormat.R8G8B8A8_UNorm_SRgb, TextureFlags.ShaderResource | TextureFlags.RenderTarget); vrFullSurface = PushScopedResource(drawContext.GraphicsContext.Allocator.GetTemporaryTexture2D(renderTargetDescription)); } PostEffects.Draw(drawContext, OpaqueRenderStage.OutputValidator, currentRenderTargets.Items, currentDepthStencil, vrFullSurface); } } } // if we are on our last forward renderer and our scene is ready for submission if (presentingVR) { VRSettings.VRDevice.Commit(drawContext.CommandList, vrFullSurface); } } } //draw mirror if desired if (VRSettings.CopyMirror) { GameBase.ShouldPresent = true; CopyOrScaleTexture(drawContext, vrFullSurface, drawContext.CommandList.RenderTarget); } } else { GameBase.ShouldPresent = true; PrepareRenderTargets(drawContext, new Size2((int)viewport.Width, (int)viewport.Height)); ViewCount = 1; ViewIndex = 0; //var sssMaterialIndexRenderTarget = GenerateSSSMaterialIndexRenderTarget(context, viewport); using (drawContext.PushRenderTargetsAndRestore()) { drawContext.CommandList.SetRenderTargets(currentDepthStencil, currentRenderTargets.Count, currentRenderTargets.Items); // Clear render target and depth stencil Clear?.Draw(drawContext); DrawView(context, drawContext, 0, 1); } } } // Clear intermediate results currentRenderTargets.Clear(); currentRenderTargetsNonMSAA.Clear(); currentDepthStencil = null; currentDepthStencilNonMSAA = null; }
void Awake() { fog = this.GetComponent<GlobalFog>(); }
// Use this for initialization void Start() { manager = GameObject.FindWithTag("GameController"); if (numberOfCameras > 3) { cameras = GameObject.FindGameObjectsWithTag("MainCamera"); } else { cameras = new GameObject[numberOfCameras]; if (numberOfCameras == 3) { cameras[0] = startCamera; cameras[1] = secondCamera; cameras[2] = lastCamera; } else if (numberOfCameras == 1) { cameras[0] = startCamera; } Grays = new List <Grayscale>(); Sepias = new List <SepiaTone>(); Blooms = new List <Bloom>(); Fogs = new List <GlobalFog>(); Antis = new List <Antialiasing>(); DOFs = new List <DepthOfField>(); Fishes = new List <Fisheye>(); Shafts = new List <SunShafts>(); foreach (var item in cameras) { item.AddComponent <Grayscale>(); Grayscale gs = item.GetComponent <Grayscale>(); Grayscale mgs = manager.GetComponent <Grayscale>(); gs.shader = mgs.shader; gs.rampOffset = mgs.rampOffset; Grays.Add(gs); item.AddComponent <SepiaTone>(); SepiaTone st = item.GetComponent <SepiaTone>(); st.shader = manager.GetComponent <SepiaTone>().shader; Sepias.Add(st); item.AddComponent <Bloom>(); //print(name + " " + item.name); Bloom bm = item.GetComponent <Bloom>(); Bloom mbm = manager.GetComponent <Bloom>(); bm.blurAndFlaresShader = mbm.blurAndFlaresShader; bm.brightPassFilterShader = mbm.brightPassFilterShader; bm.lensFlareShader = mbm.lensFlareShader; bm.screenBlendShader = mbm.screenBlendShader; bm.bloomThreshold = mbm.bloomThreshold; bm.bloomIntensity = mbm.bloomIntensity; Blooms.Add(bm); item.AddComponent <GlobalFog>(); GlobalFog gf = item.GetComponent <GlobalFog>(); GlobalFog mgf = manager.GetComponent <GlobalFog>(); gf.fogShader = mgf.fogShader; gf.excludeFarPixels = mgf.excludeFarPixels; gf.height = mgf.height; gf.heightDensity = mgf.heightDensity; gf.startDistance = mgf.startDistance; Fogs.Add(gf); item.AddComponent <Antialiasing>(); Antialiasing ai = item.GetComponent <Antialiasing>(); Antialiasing mai = manager.GetComponent <Antialiasing>(); ai.shaderFXAAIII = mai.shaderFXAAIII; ai.ssaaShader = mai.ssaaShader; ai.edgeSharpness = mai.edgeSharpness; ai.shaderFXAAII = mai.shaderFXAAII; ai.shaderFXAAPreset2 = mai.shaderFXAAPreset2; ai.shaderFXAAPreset3 = mai.shaderFXAAPreset3; ai.dlaaShader = mai.dlaaShader; ai.nfaaShader = mai.nfaaShader; Antis.Add(ai); item.AddComponent <DepthOfField>(); DepthOfField dof = item.GetComponent <DepthOfField>(); DepthOfField mdof = manager.GetComponent <DepthOfField>(); dof.dofHdrShader = mdof.dofHdrShader; dof.dx11BokehShader = mdof.dx11BokehShader; dof.focalSize = mdof.focalSize; dof.aperture = mdof.aperture; dof.focalTransform = transform; DOFs.Add(dof); item.AddComponent <Fisheye>(); Fisheye fe = item.GetComponent <Fisheye>(); Fisheye mfe = manager.GetComponent <Fisheye>(); fe.fishEyeShader = mfe.fishEyeShader; fe.strengthX = mfe.strengthX; fe.strengthY = mfe.strengthY; Fishes.Add(fe); item.AddComponent <SunShafts>(); SunShafts ss = item.GetComponent <SunShafts>(); SunShafts mss = manager.GetComponent <SunShafts>(); ss.simpleClearShader = mss.simpleClearShader; ss.sunShaftsShader = mss.sunShaftsShader; ss.sunShaftIntensity = mss.sunShaftIntensity; ss.radialBlurIterations = mss.radialBlurIterations; ss.maxRadius = mss.maxRadius; ss.radialBlurIterations = mss.radialBlurIterations; ss.resolution = mss.resolution; ss.screenBlendMode = mss.screenBlendMode; ss.sunColor = mss.sunColor; ss.sunShaftBlurRadius = mss.sunShaftBlurRadius; ss.sunThreshold = mss.sunThreshold; ss.sunTransform = mss.sunTransform; ss.useDepthTexture = mss.useDepthTexture; Shafts.Add(ss); } foreach (Grayscale item in Grays) { item.enabled = false; } foreach (SepiaTone item in Sepias) { item.enabled = false; } foreach (Bloom item in Blooms) { item.enabled = false; } foreach (GlobalFog item in Fogs) { item.enabled = false; } foreach (DepthOfField item in DOFs) { item.enabled = false; } foreach (Antialiasing item in Antis) { item.enabled = false; } foreach (Fisheye item in Fishes) { item.enabled = false; } foreach (SunShafts item in Shafts) { item.enabled = false; } } curentKeyIndex = 0; if (SceneManager.GetActiveScene().buildIndex != 0) { setTop(); } }
void Awake() { fog = this.GetComponent <GlobalFog>(); }
void Start () { snakeSpawn = GameObject.FindGameObjectWithTag ("Snake Spawn").GetComponent<Transform> (); fogEffect = GameObject.FindObjectOfType<GlobalFog> (); UnityEngine.VR.InputTracking.Recenter(); SceneManager.SetActiveScene(SceneManager.GetSceneByName("airport")); }
public HazeProperties() : base() { m_GlobalFog = GameObject.Find("AGF_CameraManager").GetComponent<AGF_CameraManager>().GetMainCamera().GetComponent<GlobalFog>(); }
public void Initialize() { globalFog = camera.GetComponent <GlobalFog>(); }