private static IEnumerator LoadLegacyPreset(ProfileData preset, PHIBL.PHIBL phIBL)
        {
            yield return(new WaitForSeconds(.1f));

            Profile  profile  = preset.profile;
            float    nipples  = preset.nipples;
            Traverse traverse = Traverse.Create(phIBL);

            traverse.Method("LoadPostProcessingProfile", profile).GetValue();
            DeferredShadingUtils deferredShading = traverse.Field("deferredShading").GetValue <DeferredShadingUtils>();

            PHIBL.AlloyDeferredRendererPlus SSSSS = deferredShading.SSSSS;
            Traverse trav = Traverse.Create(SSSSS);

            trav.Field("TransmissionSettings").SetValue(profile.TransmissionSettings);
            trav.Field("SkinSettings").SetValue(profile.SkinSettings);
            trav.Method("Reset").GetValue();
            traverse.Field("phong").SetValue(profile.phong);
            traverse.Field("edgelength").SetValue(profile.edgeLength);
            DeferredShadingUtils.SetTessellation(profile.phong, profile.edgeLength);
            traverse.Field("nippleSSS").SetValue(nipples);
            Shader.SetGlobalFloat(Shader.PropertyToID("_AlphaSSS"), nipples);
            QualitySettings.shadowDistance   = preset.shadowDistance;
            RenderSettings.reflectionBounces = preset.reflectionBounces;
            ReflectionProbe probe = traverse.Field("probeComponent").GetValue <ReflectionProbe>();

            probe.resolution = preset.probeResolution;
            probe.intensity  = preset.probeIntensity;

            var PPCtrl_obj = traverse.Field("PPCtrl").GetValue <PHIBL.PostProcessing.Utilities.PostProcessingController>();

            PPCtrl_obj.enableDither = preset.enableDithering;

            Console.WriteLine("[PHIBL_PresetLoad] Loaded LEGACY preset");
        }
        public static void LoadPreset(int presetID = -1)
        {
            PresetInfo preset = presets.ElementAtOrDefault(presetID);

            if (preset == null)
            {
                return;
            }

            Profile  profile  = preset.profile;
            float    nipples  = preset.nipples;
            Traverse traverse = Traverse.Create(phIBL);

            traverse.Method("LoadPostProcessingProfile", profile).GetValue();
            DeferredShadingUtils deferredShading = traverse.Field("deferredShading").GetValue <DeferredShadingUtils>();

            PHIBL.AlloyDeferredRendererPlus SSSSS = deferredShading.SSSSS;
            Traverse trav = Traverse.Create(SSSSS);

            trav.Field("TransmissionSettings").SetValue(profile.TransmissionSettings);
            trav.Field("SkinSettings").SetValue(profile.SkinSettings);
            trav.Method("Reset").GetValue();
            traverse.Field("phong").SetValue(profile.phong);
            traverse.Field("edgelength").SetValue(profile.edgeLength);
            DeferredShadingUtils.SetTessellation(profile.phong, profile.edgeLength);
            traverse.Field("nippleSSS").SetValue(nipples);
            Shader.SetGlobalFloat(Shader.PropertyToID("_AlphaSSS"), nipples);
            QualitySettings.shadowDistance   = preset.shadowDistance;
            RenderSettings.reflectionBounces = preset.reflectionBounces;
            ReflectionProbe probe = traverse.Field("probeComponent").GetValue <ReflectionProbe>();

            probe.resolution = preset.probeResolution;
            probe.intensity  = preset.probeIntensity;

            PHIBL.PostProcessing.Utilities.PostProcessingController PPCtrl_obj = traverse.Field("PPCtrl").GetValue <PHIBL.PostProcessing.Utilities.PostProcessingController>();
            PPCtrl_obj.enableDither = preset.enableDithering;

            Console.WriteLine("[PHIBL_PresetLoad] Loaded preset: " + presets[presetID].name);
        }
Exemple #3
0
 public void InitDeferredShading(Camera camera)
 {
     if (camera.actualRenderingPath != RenderingPath.DeferredShading)
     {
         camera.renderingPath = RenderingPath.DeferredShading;
     }
     if (camera.actualRenderingPath == RenderingPath.DeferredShading)
     {
         SSSSS = camera.GetOrAddComponent <AlloyDeferredRendererPlus>();
         SSSSS.DeferredBlurredNormals   = AlloyBlurNormal;
         SSSSS.DeferredTransmissionBlit = AlloyTransmissionBlit;
         SSSSS.SkinLut = DiffuseScatteringOnRing;
         SSSSS.TransmissionSettings = JSON.Utilities.LoadSettings <AlloyDeferredRendererPlus.TransmissionSettingsData>(JSON.Utilities.TransmissionSettings);
         SSSSS.SkinSettings         = JSON.Utilities.LoadSettings <AlloyDeferredRendererPlus.SkinSettingsData>(JSON.Utilities.SkinSettings);
         SSSSS.SkinSettings.Lut     = DiffuseScatteringOnRing;
         SSSSS.Reset();
         Refresh();
     }
     else
     {
         Console.WriteLine("DeferredShadingUtil: Fail to enable deferred shading! ");
     }
 }
Exemple #4
0
        public static void LoadPreset(int presetID = -1)
        {
            PresetInfo preset = presets.ElementAtOrDefault(presetID);

            if (preset == null)
            {
                return;
            }

            Profile  profile  = preset.profile;
            float    nipples  = preset.nipples;
            Traverse traverse = Traverse.Create(phIBL);

            traverse.Method("LoadPostProcessingProfile", profile).GetValue();
            DeferredShadingUtils deferredShading = traverse.Field("deferredShading").GetValue <DeferredShadingUtils>();

            PHIBL.AlloyDeferredRendererPlus SSSSS = deferredShading.SSSSS;
            Traverse trav = Traverse.Create(SSSSS);

            trav.Field("TransmissionSettings").SetValue(profile.TransmissionSettings);
            trav.Field("SkinSettings").SetValue(profile.SkinSettings);
            trav.Method("Reset").GetValue();
            traverse.Field("phong").SetValue(profile.phong);
            traverse.Field("edgelength").SetValue(profile.edgeLength);
            DeferredShadingUtils.SetTessellation(profile.phong, profile.edgeLength);
            traverse.Field("nippleSSS").SetValue(nipples);
            Shader.SetGlobalFloat(Shader.PropertyToID("_AlphaSSS"), nipples);
            QualitySettings.shadowDistance   = preset.shadowDistance;
            RenderSettings.reflectionBounces = preset.reflectionBounces;
            ReflectionProbe probe = traverse.Field("probeComponent").GetValue <ReflectionProbe>();

            probe.resolution = preset.probeResolution;
            probe.intensity  = preset.probeIntensity;

            var PPCtrl_obj = traverse.Field("PPCtrl").GetValue <PHIBL.PostProcessing.Utilities.PostProcessingController>();

            PPCtrl_obj.enableDither = preset.enableDithering;

            if (preset.enabledLUT)
            {
                string[] names = traverse.Field("LutFileNames").GetValue <string[]>();
                if (names.Length >= preset.selectedLUT)
                {
                    string path = PHIBL.UserData.Path + "PHIBL/Settings/" + names[preset.selectedLUT] + ".png";
                    if (File.Exists(path))
                    {
                        traverse.Field("selectedUserLut").SetValue(preset.selectedLUT);

                        Texture2D texture2D = new Texture2D(1024, 32, TextureFormat.ARGB32, false, true);

                        byte[] Ldata = File.ReadAllBytes(path);
                        texture2D.LoadImage(Ldata);
                        texture2D.filterMode = FilterMode.Trilinear;
                        texture2D.anisoLevel = 0;
                        texture2D.wrapMode   = TextureWrapMode.Repeat;

                        PPCtrl_obj.userLut.lut          = texture2D;
                        PPCtrl_obj.userLut.contribution = preset.contributionLUT;
                        PPCtrl_obj.controlUserLut       = true;
                        PPCtrl_obj.enableUserLut        = true;
                    }
                }
            }
            else
            {
                PPCtrl_obj.enableUserLut = false;
            }

            Console.WriteLine("[PHIBL_PresetLoad] Loaded preset: " + presets[presetID].name);
        }