private void SetCommandBuffers() { if (Ocean.Instance == null) { return; } if (this.usingSharedDepthGrab) { Ocean.Instance.UnderWater.DisableCopyDepthCmd = true; DepthBufferGrabCommand.AddBinding(Camera.main, Ocean.DEPTH_GRAB_TEXTURE_NAME); } else { Ocean.Instance.UnderWater.DisableCopyDepthCmd = false; DepthBufferGrabCommand.RemoveBinding(Camera.main, Ocean.DEPTH_GRAB_TEXTURE_NAME); } if (this.disableCaustics) { Ocean.Instance.UnderWater.DisableNormalFadeCmd = true; } else { Ocean.Instance.UnderWater.DisableNormalFadeCmd = false; } }
private void RenderDepth(Camera camera) { if (DepthBufferGrabCommand.HasCamera(camera) && this.usingSharedDepthGrab) { DepthBufferGrabCommand.AddBinding(camera, "CameraDepthTexture"); this.ReleaseDepthTexture(camera); } else if (this.depthMaterial) { DepthBufferGrabCommand.RemoveBinding(camera, "CameraDepthTexture"); RenderTexture depthTexture = this.GetDepthTexture(camera); Graphics.Blit(null, depthTexture, this.depthMaterial); Shader.SetGlobalTexture("CameraDepthTexture", depthTexture); } }