Example #1
0
    protected override void Awake()
    {
        base.Awake();

        vignetting            = GameObject.Find("_camera-back").GetComponent <Vignetting>();
        vignetting.blur       = 50;
        vignetting.blurSpread = 50;
        contrast = GameObject.Find("_camera-back").GetComponent <ContrastEnhance>();
    }
Example #2
0
    protected override void Awake()
    {
        base.Awake();

        vignetting = GameObject.Find("_camera-back").GetComponent<Vignetting>();
        vignetting.blur = 50;
        vignetting.blurSpread = 50;
        contrast = GameObject.Find("_camera-back").GetComponent<ContrastEnhance>();
    }
        static ContrastDef()
        {
            if (contrastEffect == null)
            {
                contrastEffect = Util.GetComponentVar <ContrastEnhance, ContrastDef>(contrastEffect);
            }

            intensity  = 0.5f;
            threshhold = 0f;
            blurSpread = 1f;
        }
Example #4
0
 // Use this for initialization
 void Start()
 {
     _SSAO = GetComponent <ScreenSpaceAmbientOcclusion> ();
     PlayerPrefs.SetInt("SSAO", 0);
     _CE = GetComponent <ContrastEnhance> ();
     PlayerPrefs.SetInt("CE", 0);
     _Bloom = GetComponent <BloomOptimized> ();
     PlayerPrefs.SetInt("Bloom", 0);
     _Vignette = GetComponent <VignetteAndChromaticAberration> ();
     PlayerPrefs.SetInt("Vignette", 0);
 }
Example #5
0
    public static void CheckToggleSaturationCorrection()
    {
        GameObject obj2 = GameObject.FindWithTag("MainCamera");

        if (obj2 != null)
        {
            if (Input.GetKeyUp(KeyCode.F12))
            {
                isF12KeyDown = false;
            }
            if (!isF12KeyDown && Input.GetKeyDown(KeyCode.F12))
            {
                if (iniHelper == null)
                {
                    iniHelper = new IniHelper(Application.dataPath + "/Managed/new.ini");
                }

                TM_Enable    = (iniHelper.ReadValue("Graphics Enhance", "ToneMapping") == "1") ? true : false;
                SSAO_Enable  = (iniHelper.ReadValue("Graphics Enhance", "SSAO") == "1") ? true : false;
                CE_Enable    = (iniHelper.ReadValue("Graphics Enhance", "ContrastEnhance") == "1") ? true : false;
                CS_Enable    = (iniHelper.ReadValue("Graphics Enhance", "ContrastStretch") == "1") ? true : false;
                Bloom_Enable = (iniHelper.ReadValue("Graphics Enhance", "Bloom") == "1") ? true : false;

                Tonemapping           TM    = obj2.GetComponent <Tonemapping> ();
                SSAOEffect            SSAO  = obj2.GetComponent <SSAOEffect>();
                ContrastEnhance       CE    = obj2.GetComponent <ContrastEnhance> ();
                BloomAndLensFlares    bloom = obj2.GetComponent <BloomAndLensFlares> ();
                ContrastStretchEffect CS    = obj2.GetComponent <ContrastStretchEffect> ();

                QualitySettings.antiAliasing = 4;

                if (CS == null)
                {
                    CS              = obj2.AddComponent <ContrastStretchEffect> ();
                    CS.shaderAdapt  = Shader.Find("Hidden/Contrast Stretch Adaptation");
                    CS.shaderApply  = Shader.Find("Hidden/Contrast Stretch Apply");
                    CS.shaderLum    = Shader.Find("Hidden/Contrast Stretch Luminance");
                    CS.shaderReduce = Shader.Find("Hidden/Contrast Stretch Reduction");
                }

                if (bloom == null)
                {
                    bloom = obj2.AddComponent <BloomAndLensFlares> ();
                    bloom.addBrightStuffOneOneShader = Shader.Find("Hidden/BlendOneOne");
                    bloom.brightPassFilterShader     = Shader.Find("Hidden/BrightPassFilterForBloom");
                    bloom.hollywoodFlaresShader      = Shader.Find("Hidden/MultipassHollywoodFlares");
                    bloom.lensFlareShader            = Shader.Find("Hidden/LensFlareCreate");
                    bloom.screenBlendShader          = Shader.Find("Hidden/Blend");
                    bloom.separableBlurShader        = Shader.Find("Hidden/SeparableBlurPlus");
                    bloom.vignetteShader             = Shader.Find("Hidden/VignetteShader");
                }

                if (TM == null)
                {
                    TM            = obj2.AddComponent <Tonemapping> ();
                    TM.tonemapper = Shader.Find("Hidden/Tonemapper");
                    TM.type       = Tonemapping.TonemapperType.AdaptiveReinhardAutoWhite;
                }
                if (SSAO == null)
                {
                    SSAO = obj2.AddComponent <SSAOEffect>();
                    SSAO.m_SSAOShader        = Shader.Find("Hidden/SSAO");
                    obj2.camera.farClipPlane = 1000;
                }

                FightUIInterface.uiInterface.cheatWindow.Open();
                //Main.actorMgr.SwitchControlActor ();

                if (CE == null)
                {
                    CE = obj2.AddComponent <ContrastEnhance> ();
                    CE.contrastCompositeShader = Shader.Find("Hidden/ContrastComposite");
                    CE.separableBlurShader     = Shader.Find("Hidden/SeparableBlurPlus");
                }

                isF12KeyDown = true;
                if (!SaturationCorrectionFlag)
                {
                    FightUIInterface.ShowPromptText("画面增强打开", 1, 1f);
                    SaturationCorrectionFlag = true;

                    if (TM)
                    {
                        TM.enabled = TM_Enable;
                    }

                    if (SSAO)
                    {
                        SSAO.enabled              = SSAO_Enable;
                        SSAO.m_Radius             = 0.8f;
                        SSAO.m_SampleCount        = SSAOEffect.SSAOSamples.Medium;
                        SSAO.m_OcclusionIntensity = 2.4f;
                        SSAO.m_Downsampling       = 2;
                        SSAO.m_MinZ = 0.8f;
                    }
                    if (CE)
                    {
                        CE.enabled = CE_Enable;
                    }
                    if (bloom)
                    {
                        bloom.enabled = Bloom_Enable;
                    }

                    if (CS)
                    {
                        CS.enabled = CS_Enable;
                    }
                }
                else
                {
                    FightUIInterface.ShowPromptText("画面增强关闭", 1, 1f);
                    SaturationCorrectionFlag = false;
                    //component.enabled = false;
                    if (SSAO)
                    {
                        SSAO.enabled = false;
                    }
                    if (CE)
                    {
                        CE.enabled = false;
                    }
                    if (TM)
                    {
                        TM.enabled = false;
                    }
                    if (bloom)
                    {
                        bloom.enabled = false;
                    }
                    if (CS)
                    {
                        CS.enabled = false;
                    }
                }
                //FightUIInterface.ShowPromptText (SSAO_Enable ? "SSAO ON" : "SSAO OFF");
            }
        }

        //FightUIInterface.ShowPromptText (Application.unityVersion.ToString ());
    }
Example #6
0
 // Use this for initialization
 void Start()
 {
     m_constrast = GetComponent <ContrastEnhance>();
 }
Example #7
0
    void Start()
    {
        if (magnififcationPrefab != null)
        {
            magnificationObj = (GameObject)Instantiate(magnififcationPrefab);
            magnificationObj.transform.parent = mainCamera.transform;
            magnificationObj.GetComponent <AdjustMagnificationLevel>().magnificationLevel = 5;

            magnificationObj.transform.localPosition = new Vector3(0, 0, 0.5f);
            magnificationObj.transform.localRotation = Quaternion.Euler(-90, 0, 0);
            magnificationObj.transform.localScale    = new Vector3(0.1f, 0.1f, 0.1f);
            magnificationObj.layer = 31;
            magnificationObj.transform.GetChild(0).gameObject.layer = 31;

            Camera cam = magnificationObj.GetComponentInChildren <Camera>();
            if (cam != null)
            {
                cam.cullingMask    &= ~((1 << 31));
                cam.clearFlags      = mainCamera.clearFlags;
                cam.backgroundColor = mainCamera.backgroundColor;
            }

            magnificationObj.SetActive(false);
        }

        if (bifocalPrefab != null)
        {
            bifocalObj = Instantiate(bifocalPrefab);
            bifocalObj.GetComponent <AdjustBifocal>().magnificationLevel = 5;
            bifocalObj.transform.parent        = mainCamera.transform;
            bifocalObj.transform.localPosition = new Vector3(0, -0.2f + bifocalShift, 0.5f);
            bifocalObj.transform.localRotation = Quaternion.Euler(-90, 0, 0);
            bifocalObj.transform.localScale    = new Vector3(0.1f, 0.1f, 0.1f);
            bifocalObj.layer = 31;
            bifocalObj.transform.GetChild(0).gameObject.layer = 31;
            Camera cam = bifocalObj.GetComponentInChildren <Camera>();
            if (cam != null)
            {
                cam.cullingMask            &= ~((1 << 31));
                cam.transform.localRotation = Quaternion.Euler(90 - Mathf.Atan2(-0.2f + bifocalShift, 0.5f) * 180 / Mathf.PI, 0, 0);
                cam.transform.localPosition = new Vector3(0, 5, 2 - 10 * bifocalShift);
                cam.clearFlags      = mainCamera.clearFlags;
                cam.backgroundColor = mainCamera.backgroundColor;
            }
            bifocalObj.SetActive(false);
        }

        if (remappingPrefab != null)
        {
            remappingObj = Instantiate(remappingPrefab);
            remappingObj.transform.parent        = mainCamera.transform;
            remappingObj.transform.localScale    = new Vector3(0.2f + SizeShift, 0.2f + SizeShift, 0.01f);
            remappingObj.transform.localPosition = new Vector3(XShift, YShift, 0.5f + ZShift);
            remappingObj.transform.localRotation = Quaternion.Euler(0, 180, 0);
            remappingObj.GetComponent <Renderer>().material.color = remappingEdgeColor;
            remappingObj.layer = 30;
            Camera cam = remappingObj.GetComponentInChildren <Camera>();
            cam.cullingMask            &= ~((1 << 31) | (1 << 30));
            cam.transform.localPosition = new Vector3(XShift / 0.2f, -YShift / 0.2f, (0.5f + ZShift) / 0.01f);
            cam.clearFlags      = mainCamera.clearFlags;
            cam.backgroundColor = mainCamera.backgroundColor;
            remappingObj.GetComponent <BoxCollider>().enabled = false;
            remappingObj.SetActive(false);
        }

        brightnessAdjustment                  = mainCamera.gameObject.AddComponent <BrightnessAdjustment>();
        brightnessAdjustment.intensity        = brightnessLevel;
        brightnessAdjustment.brightnessShader = Shader.Find("Custom/BrightnessShader");
        brightnessAdjustment.enabled          = false;

        contrastEnhance = mainCamera.gameObject.AddComponent <ContrastEnhance>();
        contrastEnhance.contrastCompositeShader = Shader.Find("Hidden/ContrastComposite");
        contrastEnhance.separableBlurShader     = Shader.Find("Hidden/SeparableBlur");
        contrastEnhance.threshold  = 0;
        contrastEnhance.blurSpread = 1;
        contrastEnhance.intensity  = contrastIntensity;
        contrastEnhance.enabled    = false;

        edgeDetection                  = mainCamera.gameObject.AddComponent <EdgeDetection>();
        edgeDetection.edgesOnly        = 0;
        edgeDetection.edgesColor       = edgeColor;
        edgeDetection.sampleDist       = edgeThickness;
        edgeDetection.edgeDetectShader = Shader.Find("Hidden/EdgeDetect");
        edgeDetection.enabled          = false;

        augmentations = new GameObject("_augmentations");
        textAugment   = augmentations.AddComponent <TextAugmentationByShader>();
        textAugment.addColliderToText = addTextCollider;
        textAugment.fontSizeIncrease  = fontSizeIncrease;
        textAugment.bold            = false;
        textAugment.isAugmented     = false;
        textAugment.dynamicScanning = false;

        augmentations.AddComponent <WindowsVoice>();
        if (leftHand != null)
        {
            leftVoice = leftHand.AddComponent <VoiceComponent>();
            leftVoice.TextToSpeech      = false;
            leftVoice.objectDescription = false;
            VoiceLaser leftLaser = leftHand.GetComponent <VoiceLaser>();
            leftLaser.rotateAngle   = laserRotation;
            leftLaser.shiftDistance = laserShift;

            leftDepth = leftHand.AddComponent <DepthLaser>();
            leftDepth.isDepthMeasured = false;
            leftDepth.color           = depthColor;
            leftDepth.rotateAngle     = laserRotation;
            leftDepth.shiftDistance   = laserShift;
        }

        if (rightHand != null)
        {
            rightVoice = rightHand.AddComponent <VoiceComponent>();
            rightVoice.TextToSpeech      = false;
            rightVoice.objectDescription = false;
            VoiceLaser rightLaser = rightHand.GetComponent <VoiceLaser>();
            rightLaser.rotateAngle   = laserRotation;
            rightLaser.shiftDistance = laserShift;

            rightDepth = rightHand.AddComponent <DepthLaser>();
            rightDepth.isDepthMeasured = false;
            rightDepth.color           = depthColor;
            rightDepth.rotateAngle     = laserRotation;
            rightDepth.shiftDistance   = laserShift;
        }

        highlightSalience                 = augmentations.AddComponent <HighlightSalience>();
        highlightSalience.highlight       = false;
        highlightSalience.highlightColor  = highlightColor;
        highlightSalience.Guideline       = false;
        highlightSalience.guidelineColor  = guidelineColor;
        highlightSalience.forwardFactor   = forwardFactor;
        highlightSalience.radius          = radius;
        highlightSalience.dynamicScanning = salientObjDynamicScanning;

        recolorManagement = augmentations.AddComponent <RecolorManagement>();
        recolorManagement.enableRecoloring = false;
        recolorManagement.threshould       = distanceThreshold;
        recolorManagement.dynamicScanning  = objectDynamicScanning;
    }
 public static void InitMemberByInstance(ContrastEnhance c)
 {
     intensity  = c.intensity;
     threshhold = c.threshhold;
     blurSpread = c.blurSpread;
 }
Example #9
0
    private void UpdatePostProcess()
    {
        foreach (Camera cam in Camera.allCameras)
        {
            SMAA                   defAntiAlias = cam.GetComponent <SMAA>();
            Bloom                  b            = cam.GetComponent <Bloom>();
            BloomAndFlares         baf          = cam.GetComponent <BloomAndFlares>();
            ContrastEnhance        ce           = cam.GetComponent <ContrastEnhance>();
            MotionBlur             mb           = cam.GetComponent <MotionBlur>();
            WeaponDepthOfField     wdof         = cam.GetComponent <WeaponDepthOfField>();
            SunShafts              ss           = cam.GetComponent <SunShafts>();
            AmplifyOcclusionEffect ao           = cam.GetComponent <AmplifyOcclusionEffect>();
            ColorCorrection        ccc          = cam.GetComponent <ColorCorrection>();

            if (defAntiAlias)
            {
                defAntiAlias.enabled = (antiAliasing == 1);
            }

            if (wdof)
            {
                wdof.enabled = (wDepthOfField == 1);
            }

            bool bloomBool = (bloom == 1);
            if (baf)
            {
                baf.enabled = bloomBool;
            }
            if (b)
            {
                b.enabled = bloomBool;
            }

            if (ss)
            {
                ss.enabled = (sunShafts == 1);
            }
            if (mb)
            {
                mb.enabled = (motionBlur == 1);
            }

            bool ssaoBool = (SSAO == 1);
            if (ao)
            {
                ao.enabled = ssaoBool;
            }

            bool ccBool = (colorCorrection == 1);
            if (ccc)
            {
                ccc.enabled = ccBool;
            }
            if (ce)
            {
                ce.enabled = ccBool;
            }
        }

        lastPP      = Time.unscaledTime;
        cameraCount = Camera.allCameras.Length;
    }