Пример #1
0
 void Awake()
 {
     dof = GetComponent<DepthOfField>();
        cameras = GetComponentsInChildren<Camera>();
        distanceSpread = maxDistance - minDistance;
        sizeSpread = maxSize - minSize;
 }
Пример #2
0
 void Start()
 {
     angleX = angleX * Mathf.Deg2Rad;
     angleY = angleY * Mathf.Deg2Rad;
     dof = GetComponent<DepthOfField>();
     targetPoint = target.position;
 }
Пример #3
0
 public void Set(DepthOfField dof)
 {
     if (Object.op_Equality((Object)dof, (Object)null))
     {
         return;
     }
     ((Behaviour)dof).set_enabled(this.enabled);
     dof.focalTransform = (__Null)this.focalTransform;
     dof.focalLength    = (__Null)(double)this.focalLength;
     dof.focalSize      = (__Null)(double)this.focalSize;
     dof.aperture       = (__Null)(double)this.aperture;
 }
Пример #4
0
 public DOFBK(DepthOfField dof)
 {
     if (Object.op_Equality((Object)dof, (Object)null))
     {
         return;
     }
     this.enabled        = ((Behaviour)dof).get_enabled();
     this.focalTransform = (Transform)dof.focalTransform;
     this.focalLength    = (float)dof.focalLength;
     this.focalSize      = (float)dof.focalSize;
     this.aperture       = (float)dof.aperture;
 }
Пример #5
0

        
Пример #6
0
    void BlurAtRuntime()
    {
        DepthOfField depthOfField = ScriptableObject.CreateInstance <DepthOfField>();

        depthOfField.active = true;
        depthOfField.enabled.Override(true);
        depthOfField.aperture.Override(20.0f);
        depthOfField.focalLength.Override(65.0f);
        depthOfField.focusDistance.Override(1.0f);
        ppVolume = postProcessGameObject.GetComponent <PostProcessVolume>();
        ppVolume = PostProcessManager.instance.QuickVolume(postProcessGameObject.layer, 0f, depthOfField);
    }
Пример #7
0
    void Start()
    {
        GameObject VolumeHolder = Camera.main.gameObject;

        JudgementSource = GameObject.FindGameObjectWithTag("Player").GetComponent <AudioSource>();

        PostProcessVolume volume = VolumeHolder.GetComponent <PostProcessVolume>();

        PPVignette = volume.profile.GetSetting <Vignette>();
        PPField    = volume.profile.GetSetting <DepthOfField>();
        PPBloom    = volume.profile.GetSetting <Bloom>();
    }
Пример #8
0

        
Пример #9
0
    void Start()
    {
        cam       = GetComponentInChildren <Camera>().transform;
        layerMask = LayerMask.GetMask("Examinable");

        cursorDot             = GameObject.Find("crosshair").GetComponent <Image>();
        detectCanvas          = GameObject.Find("ESDetectCanvas").GetComponent <Canvas>();
        ExamineCanvas         = GameObject.Find("ESExamineCanvas").GetComponent <Canvas>();
        cursorDotDefaultColor = cursorDot.color;

        depthOfField = postProcess.profile.GetSetting <DepthOfField>();
    }
Пример #10
0
    // Start is called before the first frame update
    void Start()
    {
        volume = GetComponent <Volume>();

        DepthOfField depth;

        if (volume.profile.TryGet <DepthOfField>(out depth))
        {
            depthOfField = depth;
        }

        StartCoroutine(blurSequencer());
    }
    public void BlurAtRuntime()
    {
        // Adding bluring effect
        DepthOfField depthOfField = ScriptableObject.CreateInstance <DepthOfField>();

        depthOfField.active = true;
        depthOfField.enabled.Override(true);
        depthOfField.aperture.Override(20.0f);
        depthOfField.focalLength.Override(65.0f);
        depthOfField.focusDistance.Override(1.0f);
        ppVolume = PostProcessManager.instance.QuickVolume
                       (GameObject.Find("PostProcessing").layer, 0f, depthOfField);
    }
Пример #12
0
    void SetDepthOfField(float intensity)
    {
        if (magicProcessing == null)
        {
            return;
        }

        DepthOfField depthOfField = ScriptableObject.CreateInstance <DepthOfField>();

        depthOfField.enabled.Override((intensity > 0 ? true : false));
        depthOfField.focalLength.Override(intensity * depthOfFieldRange);

        magicProcessing.profile.AddSettings(depthOfField);
    }
    private void Start()
    {
        inGameMenu = inGameMenuGameObject.GetComponent <InGameMenu>();
        Assert.IsNotNull(inGameMenuGameObject);
        if (!dof)
        {
            DepthOfField tempDof;

            if (postProcessingVolume.profile.TryGet(out tempDof))
            {
                dof = tempDof;
            }
        }
    }
Пример #14
0
    void Awake()
    {
        recordTime = 1f / recordRate;
        actualCamera.SetParent(fpsPosition);
        rb.centerOfMass = new Vector3(0, -1, 0);
        for (int i = 0; i < 4; i++)
        {
            localRotations [i] = wheelMeshes [i].localRotation;
        }
        depthOfField = camera.GetComponent <DepthOfField> ();
        ResetZoom();

//		armActuator.onArrive = OnPickup;
    }
Пример #15
0
    private void Awake()
    {
        instance = this;
        var vol = main_volume.GetComponent <PostProcessVolume>();

        parameters = vol.profile.GetSetting <DepthOfField>();

        var mvol = menu_volume.GetComponent <PostProcessVolume>();

        menu_bloom = mvol.profile.GetSetting <Bloom>();

        var dvol = deco_volume.GetComponent <PostProcessVolume>();

        deco_blur = dvol.profile.GetSetting <DepthOfField>();
    }
Пример #16
0
 public void Blur(bool onOff)
 {
     if (blur)
     {
         DepthOfField blurSettings = blur.GetSetting <DepthOfField>();
         if (onOff == true)
         {
             blurSettings.focalLength.Interp(0f, 70f, 1f);
         }
         else
         {
             blurSettings.focalLength.Interp(70f, 0f, 1f);
         }
     }
 }
Пример #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="YebisPlugin"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        public YebisPlugin(string name) : base(name)
        {
            yebis           = new Manager();
            ToneMap         = yebis.Config.ToneMap;
            Glare           = yebis.Config.Glare;
            ColorCorrection = yebis.Config.ColorCorrection;
            Lens            = yebis.Config.Lens;
            DepthOfField    = yebis.Config.DepthOfField;
            HeatShimmer     = yebis.Config.HeatShimmer;
            LightShaft      = yebis.Config.LightShaft;
            PreferredFormat = PixelFormat.R16G16B16A16_Float;

            // Make sure that the Depth Stencil will be created with ShaderResource
            Tags.Set(RenderTargetKeys.RequireDepthStencilShaderResource, true);
        }
Пример #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="YebisPlugin"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        public YebisPlugin(string name) : base(name)
        {
            yebis = new Manager();
            ToneMap = yebis.Config.ToneMap;
            Glare = yebis.Config.Glare;
            ColorCorrection = yebis.Config.ColorCorrection;
            Lens = yebis.Config.Lens;
            DepthOfField = yebis.Config.DepthOfField;
            HeatShimmer = yebis.Config.HeatShimmer;
            LightShaft = yebis.Config.LightShaft;
            PreferredFormat = PixelFormat.R16G16B16A16_Float;

            // Make sure that the Depth Stencil will be created with ShaderResource
            Tags.Set(RenderTargetKeys.RequireDepthStencilShaderResource, true);
        }
    private void Start()
    {
        _ppp = ScriptableObject.CreateInstance <PostProcessProfile>();
        _ppp.AddSettings <DepthOfField>();
        _dof = _ppp.GetSetting <DepthOfField>();

        _dof.focusDistance.overrideState = true;
        _dof.focalLength.overrideState   = true;
        _dof.aperture.overrideState      = true;
        _dof.kernelSize.overrideState    = true;

        _dof.focusDistance.value = .1f;
        _dof.aperture.value      = 10;
        _dof.kernelSize.value    = KernelSize.Medium;
        this.GetComponent <PostProcessVolume>().profile = _ppp;
    }
Пример #20
0
    void Start()
    {
        m_Vignette = ScriptableObject.CreateInstance <Vignette>();
        m_Vignette.enabled.Override(true);
        m_Vignette.intensity.overrideState = true;

        m_DepthOfField = ScriptableObject.CreateInstance <DepthOfField>();
        m_DepthOfField.enabled.Override(true);
        m_DepthOfField.focusDistance.overrideState = true;

        m_ColorGrading = ScriptableObject.CreateInstance <ColorGrading>();
        m_ColorGrading.enabled.Override(true);
        m_ColorGrading.saturation.overrideState = true;

        m_Volume = PostProcessManager.instance.QuickVolume(gameObject.layer, 100f, m_Vignette, m_DepthOfField, m_ColorGrading);
    }
Пример #21
0
 public void Deactivate()
 {
     foreach (var p in ennemiteam)
     {
         if (p != null)
         {
             blurness = null;
             PostProcessVolume volume = p.GetComponentInChildren <PostProcessVolume>();
             volume.profile.TryGetSettings(out blurness);
             if (blurness != null)
             {
                 blurness.active = false;
             }
         }
     }
 }
Пример #22
0

        
Пример #23
0

        
Пример #24
0
    private void Awake()
    {
        curFieldOfView   = destinationFieldOfView = 60;
        modelCamera      = GameObject.Find("ModelCamera");
        preUICamera      = GameObject.Find("PreUICamera");
        playerController = GameObject.Find("Player").GetComponent <PlayerController>();
        //postProcessVolume = gameObject.GetComponent<PostProcessVolume>();
        depthOfField = Resources.Load <PostProcessProfile>("Camera/CameraEffect").GetSetting <DepthOfField>();

        curFocusDistance         = 5;
        destinationFocusDistance = 5;
        curFocalLength           = 30;
        desFocalLength           = 30;

        depthOfField.focusDistance.Interp(0, curFocusDistance, 1);
        depthOfField.focalLength.Interp(0, curFocalLength, 1);
    }
Пример #25
0
    /// <summary>
    /// Sets the post processing effect to Main Camera.
    /// </summary>
    public static void SetPostProcessingEffect()
    {
        GameObject camera = Camera.main.gameObject;

        Bloom        bloom = camera.GetComponent <Bloom>();
        DepthOfField dof   = camera.GetComponent <DepthOfField>();

        if (bloom != null)
        {
            bloom.enabled = SettingsData.PostProcessingBloom;
        }

        if (dof != null)
        {
            dof.enabled = SettingsData.PostProcessingDOF;
        }
    }
Пример #26
0
        public void LateUpdate()
        {
            UpdateDofMode();

            Vector3 player_pos;
            Vector3 skate_pos;

            if (XLGraphics.Instance.IsReplayActive())
            {
                if (replay_skater == null)
                {
                    GetReplaySkater();
                }
                player_pos = replay_skater.position;
                skate_pos  = replay_skateboard.position;
            }
            else
            {
                player_pos = PlayerController.Instance.skaterController.skaterTransform.position;
                skate_pos  = PlayerController.Instance.boardController.boardTransform.position;
            }

            if (dof == null)
            {
                dof = PresetManager.Instance.overriderVolume.profile.Add <DepthOfField>();
                dof.SetAllOverridesTo(true);
            }

            // activate DoF override only when using custom focus
            dof.active = useCustomFocus;
            if (useCustomFocus)
            {
                var camera = CustomCameraController.Instance.mainCamera;
                //camera. = 100;
                if (customFocusMode == FocusMode.Player)
                {
                    dof.focusMode.value     = UnityEngine.Rendering.HighDefinition.DepthOfFieldMode.UsePhysicalCamera;
                    dof.focusDistance.value = Vector3.Distance(player_pos, camera.transform.position);
                }
                else if (customFocusMode == FocusMode.Skate)
                {
                    dof.focusMode.value     = UnityEngine.Rendering.HighDefinition.DepthOfFieldMode.UsePhysicalCamera;
                    dof.focusDistance.value = Vector3.Distance(player_pos, camera.transform.position);
                }
            }
        }
Пример #27
0
        public Texture2D CaptureTex(int ResolutionX, int ResolutionY, int DownscalingRate, bool Transparent)
        {
            Shader.SetGlobalTexture("_AlphaMask", Texture2D.whiteTexture);
            Shader.SetGlobalInt("_alpha_a", 1);
            Shader.SetGlobalInt("_alpha_b", 1);
            Shader.SetGlobalInt("_LineWidthS", 1);
            Texture2D fullSizeCapture;
            int       newWidth    = ResolutionX * DownscalingRate;
            int       newHeight   = ResolutionY * DownscalingRate;
            float     orgBlurSize = 0.0f;

            // Fix depth of field
            DepthOfField dof = (DepthOfField)Camera.main.gameObject.GetComponent(typeof(DepthOfField));

            if (dof != null)
            {
                orgBlurSize     = dof.maxBlurSize;
                dof.maxBlurSize = newWidth * orgBlurSize / Screen.width;
            }

            if (Transparent && (InStudio ||
                                SceneManager.GetActiveScene().name == "CustomScene" ||
                                SceneManager.GetActiveScene().name == "HEditScene" ||
                                SceneManager.GetActiveScene().name == "HPlayScene"))
            {
                fullSizeCapture = CaptureAlpha(newWidth, newHeight);
            }
            else
            {
                fullSizeCapture = CaptureOpaque(newWidth, newHeight);
            }

            // Recover depth of field
            if (dof != null)
            {
                dof.maxBlurSize = orgBlurSize;
            }

            if (DownscalingRate > 1)
            {
                return(LanczosTex(fullSizeCapture, ResolutionX, ResolutionY));
            }

            return(fullSizeCapture);
        }
Пример #28
0
    void Start()
    {
        canvas.enabled = false;

        DepthOfField tempDof;

        if (volume.profile.TryGet <DepthOfField>(out tempDof))
        {
            dof = tempDof;
        }

        Vignette tempVig;

        if (volume.profile.TryGet <Vignette>(out tempVig))
        {
            vig = tempVig;
        }
    }
Пример #29
0
        void Start()
        {
            _dof           = ScriptableObject.CreateInstance <DepthOfField>();
            _dof.hideFlags = HideFlags.DontSave;
            _dof.focusDistance.overrideState = true;
            _dof.enabled.value = true;

            _profile           = ScriptableObject.CreateInstance <PostProcessProfile>();
            _profile.hideFlags = HideFlags.DontSave;
            _profile.AddSettings(_dof);

            _volume               = gameObject.AddComponent <PostProcessVolume>();
            _volume.hideFlags     = HideFlags.DontSave | HideFlags.NotEditable;
            _volume.sharedProfile = _profile;
            _volume.isGlobal      = true;
            _volume.priority      = 1000;

            Update();
        }
Пример #30
0
 protected override void Awake()
 {
     vp_FPCamera.cs = this;
     base.Awake();
     this.FPController            = base.Root.GetComponent <vp_FPController>();
     this.m_InitialRotation       = new Vector2(base.Transform.eulerAngles.y, base.Transform.eulerAngles.x);
     base.Parent.gameObject.layer = 30;
     foreach (Transform transform in base.Parent)
     {
         transform.gameObject.layer = 30;
     }
     base.GetComponent <Camera>().cullingMask &= 1056964607;
     base.GetComponent <Camera>().depth        = 0f;
     this.weaponCam = null;
     foreach (Transform transform2 in base.Transform)
     {
         this.weaponCam = (Camera)transform2.GetComponent(typeof(Camera));
         if (this.weaponCam != null)
         {
             this.weaponCam.transform.localPosition    = Vector3.zero;
             this.weaponCam.transform.localEulerAngles = Vector3.zero;
             this.weaponCam.clearFlags    = CameraClearFlags.Depth;
             this.weaponCam.cullingMask   = -2147483648;
             this.weaponCam.depth         = 1f;
             this.weaponCam.farClipPlane  = 100f;
             this.weaponCam.nearClipPlane = 0.01f;
             this.weaponCam.fov           = 60f;
             vp_FPCamera.dof = this.weaponCam.GetComponent <DepthOfField>();
             break;
         }
     }
     this.m_PositionSpring              = new vp_Spring(base.Transform, vp_Spring.UpdateMode.Position, false);
     this.m_PositionSpring.MinVelocity  = 1E-05f;
     this.m_PositionSpring.RestState    = this.PositionOffset;
     this.m_PositionSpring2             = new vp_Spring(base.Transform, vp_Spring.UpdateMode.PositionAdditive, false);
     this.m_PositionSpring2.MinVelocity = 1E-05f;
     this.m_RotationSpring              = new vp_Spring(base.Transform, vp_Spring.UpdateMode.RotationAdditive, false);
     this.m_RotationSpring.MinVelocity  = 1E-05f;
     this.cameraFlashFX    = GameObject.Find("WeaponCamera/FlashFX");
     this.matFlashFX       = this.cameraFlashFX.GetComponent <MeshRenderer>().material;
     this.matFlashFX.color = Color.white;
     this.SetFlashFX(0f, 3.5f);
 }
Пример #31
0
    public void GenerateEnnemiTeam(string allyteam)
    {
        this.allyteam = allyteam;
        int i = 0;

        blurness = null;
        foreach (var p in GameObject.FindGameObjectsWithTag("Player"))
        {
            if (p.GetComponent <TeamColor>().enemieColor == allyteam)
            {
                p.GetComponentInChildren <PostProcessVolume>().profile.TryGetSettings(out blurness);
                if (blurness != null)
                {
                    ennemiteam[i++] = p;
                }
            }
            blurness = null;
        }
    }
        static void Draw_Settings_DepthOfField(GraphicSystem data, bool draw = true)
        {
            if (!data.DepthOfField)
            {
                return;
            }

            for (int i = 0; i < _dof.Count; i++)
            {
                DepthOfField obj  = _dof[i];
                string       name = $"[DoF{i}] ";

                obj.enabled.value       = Field($"{name}Enabled", obj.enabled.value, draw);
                obj.aperture.value      = Field($"{name}Aperture", obj.aperture.value, draw);
                obj.focalLength.value   = Field($"{name}Focal Length", obj.focalLength.value, draw);
                obj.focusDistance.value = Field($"{name}Focus Distance", obj.focusDistance.value, draw);
                obj.kernelSize.value    = Field($"{name}Kernel Size", obj.kernelSize.value, draw);
            }
        }
Пример #33
0
 // Use this for initialization
 void Start()
 {
     /*
     foreach (Transform child in transform) {
         children.Add(child.gameObject);
     }
     playerCamera = children[0].gameObject;
     */
     playerCamera = Camera.main.gameObject;
     blurScript = playerCamera.GetComponent<DepthOfField> ();
 }
Пример #34
0
    void Start( )
    {
        //Assign camera effect vars
        CameraVignette = GetComponent<VignetteAndChromaticAberration>( );
        CameraBloom = GetComponent<BloomOptimized>( );
        CameraDoF = GetComponent<DepthOfField>( );

        CameraPos = new Vector3( );

        //Debug
        SetCameraMode( CameraMode.GAME );
    }
Пример #35
0
    /// <summary>
    /// Unity's method called when this entity is created, even if it is disabled.
    /// </summary>
    void Awake()
    {
        // Looks for the independent controller component
        _independentControl = FindObjectOfType<GameControllerIndependentControl>();

        // Looks for the independent controller component
        _inputControl = FindObjectOfType<GameControllerInput>();

        // Get component depth of field
        _dof = GetComponent<DepthOfField>();

        // Sets the camera's target to the current character
        SetObjective(_independentControl.currentCharacter);
    }
Пример #36
0
 void Awake() {
     blur = FindObjectOfType<CameraMotionBlur>();
     dof = FindObjectOfType<DepthOfField>();
     musicPlayer = GameObject.Find("MusicPlayer").GetComponent<AudioSource>();
 }
Пример #37
0
        public override void Initialise()
        {
            base.Initialise();

            if (GraphicsDevice != null)
            {
                // Render Targets
                m_ShadowDepthTarget = new RenderTarget2D(GraphicsDevice, m_ShadowMapSize, m_ShadowMapSize, false, SurfaceFormat.HalfVector2, DepthFormat.Depth24);

                // Shadow multiplier value
                ShadowMult = 0.5f;

                // Custom light blending state
                m_LightAddBlendState = new BlendState()
                {
                    
                    AlphaSourceBlend = Blend.One,
                    ColorSourceBlend = Blend.One,
                    AlphaDestinationBlend = Blend.One,
                    ColorDestinationBlend = Blend.One,
                };

                // Create these post processors up front
                m_DepthOfFieldPostProcessor = new DepthOfField(GraphicsDevice);
                m_BloomPostProcessor = new Bloom(GraphicsDevice);
                m_FilmGrainProcessor = new FilmGrain(GraphicsDevice);
            }

            //create render queues
            for (int index = 0; index < (int)ERenderQueue.Count; index++)
            {
                m_VisibleMeshes[index] = new List<AbstractMesh>();
                m_VisibleShadowedMeshes[index] = new List<AbstractMesh>();
            }
        }