public PostProcessingContext Reset()
 {
     profile = null;
     camera = null;
     materialFactory = null;
     renderTextureFactory = null;
     interrupted = false;
     return this;
 }
 public void Swap(PostProcessingProfile newProfile)
 {
     playerCam.GetComponent <PostProcessingBehaviour>().profile = newProfile;
 }
 void Start()
 {
     behaviour = GetComponent <PostProcessingBehaviour>();
     ppProfile = behaviour.profile;
 }
 private void Awake()
 {
     profile = GetComponent <PostProcessingBehaviour>().profile;
 }
Ejemplo n.º 5
0
 void UpdatePostProcessingProfile()
 {
     ppp = Camera.main.GetComponent <PostProcessingBehaviour>().profile;
 }
Ejemplo n.º 6
0
 void Start()
 {
     InterCamp = FindObjectOfType <InteractCampfire>();
     Cam       = Camera.main;
     PBhav     = Cam.GetComponent <PostProcessingBehaviour>().profile;
 }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     postProcessing = FindObjectOfType <PostProcessingBehaviour>().profile;
     postProcessing.motionBlur.enabled   = false;
     postProcessing.colorGrading.enabled = true;
 }
Ejemplo n.º 8
0
    // Use this for initialization
    void Start()
    {
        PostProcessingBehaviour behavoiur = Camera.main.GetComponent <PostProcessingBehaviour>();

        profile = behavoiur.profile;
    }
Ejemplo n.º 9
0
 void Awake()
 {
     _camera           = gameObject.GetComponentInChildren <Camera>();
     _cameraController = gameObject.GetComponentInChildren <CameraController>();
     _postProcessing   = _camera.GetComponent <PostProcessingBehaviour>().profile;
 }
Ejemplo n.º 10
0
        public static void Save(PostProcessingProfile profile, string fileName, string saveLocation)
        {
            List <string> lines = new List <string>();

            lines.Add("SETUP");
            lines.Add("{");
            lines.Append("Scene = [SceneName has to be assigned manually]", 1);

            //Check if something is enabled
            //If disabled, we don't add the node, as the non-existance of a node means that it is marked as disabled

            if (profile.antialiasing.enabled)
            {
                WriteAA(lines, profile.antialiasing.settings);
            }
            if (profile.ambientOcclusion.enabled)
            {
                WriteAO(lines, profile.ambientOcclusion.settings);
            }
            if (profile.bloom.enabled)
            {
                WriteB(lines, profile.bloom.settings);
            }
            if (profile.chromaticAberration.enabled)
            {
                WriteCA(lines, profile.chromaticAberration.settings);
            }
            if (profile.colorGrading.enabled)
            {
                WriteCG(lines, profile.colorGrading.settings);
            }
            if (profile.depthOfField.enabled)
            {
                WriteDOF(lines, profile.depthOfField.settings);
            }
            if (profile.dithering.enabled)
            {
                lines.Append("Dithering", 1);
                lines.Append("{", 1);
                lines.Append("}", 1);
            }
            if (profile.eyeAdaptation.enabled)
            {
                WriteEA(lines, profile.eyeAdaptation.settings);
            }
            if (profile.grain.enabled)
            {
                WriteG(lines, profile.grain.settings);
            }
            if (profile.motionBlur.enabled)
            {
                WriteMB(lines, profile.motionBlur.settings);
            }
            if (profile.userLut.enabled)
            {
                WriteUL(lines, profile.userLut.settings);
            }
            if (profile.vignette.enabled)
            {
                WriteV(lines, profile.vignette.settings);
            }

            File.WriteAllLines(saveLocation + "/" + fileName + ".txt", lines.ToArray());
            Debug.Log("[KS3P]: Saved profile to file at [" + saveLocation + "], file name [" + fileName + "].");
        }
Ejemplo n.º 11
0
 void Start()
 {
     currentState = GetComponent <PostProcessingBehaviour>().profile = postProfileMain;
 }
Ejemplo n.º 12
0
 // Use this for initialization
 void Start()
 {
     profile = GetComponent <PostProcessingBehaviour>().profile;
 }
Ejemplo n.º 13
0
 void Start()
 {
     ppp = GetComponent <PostProcessingBehaviour>().profile = ppBloom;
 }
    public static void ConvertColourGradingViaLUT(PostProcessProfile ppp,
                                                  ColorGradingModel oldColorGradingSettings, PostProcessingProfile oldPPP)
    {
        var materialFactory = new MaterialFactory();

        var uberShader = materialFactory.Get("Hidden/Post FX/Uber Shader");

        uberShader.shaderKeywords = new string[0];

        var cgc = new ColorGradingComponent();

        cgc.Init(new PostProcessingContext
        {
            materialFactory = materialFactory
        }, oldColorGradingSettings);

        cgc.context.profile = oldPPP;

        cgc.Prepare(uberShader);

        var cg = ppp.AddSettings <ColorGrading>();

        cg.gradingMode.value         = GradingMode.LowDefinitionRange;
        cg.gradingMode.overrideState = true;

        var lut = cgc.model.bakedLut;

        /*
         * var textureFormat = TextureFormat.RGBAHalf;
         * if (!SystemInfo.SupportsTextureFormat(textureFormat))
         *  textureFormat = TextureFormat.ARGB32;
         *
         * var lutAsT2D = lut.GrabTexture(dontUseCopyTexture: true, format: textureFormat).GetPixels();
         *
         * for (int i = 0; i < lutAsT2D.Length; i++)
         * {
         *  lutAsT2D[i] = lutAsT2D[i].gamma;
         * }
         *
         * var newLut = new Texture2D(lut.width, lut.height, textureFormat, false, true);
         * newLut.SetPixels(lutAsT2D);
         * newLut.Apply(true, false);
         */

        cg.ldrLut.value = lut;//newLut;//TextureCompositor.GPUDegamma(newLut, null, true);

        cg.ldrLut.overrideState = true;

        cg.ldrLutContribution.value         = 1.0f;
        cg.ldrLutContribution.overrideState = true;

        var exposure = ppp.AddSettings <AutoExposure>();

        exposure.eyeAdaptation.value         = EyeAdaptation.Fixed;
        exposure.eyeAdaptation.overrideState = true;
        exposure.keyValue.value         = 1.0f;
        exposure.keyValue.overrideState = true;
    }
    public static PostProcessProfile Convert(PostProcessingProfile original)
    {
        var ppp = ScriptableObject.CreateInstance <PostProcessProfile>();

        var ao       = original.ambientOcclusion.settings;
        var aa       = original.antialiasing.settings;
        var bloom    = original.bloom.settings;
        var ca       = original.chromaticAberration.settings;
        var cg       = original.colorGrading.settings;
        var dof      = original.depthOfField.settings;
        var dither   = original.dithering.settings;
        var eye      = original.eyeAdaptation.settings;
        var fog      = original.fog.settings;
        var grain    = original.grain.settings;
        var mb       = original.motionBlur.settings;
        var ssr      = original.screenSpaceReflection.settings;
        var lut      = original.userLut.settings;
        var vignette = original.vignette.settings;

        // LUT is complex. Only works in ColorGrading if Mode is 'LDR' or 'External'
        // Not -quite- sure how to handle this (a new custom effect?)

        if (original.vignette.enabled)
        {
            ConvertVignetteSettings(ppp, vignette);
        }

        if (original.screenSpaceReflection.enabled)
        {
            ConvertReflectionSettings(ppp, ssr);
        }

        if (original.motionBlur.enabled)
        {
            ConvertMotionBlurSettings(ppp, mb);
        }

        if (original.grain.enabled)
        {
            ConvertGrainSettings(ppp, grain);
        }

        // Skipping fog - moved to another part of the profile.

        if (original.chromaticAberration.enabled)
        {
            ConvertChromaticAberrationSettings(ppp, ca);
        }

        if (original.depthOfField.enabled)
        {
            ConvertDepthOfFieldSettings(ppp, dof);
        }

        // Skipping dithering (no matching equivialent?)

        if (original.eyeAdaptation.enabled)
        {
            ConvertEyeAdaptionSettings(ppp, eye);
        }

        if (original.ambientOcclusion.enabled)
        {
            ConvertAmbientOcclusionSettings(ppp, ao);
        }

        // Skipping Anti-aliasing (rightfully this shouldn't be part of a profile.)

        if (original.bloom.enabled)
        {
            ConvertBloomSettings(ppp, bloom);
        }


        const bool haveOldShadersAvailable = false;

        if (original.colorGrading.enabled)
        {
            if (haveOldShadersAvailable)
            {
                ConvertColourGradingViaLUT(ppp, original.colorGrading, original);
            }
            else
            {
                ConvertColourGradingSettings(ppp, cg, lut);
            }
        }

        return(ppp);
    }
Ejemplo n.º 16
0
 private void Start()
 {
     startPosition = Camera.main.gameObject.transform.position;
     startProfile  = postPro.profile;
 }
Ejemplo n.º 17
0
    void Start()
    {
        savedCarHealth = carHealth;

        if (!isGhost)
        {
            Instantiate(spawner, transform.position, Quaternion.identity);
        }

        impactTimer                   = hitImpactTimer;
        playerBody                    = transform.GetComponent <Rigidbody>();
        playerBody.centerOfMass       = new Vector3(0f, -0.5f, 0.3f);
        playerBody.maxAngularVelocity = 3f;
        //playerBody.maxDepenetrationVelocity = 1f;
        tempMaxSpeed = maxSpeed;
        isGrounded   = false;

        if (controller == XboxController.First)
        {
            playerID = 1;
        }
        else if (controller == XboxController.Second)
        {
            playerID = 2;
        }
        else if (controller == XboxController.Third)
        {
            playerID = 3;
        }
        else if (controller == XboxController.Fourth)
        {
            playerID = 4;
        }

        tempForwardFriction  = wheelColliders[0].forwardFriction.stiffness;
        tempSidewaysFriction = wheelColliders[0].sidewaysFriction.stiffness;

        CameraSetUp();

        PostProcessingBehaviour behaviour = playerCam.GetComponent <PostProcessingBehaviour>();

        if (behaviour.profile == null)
        {
            enabled = false;
            return;
        }

        m_Profile         = Instantiate(behaviour.profile);
        behaviour.profile = m_Profile;

        ColorGradingModel.Settings colorSettings = m_Profile.colorGrading.settings;
        float saveSatValue = colorSettings.basic.saturation;

        if (isGhost)
        {
            colorSettings.basic.saturation  = 0.3f;
            m_Profile.colorGrading.settings = colorSettings;
        }
        else
        {
            colorSettings.basic.saturation  = saveSatValue;
            m_Profile.colorGrading.settings = colorSettings;
        }

        tempBoostTimer       = boostTimer;
        boostSlider.minValue = 0;
        boostSlider.maxValue = boostTimer;

        //wheelColliders [0].ConfigureVehicleSubsteps (speedTreshold, stepsBelowTreshold, stepsAboveTreshold);
    }
Ejemplo n.º 18
0
    void InGameUpdate()
    {
        if (pause_canvas == null)
        {
            if ((pause_canvas = GameObject.Find("Canvas")) != null)
            {
                pause_canvas.SetActive(false);
            }
        }

        if (ScoreText == null)
        {
            ScoreText = GameObject.Find("ScoreText").GetComponent <Text> ();
        }

        if (corruptionObject == null)
        {
            corruptionObject = GameObject.Find("Corruption");
        }

        if (camera_effects == null)
        {
            if ((camera_effects = Camera.main.GetComponent <PostProcessingBehaviour> ().profile) != null)
            {
                RestartGraphicProfile();
            }
        }

        if (Input.GetKeyDown(KeyCode.P) || Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown("joystick button 7"))
        {
            game_state = GameState.PauseMenu;
            pause_canvas.SetActive(true);
            Time.timeScale = 0.0f;
        }

        if (corruption_level >= corruption_limit)
        {
            game_state = GameState.EndMenu;
            RestartGraphicProfile();
            AudioManager.instance.StopMusic("BGM");
            AudioManager.instance.StopMusic("BGM_Alternate");
            AudioManager.instance.PlaySFX("BlueScreen");
            SceneManager.LoadScene(3);
        }


                #if !UNITY_ANDROID
        // Glitches and some chromatic aberration
        aberration_sett.intensity = (corruption_level / corruption_limit) * 0.5f;
        camera_effects.chromaticAberration.settings = aberration_sett;

        // More glitches, dithering / grain
        grain_sett.intensity          = (corruption_level / corruption_limit) * 0.5f;
        camera_effects.grain.settings = grain_sett;

        // Audio glitches, vignette, bloom
        vignette_sett.intensity          = (corruption_level / corruption_limit) * 0.5f;
        camera_effects.vignette.settings = vignette_sett;
        bloom_set.bloom.intensity        = (corruption_level / corruption_limit) * 1.25f;
        camera_effects.bloom.settings    = bloom_set;
                #endif

        if ((corruption_level / corruption_limit) > 0.6f && changed_music == false)
        {
            AudioManager.instance.StopMusic("BGM");
            AudioManager.instance.PlayMusic("BGM_Alternate");
            changed_music = true;
        }

        if ((corruption_level / corruption_limit) > 0.8f)
        {
            corruptionObject.GetComponent <Animator> ().SetInteger("CorruptionAnim", 2);
        }

        if ((corruption_level / corruption_limit) > 0.85f)
        {
            corruptionObject.GetComponent <Animator> ().SetInteger("CorruptionAnim", 3);
        }

        if ((corruption_level / corruption_limit) > 0.9f)
        {
            corruptionObject.GetComponent <Animator> ().SetInteger("CorruptionAnim", 1);
        }


        ScoreText.text = score.ToString();

        scoreTimer += Time.deltaTime;

        if (scoreTimer >= 1.0f)
        {
            score     += 20;
            scoreTimer = 0;
        }
        // Graphical glitches

        /*if((corruption_level / corruption_limit) > 0.5f) {
         * // Starts at 5%, then scales up to 9%
         * if(Random.Range(0,100) < 10 * (int)(corruption_level / corruption_limit)) {
         * Destroy(Instantiate(,new Vector3(Random.Range(0,1440),Random.Range(0,1080),0.0f), Quaternion.identity), 2.0f);
         * }
         * }*/
    }
Ejemplo n.º 19
0
    public void ApplyPauseFilter()
    {
        currentProfile = postProcessingBehaviour.profile;

        postProcessingBehaviour.profile = pauseProfile;
    }
Ejemplo n.º 20
0
    private void Start()
    {
        ppp = GetComponent <PostProcessingBehaviour>().profile;

        StartLevel();
    }
 private void Start()
 {
     _cam           = Camera.main.transform;
     _postProcStack = GetComponent <PostProcessingBehaviour>().profile;
 }
Ejemplo n.º 22
0
 private void Awake()
 {
     postProcessing = Camera.main.GetComponent <PostProcessingBehaviour>().profile;
     StartCoroutine(PlayEffect());
 }
Ejemplo n.º 23
0
 // Use this for initialization
 void Start()
 {
     FX      = transform.GetComponent <PostProcessingBehaviour>();
     startFX = transform.GetComponent <PostProcessingBehaviour>().profile;
 }
Ejemplo n.º 24
0
    //public bool isEnabled;
    //UnityEvent toggleEvent;

    // Use this for initialization
    void Start()
    {
        ppProfile = GetComponent <PostProcessingBehaviour>().profile;
        cbProfile = GetComponent <Colorblind>();
    }
Ejemplo n.º 25
0
 void Start()
 {
     defaultZoom     = myCamera.fieldOfView;
     defaultDOF      = 5.9f;
     camFocusProfile = myCamera.GetComponent <PostProcessingBehaviour>().profile;
 }
        public override void Action(int instanceId, string pathName, string resourceFile)
        {
            PostProcessingProfile profile = PostProcessingFactory.CreatePostProcessingProfileAtPath(pathName);

            ProjectWindowUtil.ShowCreatedAsset(profile);
        }
Ejemplo n.º 27
0
 // Start is called before the first frame update
 void Awake()
 {
     postProcessingProfile = cameraGameObject.GetComponent <PostProcessingBehaviour>().profile;
 }
Ejemplo n.º 28
0
 // Use this for initialization
 void Start()
 {
     PPbehavior       = Camera.main.GetComponent <PostProcessingBehaviour>();
     motionBlurScript = Camera.main.GetComponent <PostProcessingBehaviour>().profile;
     motionBlurText   = this.gameObject.GetComponent <TextMeshProUGUI>();
 }
Ejemplo n.º 29
0
 // Use this for initialization
 void Start()
 {
     cam           = Camera.main.GetComponent <PostProcessingBehaviour>();;
     player        = GameObject.Find("Buto_Exploration").transform;
     profileHolder = cam.profile;
 }
Ejemplo n.º 30
0
 // Use this for initialization
 private void Start()
 {
     _postProcessingProfile = Camera.main.GetComponent <PostProcessingBehaviour>().profile;
     _mainCamera            = Camera.main.transform;
 }
Ejemplo n.º 31
0
    // Called after all other update functions have been called
    void LateUpdate()
    {
        if (!GameMaster.Instance.UIMode)
        {
            float horizontal = Input.GetAxisRaw("Mouse X") * horizontalSensitivity;    //*
            float vertical   = Input.GetAxisRaw("Mouse Y") * verticalSensitivity * -1; //*

            int layerMask = 1 << GameMaster.Instance.CustomizationManager.Office.OfficeItemLayer | 1 << 2;
            layerMask = ~layerMask;

            switch (CameraMode)
            {
            case CameraMode.ThirdPerson:
            {
                Vector3 targetPosition;

                Vector3 currentEulerAngles = targetController.transform.rotation.eulerAngles;
                float   currentXAngle      = currentEulerAngles.x;

                Quaternion newRotation;
                Vector3    newPosition;

                RaycastHit wallHit;

                float offsetX;

                targetController.transform.position = Target.position + (Target.up * OffsetY);

                if ((currentXAngle % 360) > 180)
                {
                    currentXAngle = currentXAngle - 360;
                }

                currentXAngle = Mathf.Clamp(currentXAngle + vertical, minTargetAngle, maxTargetAngle);

                newRotation = Quaternion.Euler(new Vector3(currentXAngle, currentEulerAngles.y + horizontal, 0));
                targetController.transform.rotation = newRotation;

                if (ThirdPersonOverShoulder)
                {
                    offsetX = OffsetX;

                    Vector3 tempOrigin = targetController.transform.position;
                    tempOrigin.y = (tempOrigin - (newRotation * Offset)).y;

                    if (Physics.SphereCast(tempOrigin, physicsSphereRadius, targetController.transform.right, out wallHit, OffsetX, layerMask))
                    {
                        float modifier = physicsSphereRadius - (physicsSphereRadius * (wallHit.distance / OffsetX));
                        offsetX = wallHit.distance - modifier;
                    }

                    targetPosition = targetController.transform.position + (targetController.transform.right * offsetX);
                }
                else
                {
                    targetPosition = targetController.transform.position;
                }

                //New position of the camera before taking collision into account:
                newPosition = targetPosition - (newRotation * Offset);         //<Quaternion> * <Vector3> applies the rotation (Quaternion) to the Vector3. Not sure how this works...

                //Check for collision:
                if (Physics.SphereCast(targetPosition, physicsSphereRadius, targetController.transform.forward * -1, out wallHit, Vector3.Distance(targetPosition, newPosition), layerMask))
                {
                    newPosition = (wallHit.point + (wallHit.normal * physicsSphereRadius));         //Set the camera's new position to the point where the sphere touched the wall, then a bit away from it
                }
                transform.position = newPosition;

                transform.LookAt(targetPosition);

                break;
            }

            case CameraMode.FirstPerson:
            {
                Vector3 targetControllerPosition = Target.gameObject.GetComponent <PlayerController>().HeadTransform.position;
                targetControllerPosition.y += Target.gameObject.GetComponent <PlayerController>().HeadTransform.gameObject.GetComponent <SphereCollider>().radius;

                Vector3 targetPosition;

                Vector3 currentEulerAngles = targetController.transform.rotation.eulerAngles;
                float   currentXAngle      = currentEulerAngles.x;

                Quaternion newRotation;
                Vector3    newPosition;

                targetController.transform.position = targetControllerPosition;

                if ((currentXAngle % 360) > 180)
                {
                    currentXAngle = currentXAngle - 360;
                }

                currentXAngle = Mathf.Clamp(currentXAngle + vertical, maxTargetAngle * -1, minTargetAngle * -1);

                newRotation = Quaternion.Euler(new Vector3(currentXAngle, currentEulerAngles.y + horizontal, 0));
                targetController.transform.rotation = newRotation;

                targetPosition = targetController.transform.position;

                //New position of the camera before taking collision into account:
                newPosition = targetPosition;

                ////Check for collision:
                //if (Physics.SphereCast(targetPosition, physicsSphereRadius, targetController.transform.forward * -1, out wallHit, Vector3.Distance(targetPosition, newPosition), layerMask))
                //    newPosition = (wallHit.point + (wallHit.normal * physicsSphereRadius)); //Set the camera's new position to the point where the sphere touched the wall, then a bit away from it

                transform.position = newPosition;

                transform.rotation = targetController.transform.rotation;

                break;
            }
            }

            if (UseDOF)
            {
                RaycastHit hit;

                PostProcessingProfile      postProfile = GetComponent <PostProcessingBehaviour>().profile;
                DepthOfFieldModel.Settings dofsettings = postProfile.depthOfField.settings;

                if (Physics.Raycast(transform.position, transform.forward, out hit))
                {
                    dofsettings.focusDistance = hit.distance;

                    postProfile.depthOfField.enabled = true;
                }
                else
                {
                    postProfile.depthOfField.enabled = false;
                }

                postProfile.depthOfField.settings = dofsettings;
            }
        }
    }