public SceneBase CreateAmbientOcclusion(Observer.ISceneObserver obs) { SceneBase scene = new AmbientOcclusion(); scene.RegisterObserver(obs); return(scene); }
void Start() { //Data.Zenith = -0.4f; //Data.Length = CameraLength; zoomTemp = CameraLength; if (GameApp.Instance.GetParameter("EnableDepthOfField") > 0) { DepthOfField dof = FightCamera.gameObject.GetComponent <DepthOfField>(); if (dof != null) { dof.enabled = true; } } if (GameApp.Instance.GetParameter("EnableBloom") > 0) { Bloom b = FightCamera.gameObject.GetComponent <Bloom>(); if (b != null) { b.enabled = true; } } if (GameApp.Instance.GetParameter("EnableAmbientOcclusion") > 0) { AmbientOcclusion ao = FightCamera.gameObject.GetComponent <AmbientOcclusion>(); if (ao != null) { ao.enabled = true; } } }
public void TryUpateAmbientOcclusionIntensity() { PostProcessVolume volume = GameManager.Instance.PostProcessVolume; if (!volume) { return; } AmbientOcclusion ambientOcclusion = null; if (volume.profile.TryGetSettings(out ambientOcclusion)) { if (DaggerfallUnity.Settings.AmbientOcclusionIntensity == 0) { // Disable AO when intensity is set to 0 ambientOcclusion.enabled.value = false; } else { // Enable AO when intensity is greater than 0 and assign intensity from settings ambientOcclusion.enabled.value = true; ambientOcclusion.intensity.value = DaggerfallUnity.Settings.AmbientOcclusionIntensity; } } }
void Awake() { chromaticAberration = profile.GetSetting <ChromaticAberration>(); ambientOcclusion = profile.GetSetting <AmbientOcclusion>(); grain = profile.GetSetting <Grain>(); lensDistortion = profile.GetSetting <LensDistortion>(); }
protected override void InitValue() { slider.value = Convert.ToInt32(GameSettings.Instance.camera.SSAO); valueLabel.text = GameSettings.Instance.camera.SSAO.ToString(); ssao = cam.GetComponent <AmbientOcclusion>(); ssao.enabled = GameSettings.Instance.camera.SSAO; }
public void TestCase3() { using (var stream = File.OpenRead("3x3x3.vox")) { var voxelData = MagicaVoxel.Read(stream); Assert.AreEqual(3, AmbientOcclusion.CalculateAO(voxelData, new XYZ(2, 2, 2), XYZ.OneY, XYZ.OneX, XYZ.OneZ)); } }
private void applyConfig() { if (m_activeConfig.enabled) { // Find any existing ambient occlusion. if (m_component == null) { m_component = ModDescription.camera.GetComponent <AmbientOcclusion>(); } // Add it if it was not available. if (m_component == null) { m_component = ModDescription.camera.AddComponent <AmbientOcclusion>(); if (m_component == null) { m_activeConfig.enabled = false; throw new Exception("Couldn't add AmbientOcclusion to Camera."); } } m_component.settings.intensity = m_activeConfig.intensity; m_component.settings.radius = m_activeConfig.radius; m_component.settings.sampleCount = m_activeConfig.sampleCount; m_component.settings.occlusionSource = m_activeConfig.source; m_component.settings.downsampling = m_activeConfig.downsampling; m_component.enabled = true; } else { disable(); } }
static void Draw_Settings_SSAO(GraphicSystem data, bool draw = true) { if (!data.SSAO) { return; } for (int i = 0; i < _ao.Count; i++) { AmbientOcclusion obj = _ao[i]; string name = $"[Amb.Occ.{i}] "; obj.enabled.value = Field($"{name}Enabled", obj.enabled.value, draw); obj.ambientOnly.value = Field($"{name}Ambient Only", obj.ambientOnly.value, draw); obj.blurTolerance.value = Field($"{name}Blur Tolerance", obj.blurTolerance.value, draw); obj.directLightingStrength.value = Field($"{name}Direct Lighting Strength", obj.directLightingStrength.value, draw); obj.intensity.value = Field($"{name}Intensity", obj.intensity.value, draw); obj.noiseFilterTolerance.value = Field($"{name}Noise Filter Tolerance", obj.noiseFilterTolerance.value, draw); obj.radius.value = Field($"{name}Radius", obj.radius.value, draw); obj.thicknessModifier.value = Field($"{name}Thickness Modifier", obj.thicknessModifier, draw); obj.upsampleTolerance.value = Field($"{name}Upsample Tolerance", obj.upsampleTolerance, draw); obj.mode.value = Field($"{name}Mode", obj.mode.value, draw); obj.quality.value = Field($"{name}Quality", obj.quality.value, draw); } }
static void RenderTriangles(VoxelData voxelData, int size, SKCanvas canvas, MeshSettings settings) { var matrix = GetMatrix(voxelData, size); settings.MeshType = MeshType.Triangles; var triangles = new MeshBuilder(voxelData, settings); using (var fill = new SKPaint()) { var vertices = triangles.Vertices .Select(v => matrix.MapScalars(v.X, v.Z, -v.Y, 1f)) .Select(v => new SKPoint(v[0], v[1])) .ToArray(); var colors = triangles.Colors; var occlusion = triangles.Occlusion; var indices = triangles.Faces; // Render triangles in batches since SkiaSharp DrawVertices indices are 16 bit which fails for large files var batchSize = 3 * 20000; // up to 20000 triangles per batch for (var i = 0; i < indices.Length; i += batchSize) { var batch = Enumerable.Range(i, Math.Min(batchSize, indices.Length - i)); var _vertices = batch.Select(j => vertices[indices[j]]).ToArray(); var _colors = batch.Select(j => AmbientOcclusion.CombineColorOcclusion(colors[indices[j]], occlusion[indices[j]])).Select(ToSKColor).ToArray(); var _indices = batch.Select(j => (ushort)(j - i)).ToArray(); canvas.DrawVertices(SKVertexMode.Triangles, _vertices, null, _colors, _indices, fill); } } }
public void disable() { if (m_component != null) { MonoBehaviour.DestroyImmediate(m_component); m_component = null; } }
private void PreparePropertySheet(PostProcessRenderContext ctx, AmbientOcclusion settings) { var sheet = ctx.propertySheets.Get(PostProcessResources.shaders.multiScaleAO); sheet.ClearKeywords(); sheet.properties.SetVector(ShaderIDsAOColor, Color.white - settings.color.value); PropertySheet = sheet; }
void Start() { Oclussion = Volume.profile.GetSetting <AmbientOcclusion>(); Grading = Volume.profile.GetSetting <ColorGrading>(); PlayerManager.NormalOclussion += (sender, args) => NormalOclussion(); PlayerManager.OrangeOclussion += (sender, args) => OrangeOclussion(); }
protected override void Awake() { if (!postProcessingProfile.TryGetSettings <AmbientOcclusion>(out ao)) //Try to get the setting override { ao = postProcessingProfile.AddSettings <AmbientOcclusion>(); //Create one if it can't be found } base.Awake(); }
// Token: 0x06000C15 RID: 3093 RVA: 0x0004BDB0 File Offset: 0x00049FB0 public void ApplyAmbientOcclusionSetting() { if (!XRDevice.isPresent) { AmbientOcclusion ambientOcclusion = null; this.postProcessingVolume.profile.TryGetSettings <AmbientOcclusion>(out ambientOcclusion); ambientOcclusion.enabled.value = (PlayerPrefs.GetInt("ambientOcclusion") == 1); } }
internal void InitializeProfiles() { if (!SettingValues.profile.TryGetSettings(out chromaticAberrationLayer)) { chromaticAberrationLayer = SettingValues.profile.AddSettings <ChromaticAberration>(); } if (!SettingValues.profile.TryGetSettings(out grainLayer)) { grainLayer = SettingValues.profile.AddSettings <Grain>(); } if (!SettingValues.profile.TryGetSettings(out ambientOcclusionLayer)) { ambientOcclusionLayer = SettingValues.profile.AddSettings <AmbientOcclusion>(); } if (!SettingValues.profile.TryGetSettings(out autoExposureLayer)) { autoExposureLayer = SettingValues.profile.AddSettings <AutoExposure>(); } if (!SettingValues.profile.TryGetSettings(out bloomLayer)) { bloomLayer = SettingValues.profile.AddSettings <Bloom>(); } if (!SettingValues.profile.TryGetSettings(out colorGradingLayer)) { colorGradingLayer = SettingValues.profile.AddSettings <ColorGrading>(); } if (!SettingValues.profile.TryGetSettings(out depthOfFieldLayer)) { depthOfFieldLayer = SettingValues.profile.AddSettings <DepthOfField>(); } if (!SettingValues.profile.TryGetSettings(out screenSpaceReflectionsLayer)) { screenSpaceReflectionsLayer = SettingValues.profile.AddSettings <ScreenSpaceReflections>(); } if (!SettingValues.profile.TryGetSettings(out vignetteLayer)) { vignetteLayer = SettingValues.profile.AddSettings <Vignette>(); } if (!SettingValues.profile.TryGetSettings(out motionBlurLayer)) { motionBlurLayer = SettingValues.profile.AddSettings <MotionBlur>(); motionBlurLayer.enabled.value = false; } depthOfFieldLayer.enabled.value = false; // Make people use Depth of Field Manually }
private void Awake() { raycaster = GetComponent <GraphicRaycaster>(); postProcessVolume = Camera.main.GetComponent <PostProcessVolume>(); postProcessLayer = Camera.main.GetComponent <PostProcessLayer>(); autoExposure = postProcessVolume.profile.GetSetting <AutoExposure>(); bloom = postProcessVolume.profile.GetSetting <Bloom>(); vignette = postProcessVolume.profile.GetSetting <Vignette>(); ambientOcclusion = postProcessVolume.profile.GetSetting <AmbientOcclusion>(); }
public void TestCaseComplex() { using (var stream = File.OpenRead("2x2x2.vox")) { var voxelData = MagicaVoxel.Read(stream); Assert.AreEqual(0, AmbientOcclusion.CalculateAO(voxelData, new XYZ(0, 0, 0), XYZ.OneY, XYZ.OneX, XYZ.OneZ)); Assert.AreEqual(0, AmbientOcclusion.CalculateAO(voxelData, new XYZ(0, 1, 1), XYZ.OneX, -XYZ.OneZ, -XYZ.OneY)); Assert.AreEqual(0, AmbientOcclusion.CalculateAO(voxelData, new XYZ(1, 0, 1), -XYZ.OneZ, XYZ.OneY, -XYZ.OneX)); Assert.AreEqual(2, AmbientOcclusion.CalculateAO(voxelData, new XYZ(0, 0, 0), -XYZ.OneX, XYZ.OneY, XYZ.OneZ)); Assert.AreEqual(2, AmbientOcclusion.CalculateAO(voxelData, new XYZ(0, 0, 0), XYZ.OneX, -XYZ.OneY, XYZ.OneZ)); Assert.AreEqual(3, AmbientOcclusion.CalculateAO(voxelData, new XYZ(0, 0, 0), -XYZ.OneX, -XYZ.OneY, XYZ.OneZ)); } }
// Token: 0x06000A19 RID: 2585 RVA: 0x0003E6D8 File Offset: 0x0003C8D8 private void SetValues() { PlayerPrefs.SetInt("resolutionValue", this.resolutionValue); PlayerPrefs.SetInt("fullscreenType", this.fullscreenType); PlayerPrefs.SetInt("taaValue", this.taaValue); PlayerPrefs.SetInt("shadowType", this.shadowType); PlayerPrefs.SetInt("shadowRes", this.shadowRes); PlayerPrefs.SetInt("textureRes", this.textureRes); PlayerPrefs.SetInt("anisotropic", this.anisotropic); PlayerPrefs.SetInt("ambientOcclusion", this.ambientOcclusion); PlayerPrefs.SetInt("bloom", this.bloom); QualitySettings.shadows = this.GetShadowQuality(); QualitySettings.shadowResolution = this.GetShadowResolution(); QualitySettings.masterTextureLimit = this.textureRes; QualitySettings.anisotropicFiltering = this.GetAnisotropic(); if (this.resolutionValue > Screen.resolutions.Length - 1 || this.resolutionValue < 0) { this.resolutionValue = Screen.resolutions.Length - 1; PlayerPrefs.SetInt("resolutionValue", Screen.resolutions.Length - 1); } Screen.SetResolution(Screen.resolutions[this.resolutionValue].width, Screen.resolutions[this.resolutionValue].height, this.fullscreenType == 1); if (!XRDevice.isPresent) { AmbientOcclusion ambientOcclusion = null; MainManager.instance.localPlayer.postProcessingVolume.profile.TryGetSettings <AmbientOcclusion>(out ambientOcclusion); ambientOcclusion.enabled.value = (PlayerPrefs.GetInt("ambientOcclusion") == 1); this.sceneCamVolume.profile.TryGetSettings <AmbientOcclusion>(out ambientOcclusion); ambientOcclusion.enabled.value = (PlayerPrefs.GetInt("ambientOcclusion") == 1); if (PlayerPrefs.GetInt("taaValue") == 0) { MainManager.instance.localPlayer.postProcessingLayer.antialiasingMode = PostProcessLayer.Antialiasing.None; this.sceneCamLayer.antialiasingMode = PostProcessLayer.Antialiasing.None; } else { MainManager.instance.localPlayer.postProcessingLayer.antialiasingMode = PostProcessLayer.Antialiasing.FastApproximateAntialiasing; this.sceneCamLayer.antialiasingMode = PostProcessLayer.Antialiasing.FastApproximateAntialiasing; } } PlayerPrefs.SetFloat("brightnessValue", this.brightnessValue); ColorGrading colorGrading = null; MainManager.instance.localPlayer.postProcessingVolume.profile.TryGetSettings <ColorGrading>(out colorGrading); colorGrading.postExposure.value = PlayerPrefs.GetFloat("brightnessValue"); this.sceneCamVolume.profile.TryGetSettings <ColorGrading>(out colorGrading); colorGrading.postExposure.value = PlayerPrefs.GetFloat("brightnessValue"); Bloom bloom = null; MainManager.instance.localPlayer.postProcessingVolume.profile.TryGetSettings <Bloom>(out bloom); bloom.enabled.value = (PlayerPrefs.GetInt("bloom") == 0); this.sceneCamVolume.profile.TryGetSettings <Bloom>(out bloom); bloom.enabled.value = (PlayerPrefs.GetInt("bloom") == 0); }
void Start() { plCam = GetComponent <OcPlCam>(); cam = GetComponent <Camera>(); head = FindObjectOfType <OcPlHeadPrefabSetting>(); var volume = FindObjectOfType <PostProcessVolume>(); var master = plCam.GetRefField <OcPlCam, OcPlMaster>("_Owner"); var playername = Settings.getPlayerName(master); if (Settings.ReadBool(playername, "UseBloom", false)) { bloom = volume.profile.GetSetting <Bloom>(); bloom.enabled.value = true; bloom.active = true; bloom.threshold.value = Settings.ReadFloat(playername, "BloomThreshold", 0.2f); bloom.intensity.value = Settings.ReadFloat(playername, "BloomIntensity", 0.5f); } if (Settings.ReadBool(playername, "UseAmbientOcclusion", false)) { ambientOcclusion = volume.profile.GetSetting <AmbientOcclusion>(); ambientOcclusion.enabled.value = true; ambientOcclusion.active = true; ambientOcclusion.intensity.value = Settings.ReadFloat(playername, "AmbientOcclusionInteisity", 1.0f); ambientOcclusion.thicknessModifier.value = 1.0f; ambientOcclusion.directLightingStrength.value = 1.0f; } if (Settings.ReadBool(playername, "UseVignette", false)) { vignette = volume.profile.GetSetting <Vignette>(); vignette.enabled.value = true; vignette.active = true; vignette.intensity.value = 0.45f; vignette.smoothness.value = 0.15f; vignette.roundness.value = 0.0f; } enableAdjustDoF = Settings.ReadBool(playername, "AdjustDoF", true); distanceRate = Settings.ReadFloat(playername, "CameraDistanceRate", 1.0f); basePos = plCam.SoCam.CamOfs_Base; swordPos = plCam.SoCam.CamOfs_Sword; sprintPos = plCam.SoCam.CamOfs_SprintStraight; swimPos = plCam.SoCam.CamOfs_Swim; jumpPos = plCam.SoCam.CamOfs_Jump; }
/* Change the ambient occlusion intensity factor, currently not used */ private void ChangeAmbientOcclusionFactor() { PostProcessVolume volume = Camera.main.transform.GetComponent <PostProcessVolume>(); AmbientOcclusion ao_effect = null; volume.profile.TryGetSettings(out ao_effect); if (visualization_method_ == VisualizationMethod.BALL_AND_STICK) { ao_effect.intensity.value = 1; } else { ao_effect.intensity.value = 0.5f; } }
void Start() { mainCam = Camera.main; presetsDropdown.value = QualitySettings.GetQualityLevel(); Refresh(); bloomScript = mainCam.GetComponent <Bloom>(); motionBlurScript = mainCam.GetComponent <MotionBlur>(); ambientOcclusionScript = mainCam.GetComponent <AmbientOcclusion>(); antiAliasingScript = mainCam.GetComponent <AntiAliasing>(); sunRaysScript = mainCam.GetComponent <TOD_Rays>(); cloudShadowsScript = mainCam.GetComponent <TOD_Shadows>(); lensAberrationsScript = mainCam.GetComponent <LensAberrations>(); fullscreenToggle.onValueChanged.AddListener(delegate { OnFullscreenToggle(); }); }
/// <summary> /// Adds configurable post-processing volume to scene /// </summary> private void AddVolume() { // Setup occlusion instance occlusionConfig = ScriptableObject.CreateInstance <AmbientOcclusion>(); // Create new volume GameObject volumeObj = new GameObject("Post-process Volume"); volume = volumeObj.AddComponent <PostProcessVolume>(); // Configure volume volume.profile.AddSettings(occlusionConfig); volume.isGlobal = true; volume.priority = float.MaxValue; // Update volume UpdateVolume(); }
// Token: 0x06000A18 RID: 2584 RVA: 0x0003E500 File Offset: 0x0003C700 private void LoadValues() { this.resolutionValue = PlayerPrefs.GetInt("resolutionValue"); this.fullscreenType = PlayerPrefs.GetInt("fullscreenType"); this.taaValue = PlayerPrefs.GetInt("taaValue"); this.shadowType = PlayerPrefs.GetInt("shadowType"); this.shadowRes = PlayerPrefs.GetInt("shadowRes"); this.textureRes = PlayerPrefs.GetInt("textureRes"); this.anisotropic = PlayerPrefs.GetInt("anisotropic"); this.ambientOcclusion = PlayerPrefs.GetInt("ambientOcclusion"); this.bloom = PlayerPrefs.GetInt("bloom"); this.brightnessValue = PlayerPrefs.GetFloat("brightnessValue"); this.brightnessSlider.value = this.brightnessValue; if (this.resolutionValue > Screen.resolutions.Length - 1 || this.resolutionValue < 0) { this.resolutionValue = Screen.resolutions.Length - 1; PlayerPrefs.SetInt("resolutionValue", Screen.resolutions.Length - 1); } QualitySettings.shadows = this.GetShadowQuality(); QualitySettings.shadowResolution = this.GetShadowResolution(); QualitySettings.masterTextureLimit = this.textureRes; QualitySettings.anisotropicFiltering = this.GetAnisotropic(); AmbientOcclusion ambientOcclusion = null; this.sceneCamVolume.profile.TryGetSettings <AmbientOcclusion>(out ambientOcclusion); ambientOcclusion.enabled.value = (PlayerPrefs.GetInt("ambientOcclusion") == 1); Bloom bloom = null; this.sceneCamVolume.profile.TryGetSettings <Bloom>(out bloom); bloom.enabled.value = (PlayerPrefs.GetInt("bloom") == 0); if (PlayerPrefs.GetInt("taaValue") == 0) { this.sceneCamLayer.antialiasingMode = PostProcessLayer.Antialiasing.None; } else { this.sceneCamLayer.antialiasingMode = PostProcessLayer.Antialiasing.FastApproximateAntialiasing; } ColorGrading colorGrading = null; this.sceneCamVolume.profile.TryGetSettings <ColorGrading>(out colorGrading); colorGrading.postExposure.value = PlayerPrefs.GetFloat("brightnessValue"); this.UpdateUIValues(); }
public void Start() { LockCursor(); postProcessVolume = Camera.main.GetComponent <PostProcessVolume>(); postProcessLayer = Camera.main.GetComponent <PostProcessLayer>(); autoExposure = postProcessVolume.profile.GetSetting <AutoExposure>(); bloom = postProcessVolume.profile.GetSetting <Bloom>(); vignette = postProcessVolume.profile.GetSetting <Vignette>(); ambientOcclusion = postProcessVolume.profile.GetSetting <AmbientOcclusion>(); if (PlayerPrefs.GetInt("set_defaults", 1) == 1) { RestoreDefaults(); } Preferences.UpdatePreferences(); UpdateUIValues(); }
// Start is called before the first frame update void Start() { p_ambientOcclusion = ScriptableObject.CreateInstance <AmbientOcclusion>(); p_chromaticAberation = ScriptableObject.CreateInstance <ChromaticAberration>(); p_bloom = ScriptableObject.CreateInstance <Bloom>(); p_colorGrading = ScriptableObject.CreateInstance <ColorGrading>(); p_motionBlur = ScriptableObject.CreateInstance <MotionBlur>(); p_screenSpaceReflections = ScriptableObject.CreateInstance <ScreenSpaceReflections>(); p_vignette = ScriptableObject.CreateInstance <Vignette>(); p_volume = PostProcessManager.instance.QuickVolume(gameObject.layer, 100f, p_ambientOcclusion, p_chromaticAberation, p_bloom, p_colorGrading, p_motionBlur, p_screenSpaceReflections, p_vignette); p_ambientOcclusion.enabled.Override(true); p_chromaticAberation.enabled.Override(true); p_bloom.enabled.Override(true); p_colorGrading.enabled.Override(true); p_motionBlur.enabled.Override(true); p_screenSpaceReflections.enabled.Override(true); p_vignette.enabled.Override(true); p_chromaticAberation.intensity.Override(1f); }
protected override void OnLoad(EventArgs e) { GL.ClearColor(Color4.DarkSlateGray); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.VertexProgramPointSize); program = new ShaderProgram() .AttachShader(Shader.FromFile("./Assets/Shader/Fragment.glsl", ShaderType.FragmentShader)) .AttachShader(Shader.FromFile("./Assets/Shader/Vertex.glsl", ShaderType.VertexShader)) .Link(); hudprogram = new ShaderProgram() .AttachShader(Shader.FromFile("./Assets/Shader/HudFragment.glsl", ShaderType.FragmentShader)) .AttachShader(Shader.FromFile("./Assets/Shader/HudVertex.glsl", ShaderType.VertexShader)) .Link(); texture = Texture.FromFiles(256, Block.Textures); texture.SetFiltering(TextureMinFilter.LinearMipmapLinear, TextureMagFilter.Linear); texture.SetLODBias(-0.7f); aoTexture = AmbientOcclusion.GetAOTexture4();//Texture.FromFile("./Assets/Textures/ao.png"); aoTexture.SetWarpMode(TextureWrapMode.MirroredRepeat); Console.WriteLine(GL.GetError()); camera = new Camera(75f * (float)Math.PI / 180, (float)Width / (float)Height, 0.1f, 300.0f) { Position = new Vector3(8, 50, 8) }; frustum = new Frustum(camera.CameraMatrix); world = new BlockWorld(); Resize += (sender, ea) => { GL.Viewport(0, 0, Width, Height); camera.Aspect = (float)Width / (float)Height; }; GC.Collect(); base.OnLoad(e); }
private void Start() { List <PostProcessVolume> postProcessVolumeList = ListPool <PostProcessVolume> .Get(); PostProcessManager.get_instance().GetActiveVolumes(this.PostProcessLayer, postProcessVolumeList, true, true); using (List <PostProcessVolume> .Enumerator enumerator = postProcessVolumeList.GetEnumerator()) { while (enumerator.MoveNext()) { PostProcessVolume current = enumerator.Current; Bloom setting1 = (Bloom)current.get_profile().GetSetting <Bloom>(); if (Object.op_Implicit((Object)setting1)) { this._bloom.Add(setting1); } AmbientOcclusion setting2 = (AmbientOcclusion)current.get_profile().GetSetting <AmbientOcclusion>(); if (Object.op_Inequality((Object)setting2, (Object)null) && ((PostProcessEffectSettings)setting2).active != null) { this._ao.Add(setting2); } ScreenSpaceReflections setting3 = (ScreenSpaceReflections)current.get_profile().GetSetting <ScreenSpaceReflections>(); if (Object.op_Inequality((Object)setting3, (Object)null) && ((PostProcessEffectSettings)setting3).active != null) { this._ssr.Add(setting3); } DepthOfField setting4 = (DepthOfField)current.get_profile().GetSetting <DepthOfField>(); if (Object.op_Inequality((Object)setting4, (Object)null) && ((PostProcessEffectSettings)setting4).active != null) { this._dof.Add(setting4); } Vignette setting5 = (Vignette)current.get_profile().GetSetting <Vignette>(); if (Object.op_Inequality((Object)setting5, (Object)null) && ((PostProcessEffectSettings)setting5).active != null) { this._vignette.Add(setting5); } } } this.Refresh(); }
public static void AOprocess(bool On) { AmbientOcclusion param = null; PostProcessVolume volume = Camera.main.gameObject.GetComponent <PostProcessVolume>(); // volume.profile.TryGetSettings(out bloomLayer); if (volume != null) { volume.profile.TryGetSettings(out param); if (param) { if (!On) { param.enabled.value = false; } else { param.enabled.value = true; } } } }
public static void VoxelsToUnity(GameObject go, Mesh mesh, VoxelData voxelData, MeshSettings settings) { // Recenter the .vox model so the bottom is at the origin var matrix = Matrix4x4.Translate(new Vector3(-voxelData.size.X * 0.5f, 0, -voxelData.size.Y * 0.5f)); // Convert a Voxel mesh to a Unity mesh var meshBuilder = new MeshBuilder(voxelData, settings); mesh.Clear(); mesh.vertices = meshBuilder.Vertices.Select(v => matrix.MultiplyPoint(new Vector3(v.X, v.Z, v.Y))).ToArray(); mesh.normals = meshBuilder.Normals.Select(n => matrix.MultiplyVector(new Vector3(n.X, n.Z, n.Y))).ToArray(); mesh.triangles = meshBuilder.Faces.Select(f => (int)f).ToArray(); // Combine occlusion with vertex colors var colors = meshBuilder.Colors; var occlusion = meshBuilder.Occlusion; mesh.colors32 = Enumerable.Range(0, meshBuilder.Colors.Length) .Select(i => AmbientOcclusion.CombineColorOcclusion(colors[i], occlusion[i])) .Select(c => new Color32(c.R, c.G, c.B, c.A)).ToArray(); // Set mesh filter mesh var meshFilter = go.GetComponent <MeshFilter>(); if (meshFilter == null) { meshFilter = go.AddComponent <MeshFilter>(); } meshFilter.sharedMesh = mesh; // Set mesh render material var meshRenderer = go.GetComponent <MeshRenderer>(); if (meshRenderer == null) { meshRenderer = go.AddComponent <MeshRenderer>(); } meshRenderer.sharedMaterial = Resources.Load <Material>(settings.FloorShadow ? "StandardTransparent" : "Standard"); }
public override void Reset() { ActiveLayer = true; ActiveEffect = true; ObjectProfile = null; Intensity = 0f; Radius = 0f; AoType = null; AOQuality = 0; AOColor = Color.black; AmbientOnly = false; ThicknessModifier = 1f; everyFrame = false; AoLayer = null; ActiveMode = true; ActiveIntensity = true; ActiveRadius = true; ActiveQuality = true; ActivateColor = true; ActivateAoOnly = true; ActivateThickness = true; }