initial commit

This commit is contained in:
2026-05-29 18:21:53 +03:00
commit 66ddf0ead0
2184 changed files with 1384338 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 880813d23951c624d9d5c3e6d2a4e93c
folderAsset: yes
timeCreated: 1454331861
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,57 @@
using UnityEditor;
namespace UnityStandardAssets.CinematicEffects
{
public class FXAAEditor : IAntiAliasingEditor
{
private string[] presetNames =
{
"Extreme performance",
"Performance",
"Default",
"Quality",
"Extreme quality"
};
public void OnEnable(SerializedObject serializedObject, string path)
{
}
public bool OnInspectorGUI(IAntiAliasing target)
{
var fxaaTarget = (FXAA)target;
if (!fxaaTarget.validSourceFormat)
EditorGUILayout.HelpBox("FXAA should be used at the end of the post-processing stack after conversion to LDR (after Tonemapping) to maximize quality and avoid artifacts.", MessageType.Warning);
int selectedPreset = 2;
if (fxaaTarget.preset.Equals(FXAA.Preset.extremePerformancePreset))
selectedPreset = 0;
else if (fxaaTarget.preset.Equals(FXAA.Preset.performancePreset))
selectedPreset = 1;
else if (fxaaTarget.preset.Equals(FXAA.Preset.defaultPreset))
selectedPreset = 2;
else if (fxaaTarget.preset.Equals(FXAA.Preset.qualityPreset))
selectedPreset = 3;
else if (fxaaTarget.preset.Equals(FXAA.Preset.extremeQualityPreset))
selectedPreset = 4;
EditorGUI.BeginChangeCheck();
selectedPreset = EditorGUILayout.Popup("Preset", selectedPreset, presetNames);
if (EditorGUI.EndChangeCheck())
{
if (selectedPreset < 0)
selectedPreset = 0;
else if (selectedPreset > 4)
selectedPreset = 4;
fxaaTarget.preset = FXAA.availablePresets[selectedPreset];
return true;
}
return false;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 60bfb637c85e3e04ea76962349fee327
timeCreated: 1454331861
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,264 @@
using UnityEngine;
using System;
using Object = UnityEngine.Object;
namespace UnityStandardAssets.CinematicEffects
{
[Serializable]
public class FXAA : IAntiAliasing
{
private Shader m_Shader;
private Shader shader
{
get
{
if (m_Shader == null)
m_Shader = Shader.Find("Hidden/Fast Approximate Anti-aliasing");
return m_Shader;
}
}
private Material m_Material;
public Material material
{
get
{
if (m_Material == null)
m_Material = ImageEffectHelper.CheckShaderAndCreateMaterial(shader);
return m_Material;
}
}
[Serializable]
public struct QualitySettings
{
[Tooltip("The amount of desired sub-pixel aliasing removal. Effects the sharpeness of the output.")]
[Range(0.0f, 1.0f)]
public float subpixelAliasingRemovalAmount;
[Tooltip("The minimum amount of local contrast required to qualify a region as containing an edge.")]
[Range(0.063f, 0.333f)]
public float edgeDetectionThreshold;
[Tooltip("Local contrast adaptation value to disallow the algorithm from executing on the darker regions.")]
[Range(0.0f, 0.0833f)]
public float minimumRequiredLuminance;
}
[Serializable]
public struct ConsoleSettings
{
[Tooltip("The amount of spread applied to the sampling coordinates while sampling for subpixel information.")]
[Range(0.33f, 0.5f)]
public float subpixelSpreadAmount;
[Tooltip("This value dictates how sharp the edges in the image are kept; a higher value implies sharper edges.")]
[Range(2.0f, 8.0f)]
public float edgeSharpnessAmount;
[Tooltip("The minimum amount of local contrast required to qualify a region as containing an edge.")]
[Range(0.125f, 0.25f)]
public float edgeDetectionThreshold;
[Tooltip("Local contrast adaptation value to disallow the algorithm from executing on the darker regions.")]
[Range(0.04f, 0.06f)]
public float minimumRequiredLuminance;
}
[Serializable]
public struct Preset
{
[AttributeUsage(AttributeTargets.Field)]
public class LayoutAttribute : PropertyAttribute
{}
[Layout]
public QualitySettings qualitySettings;
[Layout]
public ConsoleSettings consoleSettings;
private static readonly Preset s_ExtremePerformance = new Preset
{
qualitySettings = new QualitySettings
{
subpixelAliasingRemovalAmount = 0.0f,
edgeDetectionThreshold = 0.333f,
minimumRequiredLuminance = 0.0833f
},
consoleSettings = new ConsoleSettings
{
subpixelSpreadAmount = 0.33f,
edgeSharpnessAmount = 8.0f,
edgeDetectionThreshold = 0.25f,
minimumRequiredLuminance = 0.06f
}
};
private static readonly Preset s_Performance = new Preset
{
qualitySettings = new QualitySettings
{
subpixelAliasingRemovalAmount = 0.25f,
edgeDetectionThreshold = 0.25f,
minimumRequiredLuminance = 0.0833f
},
consoleSettings = new ConsoleSettings
{
subpixelSpreadAmount = 0.33f,
edgeSharpnessAmount = 8.0f,
edgeDetectionThreshold = 0.125f,
minimumRequiredLuminance = 0.06f
}
};
private static readonly Preset s_Default = new Preset
{
qualitySettings = new QualitySettings
{
subpixelAliasingRemovalAmount = 0.75f,
edgeDetectionThreshold = 0.166f,
minimumRequiredLuminance = 0.0833f
},
consoleSettings = new ConsoleSettings
{
subpixelSpreadAmount = 0.5f,
edgeSharpnessAmount = 8.0f,
edgeDetectionThreshold = 0.125f,
minimumRequiredLuminance = 0.05f
}
};
private static readonly Preset s_Quality = new Preset
{
qualitySettings = new QualitySettings
{
subpixelAliasingRemovalAmount = 1.0f,
edgeDetectionThreshold = 0.125f,
minimumRequiredLuminance = 0.0625f
},
consoleSettings = new ConsoleSettings
{
subpixelSpreadAmount = 0.5f,
edgeSharpnessAmount = 4.0f,
edgeDetectionThreshold = 0.125f,
minimumRequiredLuminance = 0.04f
}
};
private static readonly Preset s_ExtremeQuality = new Preset
{
qualitySettings = new QualitySettings
{
subpixelAliasingRemovalAmount = 1.0f,
edgeDetectionThreshold = 0.063f,
minimumRequiredLuminance = 0.0312f
},
consoleSettings = new ConsoleSettings
{
subpixelSpreadAmount = 0.5f,
edgeSharpnessAmount = 2.0f,
edgeDetectionThreshold = 0.125f,
minimumRequiredLuminance = 0.04f
}
};
public static Preset extremePerformancePreset
{
get { return s_ExtremePerformance; }
}
public static Preset performancePreset
{
get { return s_Performance; }
}
public static Preset defaultPreset
{
get { return s_Default; }
}
public static Preset qualityPreset
{
get { return s_Quality; }
}
public static Preset extremeQualityPreset
{
get { return s_ExtremeQuality; }
}
}
[SerializeField, HideInInspector]
public Preset preset = Preset.defaultPreset;
public static Preset[] availablePresets =
{
Preset.extremePerformancePreset,
Preset.performancePreset,
Preset.defaultPreset,
Preset.qualityPreset,
Preset.extremeQualityPreset
};
public bool validSourceFormat { get; private set; }
private int m_QualitySettings;
private int m_ConsoleSettings;
public void Awake()
{
m_QualitySettings = Shader.PropertyToID("_QualitySettings");
m_ConsoleSettings = Shader.PropertyToID("_ConsoleSettings");
}
public void OnEnable(AntiAliasing owner)
{
if (!ImageEffectHelper.IsSupported(shader, true, false, owner))
owner.enabled = false;
}
public void OnDisable()
{
if (m_Material != null)
Object.DestroyImmediate(m_Material);
}
public void OnPreCull(Camera camera)
{
}
public void OnPostRender(Camera camera)
{
}
public void OnRenderImage(Camera camera, RenderTexture source, RenderTexture destination)
{
#if UNITY_EDITOR
validSourceFormat = true;
if (source.format == RenderTextureFormat.ARGBHalf
|| source.format == RenderTextureFormat.ARGBFloat
|| source.format == RenderTextureFormat.ARGB2101010)
validSourceFormat = false;
#endif
material.SetVector(m_QualitySettings, new Vector3(preset.qualitySettings.subpixelAliasingRemovalAmount,
preset.qualitySettings.edgeDetectionThreshold, preset.qualitySettings.minimumRequiredLuminance));
material.SetVector(m_ConsoleSettings, new Vector4(preset.consoleSettings.subpixelSpreadAmount,
preset.consoleSettings.edgeSharpnessAmount, preset.consoleSettings.edgeDetectionThreshold,
preset.consoleSettings.minimumRequiredLuminance));
Graphics.Blit(source, destination, material, 0);
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 8ca0fe85db4ef594fb0771b250c00e23
timeCreated: 1453738651
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences:
- shader: {fileID: 4800000, guid: 3eaaee164ee0fed4d9a0bbe8434805a6, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3f7cc4a9005f5f846957997471c28f2b
folderAsset: yes
timeCreated: 1455022968
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,106 @@
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Hidden/Fast Approximate Anti-aliasing"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
CGINCLUDE
#pragma fragmentoption ARB_precision_hint_fastest
#if defined(SHADER_API_PS3)
#define FXAA_PS3 1
// Shaves off 2 cycles from the shader
#define FXAA_EARLY_EXIT 0
#elif defined(SHADER_API_XBOX360)
#define FXAA_360 1
// Shaves off 10ms from the shader's execution time
#define FXAA_EARLY_EXIT 1
#else
#define FXAA_PC 1
#endif
#define FXAA_HLSL_3 1
#define FXAA_QUALITY__PRESET 39
#define FXAA_GREEN_AS_LUMA 1
#pragma target 3.0
#include "FXAA3.cginc"
float4 _MainTex_TexelSize;
float3 _QualitySettings;
float4 _ConsoleSettings;
struct Input
{
float4 position : POSITION;
float2 uv : TEXCOORD0;
};
struct Varying
{
float4 position : SV_POSITION;
float2 uv : TEXCOORD0;
};
Varying vertex(Input input)
{
Varying output;
output.position = UnityObjectToClipPos(input.position);
output.uv = input.uv;
return output;
}
sampler2D _MainTex;
float calculateLuma(float4 color)
{
return color.g * 1.963211 + color.r;
}
fixed4 fragment(Varying input) : SV_Target
{
const float4 consoleUV = input.uv.xyxy + .5 * float4(-_MainTex_TexelSize.xy, _MainTex_TexelSize.xy);
const float4 consoleSubpixelFrame = _ConsoleSettings.x * float4(-1., -1., 1., 1.) *
_MainTex_TexelSize.xyxy;
const float4 consoleSubpixelFramePS3 = float4(-2., -2., 2., 2.) * _MainTex_TexelSize.xyxy;
const float4 consoleSubpixelFrameXBOX = float4(8., 8., -4., -4.) * _MainTex_TexelSize.xyxy;
#if defined(SHADER_API_XBOX360)
const float4 consoleConstants = float4(1., -1., .25, -.25);
#else
const float4 consoleConstants = float4(0., 0., 0., 0.);
#endif
return FxaaPixelShader(input.uv, consoleUV, _MainTex, _MainTex, _MainTex, _MainTex_TexelSize.xy,
consoleSubpixelFrame, consoleSubpixelFramePS3, consoleSubpixelFrameXBOX,
_QualitySettings.x, _QualitySettings.y, _QualitySettings.z, _ConsoleSettings.y, _ConsoleSettings.z,
_ConsoleSettings.w, consoleConstants);
}
ENDCG
SubShader
{
ZTest Always Cull Off ZWrite Off
Fog { Mode off }
Pass
{
CGPROGRAM
#pragma vertex vertex
#pragma fragment fragment
#include "UnityCG.cginc"
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3eaaee164ee0fed4d9a0bbe8434805a6
timeCreated: 1453736553
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b44d2ca11a7157e4db9f1e02f5249f95
timeCreated: 1453990603
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant: