Add beautify post process to project
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Beautify.Universal {
|
||||
public class CameraAnimator : MonoBehaviour {
|
||||
void Update() {
|
||||
transform.Rotate(new Vector3(0, 0, Time.deltaTime * 10f));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 883e769c58c564fb69c4a777b7280035
|
||||
timeCreated: 1473950280
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,105 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Beautify.Universal;
|
||||
using Input = Beautify.Demos.InputProxy;
|
||||
|
||||
namespace Beautify.Demos {
|
||||
|
||||
public class Demo : MonoBehaviour {
|
||||
|
||||
public Texture lutTexture;
|
||||
|
||||
private void Start() {
|
||||
UpdateText();
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (Input.GetKeyDown(KeyCode.J)) {
|
||||
BeautifySettings.settings.bloomIntensity.value += 0.1f;
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.T) || Input.GetMouseButtonDown(0)) {
|
||||
BeautifySettings.settings.disabled.value = !BeautifySettings.settings.disabled.value;
|
||||
UpdateText();
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.B)) BeautifySettings.Blink(0.2f);
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.C)) {
|
||||
BeautifySettings.settings.compareMode.value = !BeautifySettings.settings.compareMode.value;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.N)) {
|
||||
BeautifySettings.settings.nightVision.Override(!BeautifySettings.settings.nightVision.value);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.F)) {
|
||||
if (BeautifySettings.settings.blurIntensity.overrideState) {
|
||||
BeautifySettings.settings.blurIntensity.overrideState = false; // disables the override, disabling the blur
|
||||
} else {
|
||||
BeautifySettings.settings.blurIntensity.Override(4); // enables the override, activating the effect and enabling the blur
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha1)) {
|
||||
// applies a custom value to brightness
|
||||
BeautifySettings.settings.brightness.Override(0.1f);
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.Alpha2)) {
|
||||
// applies a custom value to brightness
|
||||
BeautifySettings.settings.brightness.Override(0.5f);
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.Alpha3)) {
|
||||
// disables custom value
|
||||
BeautifySettings.settings.brightness.overrideState = false;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha4)) {
|
||||
// enables outline
|
||||
BeautifySettings.settings.outline.Override(true);
|
||||
BeautifySettings.settings.outlineColor.Override(Color.cyan);
|
||||
BeautifySettings.settings.outlineCustomize.Override(true);
|
||||
BeautifySettings.settings.outlineSpread.Override(1.5f);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha5)) {
|
||||
// disables outline
|
||||
BeautifySettings.settings.outline.overrideState = false;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha6)) {
|
||||
// assigns a LUT
|
||||
BeautifySettings.settings.lut.Override(true);
|
||||
BeautifySettings.settings.lutIntensity.Override(1f);
|
||||
BeautifySettings.settings.lutTexture.Override(lutTexture);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha7)) {
|
||||
// disables LUT
|
||||
BeautifySettings.settings.lut.Override(false);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha8)) {
|
||||
// toggles anamorphic flares on/off
|
||||
float intensity = BeautifySettings.settings.anamorphicFlaresIntensity.value;
|
||||
BeautifySettings.settings.anamorphicFlaresIntensity.Override(intensity > 0 ? 0f: 1f);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha9)) {
|
||||
// toggles final blur
|
||||
float intensity = BeautifySettings.settings.blurIntensity.value;
|
||||
BeautifySettings.settings.blurIntensity.Override(intensity > 0 ? 0f: 1f);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateText() {
|
||||
|
||||
if (BeautifySettings.settings.disabled.value) {
|
||||
GameObject.Find("Beautify").GetComponent<Text>().text = "Beautify OFF";
|
||||
} else {
|
||||
GameObject.Find("Beautify").GetComponent<Text>().text = "Beautify ON";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55731cb165f254154b276c96d6565d4f
|
||||
timeCreated: 1466520993
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,61 @@
|
||||
using UnityEngine;
|
||||
|
||||
#if ENABLE_INPUT_SYSTEM
|
||||
using UnityEngine.InputSystem;
|
||||
#endif
|
||||
|
||||
namespace Beautify.Demos {
|
||||
|
||||
public static class InputProxy {
|
||||
|
||||
public static bool GetKeyDown(KeyCode keyCode) {
|
||||
#if ENABLE_INPUT_SYSTEM
|
||||
Keyboard keyboard = Keyboard.current;
|
||||
if (keyboard == null) return false;
|
||||
switch (keyCode) {
|
||||
case KeyCode.J: return keyboard.jKey.wasPressedThisFrame;
|
||||
case KeyCode.T: return keyboard.tKey.wasPressedThisFrame;
|
||||
case KeyCode.B: return keyboard.bKey.wasPressedThisFrame;
|
||||
case KeyCode.C: return keyboard.cKey.wasPressedThisFrame;
|
||||
case KeyCode.N: return keyboard.nKey.wasPressedThisFrame;
|
||||
case KeyCode.F: return keyboard.fKey.wasPressedThisFrame;
|
||||
|
||||
case KeyCode.Alpha1: return keyboard.digit1Key.wasPressedThisFrame;
|
||||
case KeyCode.Alpha2: return keyboard.digit2Key.wasPressedThisFrame;
|
||||
case KeyCode.Alpha3: return keyboard.digit3Key.wasPressedThisFrame;
|
||||
case KeyCode.Alpha4: return keyboard.digit4Key.wasPressedThisFrame;
|
||||
case KeyCode.Alpha5: return keyboard.digit5Key.wasPressedThisFrame;
|
||||
case KeyCode.Alpha6: return keyboard.digit6Key.wasPressedThisFrame;
|
||||
case KeyCode.Alpha7: return keyboard.digit7Key.wasPressedThisFrame;
|
||||
case KeyCode.Alpha8: return keyboard.digit8Key.wasPressedThisFrame;
|
||||
case KeyCode.Alpha9: return keyboard.digit9Key.wasPressedThisFrame;
|
||||
case KeyCode.Alpha0: return keyboard.digit0Key.wasPressedThisFrame;
|
||||
}
|
||||
return false;
|
||||
#elif ENABLE_LEGACY_INPUT_MANAGER
|
||||
return UnityEngine.Input.GetKeyDown(keyCode);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static bool GetMouseButtonDown(int button) {
|
||||
#if ENABLE_INPUT_SYSTEM
|
||||
Mouse mouse = Mouse.current;
|
||||
if (mouse == null) return false;
|
||||
switch (button) {
|
||||
case 0: return mouse.leftButton.wasPressedThisFrame;
|
||||
case 1: return mouse.rightButton.wasPressedThisFrame;
|
||||
case 2: return mouse.middleButton.wasPressedThisFrame;
|
||||
default: return false;
|
||||
}
|
||||
#elif ENABLE_LEGACY_INPUT_MANAGER
|
||||
return UnityEngine.Input.GetMouseButtonDown(button);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e38d81bb9f53c40f7b0540cc8230de2d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,68 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Beautify.Universal {
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class LUTBlending : MonoBehaviour {
|
||||
|
||||
public Texture2D LUT1, LUT2;
|
||||
|
||||
[Range(0, 1)]
|
||||
public float LUT1Intensity = 1f;
|
||||
|
||||
[Range(0, 1)]
|
||||
public float LUT2Intensity = 1f;
|
||||
|
||||
[Range(0, 1)]
|
||||
public float phase;
|
||||
public Shader lerpShader;
|
||||
|
||||
float oldPhase = -1;
|
||||
RenderTexture rt;
|
||||
Material lerpMat;
|
||||
|
||||
static class ShaderParams {
|
||||
public readonly static int LUT2 = Shader.PropertyToID("_LUT2");
|
||||
public readonly static int Phase = Shader.PropertyToID("_Phase");
|
||||
}
|
||||
|
||||
void OnEnable() {
|
||||
UpdateBeautifyLUT();
|
||||
}
|
||||
|
||||
void OnValidate() {
|
||||
oldPhase = -1;
|
||||
UpdateBeautifyLUT();
|
||||
}
|
||||
|
||||
private void OnDestroy() {
|
||||
if (rt != null) {
|
||||
rt.Release();
|
||||
}
|
||||
}
|
||||
|
||||
void LateUpdate() {
|
||||
UpdateBeautifyLUT();
|
||||
}
|
||||
|
||||
void UpdateBeautifyLUT() {
|
||||
if (oldPhase == phase || LUT1 == null || LUT2 == null || lerpShader == null) return;
|
||||
oldPhase = phase;
|
||||
|
||||
if (rt == null) {
|
||||
rt = new RenderTexture(LUT1.width, LUT1.height, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear);
|
||||
rt.filterMode = FilterMode.Point;
|
||||
}
|
||||
if (lerpMat == null) {
|
||||
lerpMat = new Material(lerpShader);
|
||||
}
|
||||
lerpMat.SetTexture(ShaderParams.LUT2, LUT2);
|
||||
lerpMat.SetFloat(ShaderParams.Phase, phase);
|
||||
Graphics.Blit(LUT1, rt, lerpMat);
|
||||
BeautifySettings.settings.lut.Override(true);
|
||||
float intensity = Mathf.Lerp(LUT1Intensity, LUT2Intensity, phase);
|
||||
BeautifySettings.settings.lutIntensity.Override(intensity);
|
||||
BeautifySettings.settings.lutTexture.Override(rt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72980150b63624acfa5f209b9179d99a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,26 @@
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace Beautify.Universal {
|
||||
|
||||
public class SphereAnimator : MonoBehaviour {
|
||||
|
||||
Rigidbody rb;
|
||||
const float SPEED = 4;
|
||||
|
||||
void Start () {
|
||||
rb = GetComponent<Rigidbody>();
|
||||
Application.targetFrameRate = 60;
|
||||
}
|
||||
|
||||
void FixedUpdate () {
|
||||
if (transform.position.z < 0.5f) {
|
||||
rb.velocity = Vector3.forward * SPEED;
|
||||
}
|
||||
else if (transform.position.z > 8f) {
|
||||
rb.velocity = Vector3.back * SPEED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8eb68b473eb774609b32b2af81f919d9
|
||||
timeCreated: 1475946452
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
using Beautify.Universal;
|
||||
using Input = Beautify.Demos.InputProxy;
|
||||
|
||||
namespace Beautify.Demos {
|
||||
|
||||
public class ToggleDoF : MonoBehaviour {
|
||||
|
||||
void Update() {
|
||||
if (Input.GetMouseButtonDown(0)) {
|
||||
// toggles DoF state by overriding the volume property
|
||||
bool state = BeautifySettings.settings.depthOfField.value;
|
||||
BeautifySettings.settings.depthOfField.Override(!state);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff57a37bca097427389e488b81e3df3c
|
||||
timeCreated: 1466520993
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user