private void InitFullscreenEffects() { if (motionBlur != null) { // because our camera stays stationary whilst the geometry scrolls past, the normal calculation of // camera motion blur won't work. Instead we use the 'preview' mode to simulate a particular camera velocity. motionBlur.preview = true; motionBlur.previewScale = Vector3.zero; if (Application.isMobilePlatform && disableMotionBlurOnMobile) { motionBlur.enabled = false; } } if (screenBlur != null && Application.isMobilePlatform && disableMenuBlurOnMobile) { screenBlur.enabled = false; screenBlur = null; } // antialiasing is expensive, and not really necessary on mobile due to the much higher dpi Antialiasing aaFilter = GameObject.FindObjectOfType <Antialiasing>(); if (aaFilter != null && Application.isMobilePlatform) { aaFilter.enabled = false; } }
/// <summary>Create a line from start to end points, in pixels. /// <para>Using Bresenham's Line Algorithm.</para></summary> /// <param name="_nStartPoint">Starting point of the line, in pixels.</param> /// <param name="_nEndPoint">Ending point of the line, in pixels.</param> /// <param name="_ableAA">Determines to enable/disable antialiasing.</param> /// <param name="_fillMode">Determines the fill in mode.</param> public void CreateLine(Vector2 _nStartPoint, Vector2 _nEndPoint, Antialiasing _ableAA, FillMode _fillMode) { AddVector(new List <Vector2> { _nStartPoint, _nEndPoint }); CreateLine((int)_nStartPoint.X, (int)_nStartPoint.Y, (int)_nEndPoint.X, (int)_nEndPoint.Y, _ableAA, _fillMode); }
private static void LoadDefaults() { resolution = Screen.currentResolution; fullscreen = Screen.fullScreen; antialiasing = Antialiasing.Ultra; shadows = Shadows.High; bloom = Bloom.High; motionBlur = MotionBlur.High; }
// Use this for initialization void Start () { cam = Camera.main; gob = cam.gameObject; bloom = gob.GetComponent<BloomOptimized>(); aa = gob.GetComponent<Antialiasing>(); InvokeRepeating("CheckEffects", 0, checkEffectsTime); }
public SFont(string font_name, int size, int thick, Antialiasing a_type, int edge_size) { int a_type_int = DX.DX_FONTTYPE_NORMAL; switch (a_type) { case Antialiasing.Normal: a_type_int = DX.DX_FONTTYPE_ANTIALIASING; break; } font_handle = DX.CreateFontToHandle(font_name, size, thick, a_type_int, DX.DX_CHARSET_DEFAULT, edge_size); }
IEnumerator TakeAPictureObject(short Res) // Этот метод делает скриншот объекта или улучшения { RenderTexture RendTex = new RenderTexture(Res, Res, 24, RenderTextureFormat.ARGB32); // Рендер текстура в которую сначала будет рендериться изображение Instantiate(Fotographer, new Vector3(-5, 100, -1.4f), Quaternion.identity); // Помещаем на сцену клон префаба фотографа GameObject CamClone = GameObject.Find("Fotographer(Clone)"); // Находим на сцене объект фотограф и ложим его в переменную CamClone Antialiasing Smooth = CamClone.GetComponent <Antialiasing>(); // Ложим скрипт сглавживание в переменную Smooth CamComponent = CamClone.GetComponent <Camera>(); // Достаём компонент камера из объекта cam и ложим в переменную CamClone CamComponent.targetTexture = RendTex; // Устанавливаем для 2ой камеры рендер текстуру Smooth.edgeSharpness = SharpStrength; // Устанавливаем силу пиксельности указанную в переменной SharpStrength CamComponent.pixelRect = new Rect(0, 0, Res, Res); // Устанавливаем разрешение для второй камеры Smooth.mode = AAMode.NFAA; // Ставим режим сглаживания NFAA if (PhotographingMode == Mode.FotoMaterial) // Если режим фотографии FotoMaterial { Light Light = CamClone.gameObject.GetComponentInChildren <Light>(); // Ложим свет в переменную Light Light.intensity = 6f; // Ставим интенсивность света на 0.5f ObjClone = (GameObject)(Instantiate(Obj, new Vector3(-5, 100f, 0f), Quaternion.AngleAxis(90, new Vector3(-1, 0, 0)))); // Помещаем клон "Цели" на сцену под углом 90 градусов а также в переменную ObjClone if (ObjClone.tag != "Table") { ObjClone.GetComponent <Renderer>().material = ObjClone.GetComponent <ObjectScript>().FirstMaterials[NomberFotoMatrial]; // Меняем на материал с номером указанным в переменной NomberFotoMatrial } if (ObjClone.tag == "Table") { ObjClone.transform.GetChild(2).GetComponent <Renderer>().material = ObjClone.GetComponent <ObjectScript>().FirstMaterials[NomberFotoMatrial]; // Присваиваем материал бордюру стола ObjClone.transform.GetChild(1).GetComponent <Renderer>().material = ObjClone.GetComponent <ObjectScript>().SecondMaterials[NomberFotoMatrial]; // Присваиваем первый материал полю стола } } else // Иначе если режим фотографии другой { ObjClone = (GameObject)(Instantiate(Obj, new Vector3(-5, 100.12f, 0f), Quaternion.AngleAxis(45, new Vector3(-1, 0, 0)))); // Помещаем клон "Цели" на сцену под углом 45 градусов а также в переменную ObjClone } if (PhotographingMode == Mode.FotoObject || PhotographingMode == Mode.FotoMaterial) // Если режим фотографии FotoObject или FotoMaterial { CamComponent.clearFlags = CameraClearFlags.SolidColor; // То настраиваем камеру на фотографию объекта без заднего фона } texture = new Texture2D(Res, Res, TextureFormat.ARGB32, false); // Создаём текстуру 2D в переменной texure float Size = Obj.GetComponent <ObjectScript>().ViewSize; // Берём размер объекта для фотографии и копируем его в переменную Size Vector3 Size3 = new Vector3(Size, Size, Size); // Создаём новый вектор3 с именем Size3 и заполняем все его оси из переменной Size ObjClone.transform.localScale = Size3; // Придаём клону объекта размер указанный в Size3 yield return(new WaitForEndOfFrame()); // Ждём конца отрисовки текущего кадра CamComponent.Render(); // Рендерим изображение с камеры клона в рендер текстуру RenderTexture.active = RendTex; // Указываем активную рендер текстуру откуда считаем методом ReadPixels texture.ReadPixels(new Rect(0, 0, Res, Res), 0, 0, false); // Читаем изображение в переменную texture texture.Apply(); // Применяем текстуру bytes = texture.EncodeToPNG(); // Превращаем нашу текстуру в поток битов и ложим их в массив "bytes" File.WriteAllBytes("Temp/Screens/" + Obj.name + ".png", bytes); // Сохраняем фотографию в файл }
static bool Prefix(ref RenderTexture source, ref RenderTexture destination, Antialiasing __instance) { if (!__instance.CheckResources()) { Graphics.Blit(source, destination); return(false); } var materialFXAAPreset3 = Traverse.Create(__instance).Field("materialFXAAPreset3").GetValue <Material>(); if (materialFXAAPreset3 != null) { Graphics.Blit(source, destination, materialFXAAPreset3); return(false); } Graphics.Blit(source, destination); return(false); }
/// <summary>Calculate shape.</summary> /// <param name="_nStartX">Starting x-coordinate, in pixels.</param> /// <param name="_nStartY">Starting y-coordinate, in pixels.</param> /// <param name="_nEndX">Ending x-coordinate, in pixels.</param> /// <param name="_nEndY">Ending y-coordinate, in pixels.</param> /// <param name="_ableAA">Determines to enable/disable antialiasing.</param> /// <param name="_fillMode">Determines the fill in mode.</param> private void CalculateShape(int _nStartX, int _nStartY, int _nEndX, int _nEndY, Antialiasing _ableAA, FillMode _fillMode) { m_Antialiasing = _ableAA; switch (_ableAA) { case Antialiasing.Enabled: XiaolinWuLine(_nStartX, _nStartY, _nEndX, _nEndY); break; case Antialiasing.Disabled: BresenhamLine(_nStartX, _nStartY, _nEndX, _nEndY); break; default: break; } switch (_fillMode) { case FillMode.Outline: { //m_Effect.EnableDefaultLighting(); m_Effect.TextureEnabled = true; m_Effect.Texture = m_PixelTexture; CalculateOutlineShape(WindingOrder.CounterClockwise); } break; case FillMode.Fill: { m_Effect.TextureEnabled = false; m_Effect.Texture = null; CalculateFillInShape(WindingOrder.CounterClockwise); } break; default: break; } m_FillMode = _fillMode; }
private void Start() { musicManager = GameObject.FindObjectOfType <MusicManager>(); soundFXManager = GameObject.FindObjectOfType <SoundFXManager>(); motionBlur = camera.GetComponent <MotionBlur>(); depthOfField = camera.GetComponent <DepthOfField>(); SSAO = camera.GetComponent <ScreenSpaceAmbientOcclusion>(); noiseAndGrain = camera.GetComponent <NoiseAndGrain>(); bloom = camera.GetComponent <Bloom>(); antiAliasing = camera.GetComponent <Antialiasing>(); fpsCap = GameObject.FindObjectOfType <FPS_Cap>(); musicScrollbar.value = PlayerPrefsManager.GetMusicVolume(); soundFXScrollbar.value = PlayerPrefsManager.GetSoundFXVolume(); motionBlurScrollbar.value = PlayerPrefsManager.GetMotionBlur(); depthOfFieldScrollbar.value = PlayerPrefsManager.GetDepthOfField(); SSAOScrollbar.value = PlayerPrefsManager.GetSSAO(); noiseAndGrainToggle.isOn = PlayerPrefsManager.GetNoiseAndGrain(); bloomToggle.isOn = PlayerPrefsManager.GetBloom(); antiAliasingDropdown.value = PlayerPrefsManager.GetAntiAliasing(); targetFrameRateDropdown.value = PlayerPrefsManager.GetTargetFramerate(); }
private void CreateBuffers() { hightlightRT = new RenderTexture(Screen.width, Screen.height, 0); rtID = new RenderTargetIdentifier(hightlightRT); buffer = new CommandBuffer(); blur = new BlurOptimized(); blur.blurShader = Shader.Find("Hidden/FastBlur"); blur.blurSize = 0.8f; blur.blurIterations = 2; blur.downsample = 2; blur.blurType = BlurOptimized.BlurType.StandardGauss; antialiasing = new Antialiasing(); antialiasing.shaderFXAAPreset2 = Shader.Find("Hidden/FXAA Preset 2"); antialiasing.shaderFXAAPreset3 = Shader.Find("Hidden/FXAA Preset 3"); antialiasing.shaderFXAAII = Shader.Find("Hidden/FXAA II"); antialiasing.shaderFXAAIII = Shader.Find("Hidden/FXAA III (Console)"); antialiasing.dlaaShader = Shader.Find("Hidden/DLAA"); antialiasing.ssaaShader = Shader.Find("Hidden/SSAA"); antialiasing.nfaaShader = Shader.Find("Hidden/NFAA"); antialiasing.mode = AAMode.FXAA1PresetA; }
/// <summary>Create a triangle from start to end points, in pixels. /// <para>Using Bresenham's Line Algorithm.</para></summary> /// <param name="_nStartX">Starting x-coordinate, in pixels.</param> /// <param name="_nStartY">Starting y-coordinate, in pixels.</param> /// <param name="_nEndX">Ending x-coordinate, in pixels.</param> /// <param name="_nEndY">Ending y-coordinate, in pixels.</param> /// <param name="_ableAA">Determines to enable/disable antialiasing.</param> /// <param name="_fillMode">Determines the fill in mode.</param> private void CreateTriangle(int _nStartX, int _nStartY, int _nEndX, int _nEndY, Antialiasing _ableAA, FillMode _fillMode) { CalculateShape(_nStartX, _nStartY, _nEndX, _nEndY, _ableAA, _fillMode); }
/// <summary>Create a triangle primitive.</summary> /// <param name="_vPoint1">Fist point, in pixels.</param> /// <param name="_vPoint2">Second point, in pixels.</param> /// <param name="_vPoint3">Third point, in pixels.</param> /// <param name="_ableAA">Determines to enable/disable antialiasing.</param> /// <param name="_fillMode">Determines the fill in mode.</param> public void CreateTriangle(Vector2 _vPoint1, Vector2 _vPoint2, Vector2 _vPoint3, Antialiasing _ableAA, FillMode _fillMode) { AddVector(new List <Vector2> { _vPoint1, _vPoint2, _vPoint3 }); CreateTriangle((int)_vPoint1.X, (int)_vPoint1.Y, (int)_vPoint2.X, (int)_vPoint2.Y, _ableAA, _fillMode); CreateTriangle((int)_vPoint3.X, (int)_vPoint3.Y, (int)_vPoint2.X, (int)_vPoint2.Y, _ableAA, _fillMode); CreateTriangle((int)_vPoint3.X, (int)_vPoint3.Y, (int)_vPoint1.X, (int)_vPoint1.Y, _ableAA, _fillMode); }
// Use this for initialization void Start() { standardAA = gameObject.AddComponent<Antialiasing>(); standardAA.ssaaShader = Shader.Find("Hidden/SSAA"); standardAA.dlaaShader = Shader.Find("Hidden/DLAA"); standardAA.nfaaShader = Shader.Find("Hidden/NFAA"); standardAA.shaderFXAAPreset2 = Shader.Find("Hidden/FXAA Preset 2"); standardAA.shaderFXAAPreset3 = Shader.Find("Hidden/FXAA Preset 3"); standardAA.shaderFXAAII = Shader.Find("Hidden/FXAA II"); standardAA.shaderFXAAIII = Shader.Find("Hidden/FXAA III (Console)"); cinematicAA = gameObject.AddComponent<AntiAliasing>(); temporalAA = gameObject.AddComponent<TemporalAntiAliasing>(); samplingAA = gameObject.AddComponent<SuperSampling>(); }
public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (TextureQuality != 0) { hash ^= TextureQuality.GetHashCode(); } if (ShaderLod != 0) { hash ^= ShaderLod.GetHashCode(); } if (DefaultTargetFps != 0) { hash ^= DefaultTargetFps.GetHashCode(); } if (Antialiasing != 0) { hash ^= Antialiasing.GetHashCode(); } if (AnisotropicFiltering != 0) { hash ^= AnisotropicFiltering.GetHashCode(); } if (BillboardsFaceCameraPosition != false) { hash ^= BillboardsFaceCameraPosition.GetHashCode(); } if (RealtimeShadows != 0) { hash ^= RealtimeShadows.GetHashCode(); } if (ArAzimuthBlurring != false) { hash ^= ArAzimuthBlurring.GetHashCode(); } hash ^= GamemodeOverrides.GetHashCode(); if (ArEncounterParticleCap != 0) { hash ^= ArEncounterParticleCap.GetHashCode(); } if (LockedEncounterParticleCap != 0) { hash ^= LockedEncounterParticleCap.GetHashCode(); } if (MenuParticleCap != 0) { hash ^= MenuParticleCap.GetHashCode(); } if (ArAzimuthColorGrading != false) { hash ^= ArAzimuthColorGrading.GetHashCode(); } if (ShadowMapSize != 0) { hash ^= ShadowMapSize.GetHashCode(); } if (EncounterCameraTargetScaling != 0) { hash ^= EncounterCameraTargetScaling.GetHashCode(); } if (AdvancedArCameraResolution != 0) { hash ^= AdvancedArCameraResolution.GetHashCode(); } if (VfxLod != 0) { hash ^= VfxLod.GetHashCode(); } if (ForceSimpleAr != false) { hash ^= ForceSimpleAr.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
// Use this for initialization void Start() { manager = GameObject.FindWithTag("GameController"); if (numberOfCameras > 3) { cameras = GameObject.FindGameObjectsWithTag("MainCamera"); } else { cameras = new GameObject[numberOfCameras]; if (numberOfCameras == 3) { cameras[0] = startCamera; cameras[1] = secondCamera; cameras[2] = lastCamera; } else if (numberOfCameras == 1) { cameras[0] = startCamera; } Grays = new List <Grayscale>(); Sepias = new List <SepiaTone>(); Blooms = new List <Bloom>(); Fogs = new List <GlobalFog>(); Antis = new List <Antialiasing>(); DOFs = new List <DepthOfField>(); Fishes = new List <Fisheye>(); Shafts = new List <SunShafts>(); foreach (var item in cameras) { item.AddComponent <Grayscale>(); Grayscale gs = item.GetComponent <Grayscale>(); Grayscale mgs = manager.GetComponent <Grayscale>(); gs.shader = mgs.shader; gs.rampOffset = mgs.rampOffset; Grays.Add(gs); item.AddComponent <SepiaTone>(); SepiaTone st = item.GetComponent <SepiaTone>(); st.shader = manager.GetComponent <SepiaTone>().shader; Sepias.Add(st); item.AddComponent <Bloom>(); //print(name + " " + item.name); Bloom bm = item.GetComponent <Bloom>(); Bloom mbm = manager.GetComponent <Bloom>(); bm.blurAndFlaresShader = mbm.blurAndFlaresShader; bm.brightPassFilterShader = mbm.brightPassFilterShader; bm.lensFlareShader = mbm.lensFlareShader; bm.screenBlendShader = mbm.screenBlendShader; bm.bloomThreshold = mbm.bloomThreshold; bm.bloomIntensity = mbm.bloomIntensity; Blooms.Add(bm); item.AddComponent <GlobalFog>(); GlobalFog gf = item.GetComponent <GlobalFog>(); GlobalFog mgf = manager.GetComponent <GlobalFog>(); gf.fogShader = mgf.fogShader; gf.excludeFarPixels = mgf.excludeFarPixels; gf.height = mgf.height; gf.heightDensity = mgf.heightDensity; gf.startDistance = mgf.startDistance; Fogs.Add(gf); item.AddComponent <Antialiasing>(); Antialiasing ai = item.GetComponent <Antialiasing>(); Antialiasing mai = manager.GetComponent <Antialiasing>(); ai.shaderFXAAIII = mai.shaderFXAAIII; ai.ssaaShader = mai.ssaaShader; ai.edgeSharpness = mai.edgeSharpness; ai.shaderFXAAII = mai.shaderFXAAII; ai.shaderFXAAPreset2 = mai.shaderFXAAPreset2; ai.shaderFXAAPreset3 = mai.shaderFXAAPreset3; ai.dlaaShader = mai.dlaaShader; ai.nfaaShader = mai.nfaaShader; Antis.Add(ai); item.AddComponent <DepthOfField>(); DepthOfField dof = item.GetComponent <DepthOfField>(); DepthOfField mdof = manager.GetComponent <DepthOfField>(); dof.dofHdrShader = mdof.dofHdrShader; dof.dx11BokehShader = mdof.dx11BokehShader; dof.focalSize = mdof.focalSize; dof.aperture = mdof.aperture; dof.focalTransform = transform; DOFs.Add(dof); item.AddComponent <Fisheye>(); Fisheye fe = item.GetComponent <Fisheye>(); Fisheye mfe = manager.GetComponent <Fisheye>(); fe.fishEyeShader = mfe.fishEyeShader; fe.strengthX = mfe.strengthX; fe.strengthY = mfe.strengthY; Fishes.Add(fe); item.AddComponent <SunShafts>(); SunShafts ss = item.GetComponent <SunShafts>(); SunShafts mss = manager.GetComponent <SunShafts>(); ss.simpleClearShader = mss.simpleClearShader; ss.sunShaftsShader = mss.sunShaftsShader; ss.sunShaftIntensity = mss.sunShaftIntensity; ss.radialBlurIterations = mss.radialBlurIterations; ss.maxRadius = mss.maxRadius; ss.radialBlurIterations = mss.radialBlurIterations; ss.resolution = mss.resolution; ss.screenBlendMode = mss.screenBlendMode; ss.sunColor = mss.sunColor; ss.sunShaftBlurRadius = mss.sunShaftBlurRadius; ss.sunThreshold = mss.sunThreshold; ss.sunTransform = mss.sunTransform; ss.useDepthTexture = mss.useDepthTexture; Shafts.Add(ss); } foreach (Grayscale item in Grays) { item.enabled = false; } foreach (SepiaTone item in Sepias) { item.enabled = false; } foreach (Bloom item in Blooms) { item.enabled = false; } foreach (GlobalFog item in Fogs) { item.enabled = false; } foreach (DepthOfField item in DOFs) { item.enabled = false; } foreach (Antialiasing item in Antis) { item.enabled = false; } foreach (Fisheye item in Fishes) { item.enabled = false; } foreach (SunShafts item in Shafts) { item.enabled = false; } } curentKeyIndex = 0; if (SceneManager.GetActiveScene().buildIndex != 0) { setTop(); } }
public FontGenerator(string filename, int fontSize = 40, Antialiasing aa = Antialiasing.MonocolorAlpha) { this.filename = filename; this.fontSize = fontSize; this.aa = aa; }
public static Font LoadFromTruetypeFont(GraphicsDevice device, string filename, int fontSize, Antialiasing aa = Antialiasing.MonocolorAlpha) { var gen = new FontGenerator(filename, fontSize, aa); var(img, glyphs) = gen.Generate(); return(Create(device, img, glyphs)); }