ADD : 배경 파일 및 프로젝트 리소스 경로 지정
This commit is contained in:
parent
5830309bf4
commit
0f3a555825
6
.vsconfig
Normal file
6
.vsconfig
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"components": [
|
||||
"Microsoft.VisualStudio.Workload.ManagedGame"
|
||||
]
|
||||
}
|
||||
8
Assets/External/Horizon Based Ambient Occlusion.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3239084a7d52634ab69a498b1832189
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/Demo.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/Demo.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 264dde3b9012fa346b510f9f1d502066
|
||||
folderAsset: yes
|
||||
timeCreated: 1455959812
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/External/Horizon Based Ambient Occlusion/Demo/Demo.unity
(Stored with Git LFS)
vendored
Normal file
BIN
Assets/External/Horizon Based Ambient Occlusion/Demo/Demo.unity
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
8
Assets/External/Horizon Based Ambient Occlusion/Demo/Demo.unity.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/Demo/Demo.unity.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 241634a1ead4cbf4aa1750dbe7debbab
|
||||
timeCreated: 1453576474
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
66
Assets/External/Horizon Based Ambient Occlusion/Demo/DemoSettings.lighting
vendored
Normal file
66
Assets/External/Horizon Based Ambient Occlusion/Demo/DemoSettings.lighting
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!850595691 &4890085278179872738
|
||||
LightingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: DemoSettings
|
||||
serializedVersion: 6
|
||||
m_GIWorkflowMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 1
|
||||
m_RealtimeEnvironmentLighting: 1
|
||||
m_BounceScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_UsingShadowmask: 0
|
||||
m_BakeBackend: 0
|
||||
m_LightmapMaxSize: 1024
|
||||
m_BakeResolution: 40
|
||||
m_Padding: 2
|
||||
m_LightmapCompression: 3
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 0
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAO: 0
|
||||
m_MixedBakeMode: 1
|
||||
m_LightmapsBakeMode: 1
|
||||
m_FilterMode: 1
|
||||
m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_RealtimeResolution: 2
|
||||
m_ForceWhiteAlbedo: 0
|
||||
m_ForceUpdates: 0
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherRayCount: 1024
|
||||
m_FinalGatherFiltering: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVREnvironmentSampleCount: 512
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_PVRBounces: 2
|
||||
m_PVRMinBounces: 2
|
||||
m_PVREnvironmentImportanceSampling: 0
|
||||
m_PVRFilteringMode: 0
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_PVRTiledBaking: 0
|
||||
m_NumRaysToShootPerTexel: -1
|
||||
m_RespectSceneVisibilityWhenBakingGI: 0
|
||||
8
Assets/External/Horizon Based Ambient Occlusion/Demo/DemoSettings.lighting.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/Demo/DemoSettings.lighting.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6d3b38e8d8f13644ad766bdf2609543
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 4890085278179872738
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/Demo/Models.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/Demo/Models.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28143174a74ad204d9199cb14598af2f
|
||||
folderAsset: yes
|
||||
timeCreated: 1455959813
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29ca2b7c485291d4b92e1a7e3c2ec3a7
|
||||
folderAsset: yes
|
||||
timeCreated: 1455959813
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
90
Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials/Dragons.mat
vendored
Normal file
90
Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials/Dragons.mat
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Dragons
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: ca39994063dd9c94894e7e05a63ed4af, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _EmissionScaleUI: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
8
Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials/Dragons.mat.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Materials/Dragons.mat.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86e1545bedbf12044bc434adf047297c
|
||||
timeCreated: 1454157498
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8a5653e008d6c545b047c7dd9b89368
|
||||
folderAsset: yes
|
||||
timeCreated: 1455959813
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures/Dragons.png
(Stored with Git LFS)
vendored
Normal file
BIN
Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures/Dragons.png
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
57
Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures/Dragons.png.meta
vendored
Normal file
57
Assets/External/Horizon Based Ambient Occlusion/Demo/Models/Textures/Dragons.png.meta
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca39994063dd9c94894e7e05a63ed4af
|
||||
timeCreated: 1454158430
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 7
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 25eb19968142c7c40ae4ac3180eb03ab
|
||||
folderAsset: yes
|
||||
timeCreated: 1455959813
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
17
Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAO.Demo.Runtime.asmdef
vendored
Normal file
17
Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAO.Demo.Runtime.asmdef
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "HBAO.Demo.Runtime",
|
||||
"references": [
|
||||
"GUID:b83dc51897666cb44bdfbf9671f74e85"
|
||||
],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [
|
||||
"UNITY_2019_1_OR_NEWER"
|
||||
],
|
||||
"versionDefines": []
|
||||
}
|
||||
7
Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAO.Demo.Runtime.asmdef.meta
vendored
Normal file
7
Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAO.Demo.Runtime.asmdef.meta
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7729a5237c96f948aaf7de13ad4cffb
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
29
Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAOControl.cs
vendored
Normal file
29
Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAOControl.cs
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace HorizonBasedAmbientOcclusion
|
||||
{
|
||||
public class HBAOControl : MonoBehaviour
|
||||
{
|
||||
public HBAO hbao;
|
||||
public UnityEngine.UI.Slider aoRadiusSlider;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
hbao.SetDebugMode(HBAO.DebugMode.Disabled);
|
||||
hbao.SetAoRadius(aoRadiusSlider.value);
|
||||
}
|
||||
|
||||
public void ToggleShowAO()
|
||||
{
|
||||
if (hbao.generalSettings.debugMode != HBAO.DebugMode.Disabled)
|
||||
hbao.SetDebugMode(HBAO.DebugMode.Disabled);
|
||||
else
|
||||
hbao.SetDebugMode(HBAO.DebugMode.AOOnly);
|
||||
}
|
||||
|
||||
public void UpdateAoRadius()
|
||||
{
|
||||
hbao.SetAoRadius(aoRadiusSlider.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAOControl.cs.meta
vendored
Normal file
12
Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/HBAOControl.cs.meta
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b8c0ece2d92e8be4f8a5909e6896f948
|
||||
timeCreated: 1453634854
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
19
Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/RotateObject.cs
vendored
Normal file
19
Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/RotateObject.cs
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace HorizonBasedAmbientOcclusion
|
||||
{
|
||||
public class RotateObject : MonoBehaviour
|
||||
{
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.Rotate(Vector3.up * Time.deltaTime * 15.0f, Space.World);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/RotateObject.cs.meta
vendored
Normal file
12
Assets/External/Horizon Based Ambient Occlusion/Demo/Runtime/RotateObject.cs.meta
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1b93e48d84b64e4cac4a08f2da9f69f
|
||||
timeCreated: 1453573806
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/Documentation.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/Documentation.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9869ea90af1da7949848b63dddb25d26
|
||||
folderAsset: yes
|
||||
timeCreated: 1467127598
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/External/Horizon Based Ambient Occlusion/Documentation/User Guide.pdf
(Stored with Git LFS)
vendored
Normal file
BIN
Assets/External/Horizon Based Ambient Occlusion/Documentation/User Guide.pdf
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
8
Assets/External/Horizon Based Ambient Occlusion/Documentation/User Guide.pdf.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/Documentation/User Guide.pdf.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 061da04314aaba248977f5671e799370
|
||||
timeCreated: 1467127598
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/External/Horizon Based Ambient Occlusion/Editor.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/Editor.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 478a5a24ad1152f43ad164da3759717b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
17
Assets/External/Horizon Based Ambient Occlusion/Editor/HBAO.Editor.asmdef
vendored
Normal file
17
Assets/External/Horizon Based Ambient Occlusion/Editor/HBAO.Editor.asmdef
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "HBAO.Editor",
|
||||
"references": [
|
||||
"GUID:b83dc51897666cb44bdfbf9671f74e85"
|
||||
],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": []
|
||||
}
|
||||
7
Assets/External/Horizon Based Ambient Occlusion/Editor/HBAO.Editor.asmdef.meta
vendored
Normal file
7
Assets/External/Horizon Based Ambient Occlusion/Editor/HBAO.Editor.asmdef.meta
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbd7cb83004dde543aac62cbce764d58
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
266
Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOEditor.cs
vendored
Normal file
266
Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOEditor.cs
vendored
Normal file
@ -0,0 +1,266 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Rendering;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace HorizonBasedAmbientOcclusion
|
||||
{
|
||||
[CustomEditor(typeof(HBAO))]
|
||||
public class HBAOEditor : Editor
|
||||
{
|
||||
private HBAO m_HBAO;
|
||||
private Texture2D m_HBAOTex;
|
||||
private GUIStyle m_SettingsGroupStyle;
|
||||
private GUIStyle m_TitleLabelStyle;
|
||||
private int m_SelectedPreset;
|
||||
// settings group <setting, property reference>
|
||||
private Dictionary<FieldInfo, List<SerializedProperty>> m_GroupFields = new Dictionary<FieldInfo, List<SerializedProperty>>();
|
||||
private readonly Dictionary<int, HBAO.Preset> m_Presets = new Dictionary<int, HBAO.Preset>()
|
||||
{
|
||||
{ 0, HBAO.Preset.Normal },
|
||||
{ 1, HBAO.Preset.FastPerformance },
|
||||
{ 2, HBAO.Preset.FastestPerformance },
|
||||
{ 3, HBAO.Preset.Custom },
|
||||
{ 4, HBAO.Preset.HighQuality },
|
||||
{ 5, HBAO.Preset.HighestQuality }
|
||||
};
|
||||
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
m_HBAO = (HBAO)target;
|
||||
m_HBAOTex = Resources.Load<Texture2D>("hbao");
|
||||
|
||||
var settingsGroups = typeof(HBAO).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
|
||||
.Where(x => x.GetCustomAttributes(typeof(HBAO.SettingsGroup), false).Any());
|
||||
foreach (var group in settingsGroups)
|
||||
{
|
||||
foreach (var setting in group.FieldType.GetFields(BindingFlags.Instance | BindingFlags.Public))
|
||||
{
|
||||
if (!m_GroupFields.ContainsKey(group))
|
||||
m_GroupFields[group] = new List<SerializedProperty>();
|
||||
|
||||
var property = serializedObject.FindProperty(group.Name + "." + setting.Name);
|
||||
if (property != null)
|
||||
m_GroupFields[group].Add(property);
|
||||
}
|
||||
}
|
||||
|
||||
m_SelectedPreset = m_Presets.Values.ToList().IndexOf(m_HBAO.GetCurrentPreset());
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
SetStyles();
|
||||
|
||||
EditorGUILayout.BeginVertical();
|
||||
{
|
||||
// header
|
||||
GUILayout.Space(10.0f);
|
||||
GUILayout.Label(m_HBAOTex, m_TitleLabelStyle, GUILayout.ExpandWidth(true));
|
||||
|
||||
//if (m_HBAO.GetComponents<MonoBehaviour>()[0] != m_HBAO)
|
||||
//{
|
||||
//GUILayout.Space(6.0f);
|
||||
//EditorGUILayout.HelpBox("This Post FX should be one of the first in your effect stack", MessageType.Info);
|
||||
//}
|
||||
|
||||
Event e = Event.current;
|
||||
|
||||
// settings groups
|
||||
foreach (var group in m_GroupFields)
|
||||
{
|
||||
var groupProperty = serializedObject.FindProperty(group.Key.Name);
|
||||
if (groupProperty == null)
|
||||
continue;
|
||||
|
||||
GUILayout.Space(6.0f);
|
||||
Rect rect = GUILayoutUtility.GetRect(16f, 22f, m_SettingsGroupStyle);
|
||||
GUI.Box(rect, ObjectNames.NicifyVariableName(groupProperty.displayName), m_SettingsGroupStyle);
|
||||
if (e.type == EventType.MouseDown && rect.Contains(e.mousePosition))
|
||||
{
|
||||
groupProperty.isExpanded = !groupProperty.isExpanded;
|
||||
e.Use();
|
||||
}
|
||||
|
||||
if (!groupProperty.isExpanded)
|
||||
continue;
|
||||
|
||||
// presets is a special case
|
||||
if (group.Key.FieldType == typeof(HBAO.Presets))
|
||||
{
|
||||
GUILayout.Space(6.0f);
|
||||
m_SelectedPreset = GUILayout.SelectionGrid(m_SelectedPreset, m_Presets.Values.Select(x => ObjectNames.NicifyVariableName(x.ToString())).ToArray(), 3);
|
||||
GUILayout.Space(6.0f);
|
||||
if (GUILayout.Button("Apply Preset"))
|
||||
{
|
||||
Undo.RecordObject(target, "Apply Preset");
|
||||
m_HBAO.ApplyPreset(m_Presets[m_SelectedPreset]);
|
||||
EditorUtility.SetDirty(target);
|
||||
if (!EditorApplication.isPlaying)
|
||||
{
|
||||
UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var field in group.Value)
|
||||
{
|
||||
// hide real presets
|
||||
if (group.Key.FieldType == typeof(HBAO.Presets))
|
||||
continue;
|
||||
|
||||
// hide resolution when deinterleaved HBAO is on
|
||||
if (group.Key.FieldType == typeof(HBAO.GeneralSettings) && field.name == "resolution")
|
||||
{
|
||||
if (m_HBAO.GetDeinterleaving() != HBAO.Deinterleaving.Disabled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// warn about deinterleaving not supported with SPSR
|
||||
else if (group.Key.FieldType == typeof(HBAO.GeneralSettings) && field.name == "debugMode")
|
||||
{
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
if (m_HBAO.GetDeinterleaving() != HBAO.Deinterleaving.Disabled &&
|
||||
IsVrRunning() && PlayerSettings.stereoRenderingPath == StereoRenderingPath.SinglePass)
|
||||
{
|
||||
GUILayout.Space(6.0f);
|
||||
EditorGUILayout.HelpBox("Deinterleaving is not supported with Single Pass Stereo Rendering...", MessageType.Warning);
|
||||
}
|
||||
#else
|
||||
if (m_HBAO.GetDeinterleaving() != HBAO.Deinterleaving.Disabled &&
|
||||
PlayerSettings.virtualRealitySupported && PlayerSettings.stereoRenderingPath == StereoRenderingPath.SinglePass)
|
||||
{
|
||||
GUILayout.Space(6.0f);
|
||||
EditorGUILayout.HelpBox("Deinterleaving is not supported with Single Pass Stereo Rendering...", MessageType.Warning);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// hide noise type when deinterleaved HBAO is on
|
||||
else if (group.Key.FieldType == typeof(HBAO.GeneralSettings) && field.name == "noiseType")
|
||||
{
|
||||
if (m_HBAO.GetDeinterleaving() != HBAO.Deinterleaving.Disabled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// hide useMultiBounce setting in BeforeReflections integration stage
|
||||
else if (group.Key.FieldType == typeof(HBAO.AOSettings) && field.name == "useMultiBounce")
|
||||
{
|
||||
if (m_HBAO.GetPipelineStage() == HBAO.PipelineStage.BeforeReflections)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// hide multiBounceInfluence setting when not used
|
||||
else if (group.Key.FieldType == typeof(HBAO.AOSettings) && field.name == "multiBounceInfluence")
|
||||
{
|
||||
if (m_HBAO.GetPipelineStage() == HBAO.PipelineStage.BeforeReflections || !m_HBAO.UseMultiBounce())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// warn about distance falloff greater than max distance
|
||||
else if (group.Key.FieldType == typeof(HBAO.AOSettings) && field.name == "perPixelNormals")
|
||||
{
|
||||
if (m_HBAO.GetAoDistanceFalloff() > m_HBAO.GetAoMaxDistance())
|
||||
{
|
||||
GUILayout.Space(6.0f);
|
||||
EditorGUILayout.HelpBox("Distance Falloff shoudn't be superior to Max Distance", MessageType.Warning);
|
||||
}
|
||||
}
|
||||
// hide albedoMultiplier when not in deferred
|
||||
else if (group.Key.FieldType == typeof(HBAO.ColorBleedingSettings) && field.name == "albedoMultiplier")
|
||||
{
|
||||
if (m_HBAO.GetPipelineStage() == HBAO.PipelineStage.BeforeImageEffectsOpaque)
|
||||
continue;
|
||||
}
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Space(12.0f);
|
||||
EditorGUILayout.PropertyField(field);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
private void SetStyles()
|
||||
{
|
||||
// set banner label style
|
||||
m_TitleLabelStyle = new GUIStyle(GUI.skin.label);
|
||||
m_TitleLabelStyle.alignment = TextAnchor.MiddleCenter;
|
||||
m_TitleLabelStyle.contentOffset = new Vector2(0f, 0f);
|
||||
|
||||
// get shuriken module title style
|
||||
GUIStyle skurikenModuleTitleStyle = "ShurikenModuleTitle";
|
||||
|
||||
// clone it as to not interfere with the original, and adjust it
|
||||
m_SettingsGroupStyle = new GUIStyle(skurikenModuleTitleStyle);
|
||||
m_SettingsGroupStyle.font = (new GUIStyle("Label")).font;
|
||||
m_SettingsGroupStyle.fontStyle = FontStyle.Bold;
|
||||
m_SettingsGroupStyle.border = new RectOffset(15, 7, 4, 4);
|
||||
m_SettingsGroupStyle.fixedHeight = 22;
|
||||
m_SettingsGroupStyle.contentOffset = new Vector2(10f, -2f);
|
||||
}
|
||||
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
List<UnityEngine.XR.XRDisplaySubsystemDescriptor> displaysDescs = new List<UnityEngine.XR.XRDisplaySubsystemDescriptor>();
|
||||
List<UnityEngine.XR.XRDisplaySubsystem> displays = new List<UnityEngine.XR.XRDisplaySubsystem>();
|
||||
|
||||
private bool IsVrRunning()
|
||||
{
|
||||
bool vrIsRunning = false;
|
||||
displays.Clear();
|
||||
SubsystemManager.GetSubsystems(displays);
|
||||
foreach (var displaySubsystem in displays)
|
||||
{
|
||||
if (displaySubsystem.running)
|
||||
{
|
||||
vrIsRunning = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return vrIsRunning;
|
||||
}
|
||||
#endif
|
||||
|
||||
[CustomPropertyDrawer(typeof(HBAO.MinMaxSliderAttribute))]
|
||||
public class MinMaxSliderDrawer : PropertyDrawer
|
||||
{
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
|
||||
if (property.propertyType == SerializedPropertyType.Vector2)
|
||||
{
|
||||
Vector2 range = property.vector2Value;
|
||||
float min = range.x;
|
||||
float max = range.y;
|
||||
var attr = attribute as HBAO.MinMaxSliderAttribute;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.MinMaxSlider(position, label, ref min, ref max, attr.min, attr.max);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
range.x = min;
|
||||
range.y = max;
|
||||
property.vector2Value = range;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUI.LabelField(position, label, "Use only with Vector2");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOEditor.cs.meta
vendored
Normal file
12
Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOEditor.cs.meta
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c11bfebf2cb67334d8e543d164ef0cb0
|
||||
timeCreated: 1478884394
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
140
Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOGaiaExtension.cs
vendored
Normal file
140
Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOGaiaExtension.cs
vendored
Normal file
@ -0,0 +1,140 @@
|
||||
#if GAIA_PRESENT && UNITY_EDITOR
|
||||
|
||||
using HorizonBasedAmbientOcclusion;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Gaia.GX.MichaelJimenez
|
||||
{
|
||||
public class HBAOGaiaExtension : MonoBehaviour
|
||||
{
|
||||
#region Generic informational methods
|
||||
|
||||
/// <summary>
|
||||
/// Returns the publisher name if provided.
|
||||
/// This will override the publisher name in the namespace ie Gaia.GX.PublisherName
|
||||
/// </summary>
|
||||
/// <returns>Publisher name</returns>
|
||||
public static string GetPublisherName()
|
||||
{
|
||||
return "Michael Jimenez";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the package name if provided
|
||||
/// This will override the package name in the class name ie public class PackageName.
|
||||
/// </summary>
|
||||
/// <returns>Package name</returns>
|
||||
public static string GetPackageName()
|
||||
{
|
||||
return "Horizon Based Ambient Occlusion";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods exposed by Gaia as buttons must be prefixed with GX_
|
||||
|
||||
public static void GX_About()
|
||||
{
|
||||
EditorUtility.DisplayDialog("About Horizon Based Ambient Occlusion ", "HBAO is a post processing image effect to use in order to add realism to your scenes. It helps accentuating small surface details and reproduce light attenuation due to occlusion.\n\nNote: This Post FX should be the first in your effect stack.", "OK");
|
||||
}
|
||||
|
||||
public static void GX_Presets_FastestPerformance()
|
||||
{
|
||||
HBAO hbao = StackPostFXOnTop();
|
||||
if (hbao != null)
|
||||
{
|
||||
hbao.ApplyPreset(HBAO.Preset.FastestPerformance);
|
||||
MarkDirty(hbao);
|
||||
}
|
||||
}
|
||||
|
||||
public static void GX_Presets_FastPerformance()
|
||||
{
|
||||
HBAO hbao = StackPostFXOnTop();
|
||||
if (hbao != null)
|
||||
{
|
||||
hbao.ApplyPreset(HBAO.Preset.FastPerformance);
|
||||
MarkDirty(hbao);
|
||||
}
|
||||
}
|
||||
|
||||
public static void GX_Presets_Normal()
|
||||
{
|
||||
HBAO hbao = StackPostFXOnTop();
|
||||
if (hbao != null)
|
||||
{
|
||||
hbao.ApplyPreset(HBAO.Preset.Normal);
|
||||
MarkDirty(hbao);
|
||||
}
|
||||
}
|
||||
|
||||
public static void GX_Presets_HighQuality()
|
||||
{
|
||||
HBAO hbao = StackPostFXOnTop();
|
||||
if (hbao != null)
|
||||
{
|
||||
hbao.ApplyPreset(HBAO.Preset.HighQuality);
|
||||
MarkDirty(hbao);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void GX_Presets_HighestQuality()
|
||||
{
|
||||
HBAO hbao = StackPostFXOnTop();
|
||||
if (hbao != null)
|
||||
{
|
||||
hbao.ApplyPreset(HBAO.Preset.HighestQuality);
|
||||
MarkDirty(hbao);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helper methods
|
||||
|
||||
private static HBAO StackPostFXOnTop()
|
||||
{
|
||||
Camera camera = Camera.main;
|
||||
if (camera == null)
|
||||
{
|
||||
camera = FindObjectOfType<Camera>();
|
||||
}
|
||||
if (camera == null)
|
||||
{
|
||||
EditorUtility.DisplayDialog("OOPS!", "Could not find camera to add camera effects to. Please add a camera to your scene.", "OK");
|
||||
return null;
|
||||
}
|
||||
|
||||
// add HBAO to camera
|
||||
HBAO hbao = camera.GetComponent<HBAO>();
|
||||
if (hbao != null)
|
||||
{
|
||||
DestroyImmediate(hbao);
|
||||
}
|
||||
hbao = camera.gameObject.AddComponent<HBAO>();
|
||||
|
||||
// stack it on top
|
||||
while (camera.GetComponents<MonoBehaviour>()[0] != hbao)
|
||||
{
|
||||
UnityEditorInternal.ComponentUtility.MoveComponentUp(hbao);
|
||||
}
|
||||
|
||||
return hbao;
|
||||
}
|
||||
|
||||
private static void MarkDirty(HBAO hbao)
|
||||
{
|
||||
EditorUtility.SetDirty(hbao);
|
||||
if (!EditorApplication.isPlaying)
|
||||
{
|
||||
UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
12
Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOGaiaExtension.cs.meta
vendored
Normal file
12
Assets/External/Horizon Based Ambient Occlusion/Editor/HBAOGaiaExtension.cs.meta
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50df544c23aafa84584188552d7a8cd5
|
||||
timeCreated: 1462456119
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/Editor/Resources.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/Editor/Resources.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fff65aff3cee6c44183cf61a6df77cac
|
||||
folderAsset: yes
|
||||
timeCreated: 1463304680
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/hbao.png
(Stored with Git LFS)
vendored
Normal file
BIN
Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/hbao.png
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
55
Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/hbao.png.meta
vendored
Normal file
55
Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/hbao.png.meta
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 363f071b5e3670a43ba62ba5322fc4d6
|
||||
timeCreated: 1463304735
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 8
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/icon.png
(Stored with Git LFS)
vendored
Normal file
BIN
Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/icon.png
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
101
Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/icon.png.meta
vendored
Normal file
101
Assets/External/Horizon Based Ambient Occlusion/Editor/Resources/icon.png.meta
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6daa87e2aaa1bb04d930ca4b4bc926a7
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 10
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -100
|
||||
wrapU: -1
|
||||
wrapV: -1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: ea6ccb6043e0b05449baf0ac8d87f817
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/External/Horizon Based Ambient Occlusion/Readme.txt
(Stored with Git LFS)
vendored
Normal file
BIN
Assets/External/Horizon Based Ambient Occlusion/Readme.txt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
8
Assets/External/Horizon Based Ambient Occlusion/Readme.txt.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/Readme.txt.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ea4d0d9dc9d11941b341f03453fd6d3
|
||||
timeCreated: 1453642158
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/Runtime.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/Runtime.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b4762034a7dbee44a7dfa37d2418bf2
|
||||
folderAsset: yes
|
||||
timeCreated: 1455959812
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
15
Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.Runtime.asmdef
vendored
Normal file
15
Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.Runtime.asmdef
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "HBAO.Runtime",
|
||||
"references": [],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [
|
||||
"UNITY_2019_1_OR_NEWER"
|
||||
],
|
||||
"versionDefines": []
|
||||
}
|
||||
7
Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.Runtime.asmdef.meta
vendored
Normal file
7
Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.Runtime.asmdef.meta
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b83dc51897666cb44bdfbf9671f74e85
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1776
Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.cs
vendored
Normal file
1776
Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.cs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
14
Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.cs.meta
vendored
Normal file
14
Assets/External/Horizon Based Ambient Occlusion/Runtime/HBAO.cs.meta
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1580e32f765c994b86a57bb3c49fe75
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- noiseTex: {instanceID: 0}
|
||||
- quadMesh: {instanceID: 0}
|
||||
- hbaoShader: {fileID: 4800000, guid: 7b834eafaedd0d842bb05a969d9d14bd, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 6daa87e2aaa1bb04d930ca4b4bc926a7, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58e53f1a24d7d1b4fa2db1ab8e051732
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c2f710d028e8644b9e7012d3657c785
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77627965239b49c4db3d57d344cb7b8f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Demo.unity
(Stored with Git LFS)
vendored
Normal file
BIN
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Demo.unity
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
7
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Demo.unity.meta
vendored
Normal file
7
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Demo.unity.meta
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fd201e2f8d95b9428ab5708b9577531
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d0bb23ae9cc0ea44a4501419c2f20fa
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
135
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials/Dragons.mat
vendored
Normal file
135
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials/Dragons.mat
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Dragons
|
||||
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 2000
|
||||
stringTagMap:
|
||||
RenderType: Opaque
|
||||
disabledShaderPasses:
|
||||
- MOTIONVECTORS
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 2800000, guid: ca39994063dd9c94894e7e05a63ed4af, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 2800000, guid: bfacece48cb4c964eb84698e1d9cf1f5, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: ca39994063dd9c94894e7e05a63ed4af, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _AlphaClip: 0
|
||||
- _AlphaToMask: 0
|
||||
- _Blend: 0
|
||||
- _BlendModePreserveSpecular: 1
|
||||
- _BumpScale: 1
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _Cull: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _GlossMapScale: 0
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _Metallic: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.005
|
||||
- _QueueOffset: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _Smoothness: 0
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 0
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
--- !u!114 &3150744375204830071
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 11
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 9
|
||||
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials/Dragons.mat.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Materials/Dragons.mat.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a66ae531fc9a3474caa5ddc1f82de0cd
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Post Process Volume Profile.asset
(Stored with Git LFS)
vendored
Normal file
BIN
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Post Process Volume Profile.asset
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1c9c1b41992f574b96467b208087240
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bcc72c6af57f7c143aa431b0886b0937
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs/Dragons Candle.prefab
(Stored with Git LFS)
vendored
Normal file
BIN
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Prefabs/Dragons Candle.prefab
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4fa342793b1493444a4aa2562a2d6aa4
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9953f3228182b364e8eb030d0c44cd09
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "HBAO.Demo.Universal.Runtime",
|
||||
"references": [
|
||||
"GUID:09d385cb911270749b709e1bb48e9ea1",
|
||||
"GUID:df380645f10b7bc4b97d4f5eb6303d95"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [
|
||||
"UNITY_2019_3_OR_NEWER"
|
||||
],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 611af4d5a827be644a4876b4cb89fb6b
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
61
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAOControl.cs
vendored
Normal file
61
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAOControl.cs
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace HorizonBasedAmbientOcclusion.Universal
|
||||
{
|
||||
public class HBAOControl : MonoBehaviour
|
||||
{
|
||||
public VolumeProfile postProcessProfile;
|
||||
public UnityEngine.UI.Slider aoRadiusSlider;
|
||||
|
||||
private bool m_HbaoDisplayed = true;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
HBAO hbao;
|
||||
postProcessProfile.TryGet(out hbao);
|
||||
|
||||
if (hbao != null)
|
||||
{
|
||||
hbao.EnableHBAO(true);
|
||||
hbao.SetDebugMode(HBAO.DebugMode.Disabled);
|
||||
hbao.SetAoRadius(aoRadiusSlider.value);
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleHBAO()
|
||||
{
|
||||
HBAO hbao;
|
||||
postProcessProfile.TryGet(out hbao);
|
||||
|
||||
if (hbao != null)
|
||||
{
|
||||
m_HbaoDisplayed = !m_HbaoDisplayed;
|
||||
hbao.EnableHBAO(m_HbaoDisplayed);
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleShowAO()
|
||||
{
|
||||
HBAO hbao;
|
||||
postProcessProfile.TryGet(out hbao);
|
||||
|
||||
if (hbao != null)
|
||||
{
|
||||
if (hbao.GetDebugMode() != HBAO.DebugMode.Disabled)
|
||||
hbao.SetDebugMode(HBAO.DebugMode.Disabled);
|
||||
else
|
||||
hbao.SetDebugMode(HBAO.DebugMode.AOOnly);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateAoRadius()
|
||||
{
|
||||
HBAO hbao;
|
||||
postProcessProfile.TryGet(out hbao);
|
||||
|
||||
if (hbao != null)
|
||||
hbao.SetAoRadius(aoRadiusSlider.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAOControl.cs.meta
vendored
Normal file
11
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/HBAOControl.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29ecb91848e7b0e4396f2e31373e63e8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
19
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/RotateObject.cs
vendored
Normal file
19
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/RotateObject.cs
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace HorizonBasedAmbientOcclusion.Universal
|
||||
{
|
||||
public class RotateObject : MonoBehaviour
|
||||
{
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.Rotate(Vector3.up * Time.deltaTime * 15.0f, Space.World);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/RotateObject.cs.meta
vendored
Normal file
11
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Demo/Runtime/RotateObject.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 661c50f52ae812e42a32e8ed7dfa84c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a82bfeb39ff8ba5459ceb4eb8d655938
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
26
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAO.Universal.Editor.asmdef
vendored
Normal file
26
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAO.Universal.Editor.asmdef
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "HBAO.Universal.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:09d385cb911270749b709e1bb48e9ea1",
|
||||
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
|
||||
"GUID:3eae0364be2026648bf74846acb8a731"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [
|
||||
{
|
||||
"name": "com.unity.render-pipelines.universal",
|
||||
"expression": "10.0.0-preview",
|
||||
"define": "URP_10_0_0_OR_NEWER"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f352a4e1c986a0b4e8661cfff9c14881
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
336
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAOEditor.cs
vendored
Normal file
336
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAOEditor.cs
vendored
Normal file
@ -0,0 +1,336 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Rendering;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace HorizonBasedAmbientOcclusion.Universal
|
||||
{
|
||||
[VolumeComponentEditor(typeof(HBAO))]
|
||||
public class HBAOEditor : VolumeComponentEditor
|
||||
{
|
||||
private HBAO m_HBAO;
|
||||
private Texture2D m_HBAOTex;
|
||||
private GUIStyle m_SettingsGroupStyle;
|
||||
private GUIStyle m_TitleLabelStyle;
|
||||
private int m_SelectedPreset;
|
||||
private PropertyFetcher<HBAO> m_PropertyFetcher;
|
||||
|
||||
// settings group <setting, property reference>
|
||||
private Dictionary<HBAO.SettingsGroup, List<MemberInfo>> m_GroupFields = new Dictionary<HBAO.SettingsGroup, List<MemberInfo>>();
|
||||
private readonly Dictionary<int, HBAO.Preset> m_Presets = new Dictionary<int, HBAO.Preset>()
|
||||
{
|
||||
{ 0, HBAO.Preset.Normal },
|
||||
{ 1, HBAO.Preset.FastPerformance },
|
||||
{ 2, HBAO.Preset.FastestPerformance },
|
||||
{ 3, HBAO.Preset.Custom },
|
||||
{ 4, HBAO.Preset.HighQuality },
|
||||
{ 5, HBAO.Preset.HighestQuality }
|
||||
};
|
||||
|
||||
#if UNITY_2021_2_OR_NEWER
|
||||
public override bool hasAdditionalProperties => false;
|
||||
#else
|
||||
public override bool hasAdvancedMode => false;
|
||||
#endif
|
||||
|
||||
public override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
|
||||
m_HBAO = (HBAO)target;
|
||||
m_HBAOTex = Resources.Load<Texture2D>("hbao_urp");
|
||||
|
||||
//var o = new PropertyFetcher<HBAO>(serializedObject);
|
||||
m_PropertyFetcher = new PropertyFetcher<HBAO>(serializedObject);
|
||||
|
||||
|
||||
var settings = m_HBAO.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
|
||||
.Where(t => t.FieldType.IsSubclassOf(typeof(VolumeParameter)))
|
||||
.Where(t => (t.IsPublic && t.GetCustomAttributes(typeof(NonSerializedAttribute), false).Length == 0) ||
|
||||
(t.GetCustomAttributes(typeof(SerializeField), false).Length > 0))
|
||||
.Where(t => t.GetCustomAttributes(typeof(HideInInspector), false).Length == 0)
|
||||
.Where(t => t.GetCustomAttributes(typeof(HBAO.SettingsGroup), false).Any());
|
||||
foreach (var setting in settings)
|
||||
{
|
||||
//Debug.Log("setting name: " + setting.Name);
|
||||
|
||||
foreach (var attr in setting.GetCustomAttributes(typeof(HBAO.SettingsGroup)) as IEnumerable<HBAO.SettingsGroup>)
|
||||
{
|
||||
if (!m_GroupFields.ContainsKey(attr))
|
||||
m_GroupFields[attr] = new List<MemberInfo>();
|
||||
|
||||
m_GroupFields[attr].Add(setting);
|
||||
}
|
||||
}
|
||||
|
||||
m_SelectedPreset = m_Presets.Values.ToList().IndexOf(m_HBAO.GetCurrentPreset());
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
SetStyles();
|
||||
|
||||
EditorGUILayout.BeginVertical();
|
||||
{
|
||||
// header
|
||||
GUILayout.Space(10.0f);
|
||||
GUILayout.Label(m_HBAOTex, m_TitleLabelStyle, GUILayout.ExpandWidth(true));
|
||||
|
||||
//if (m_HBAO.GetComponents<MonoBehaviour>()[0] != m_HBAO)
|
||||
//{
|
||||
//GUILayout.Space(6.0f);
|
||||
//EditorGUILayout.HelpBox("This Post FX should be one of the first in your effect stack", MessageType.Info);
|
||||
//}
|
||||
|
||||
Event e = Event.current;
|
||||
|
||||
// settings groups
|
||||
foreach (var group in m_GroupFields)
|
||||
{
|
||||
GUILayout.Space(6.0f);
|
||||
Rect rect = GUILayoutUtility.GetRect(16f, 22f, m_SettingsGroupStyle);
|
||||
GUI.Box(rect, ObjectNames.NicifyVariableName(group.Key.GetType().Name), m_SettingsGroupStyle);
|
||||
if (e.type == EventType.MouseDown && rect.Contains(e.mousePosition))
|
||||
{
|
||||
group.Key.isExpanded = !group.Key.isExpanded;
|
||||
e.Use();
|
||||
}
|
||||
|
||||
if (!group.Key.isExpanded)
|
||||
continue;
|
||||
|
||||
// presets is a special case
|
||||
if (group.Key.GetType() == typeof(HBAO.Presets))
|
||||
{
|
||||
GUILayout.Space(6.0f);
|
||||
m_SelectedPreset = GUILayout.SelectionGrid(m_SelectedPreset, m_Presets.Values.Select(x => ObjectNames.NicifyVariableName(x.ToString())).ToArray(), 3);
|
||||
GUILayout.Space(6.0f);
|
||||
if (GUILayout.Button("Apply Preset"))
|
||||
{
|
||||
Undo.RecordObject(target, "Apply Preset");
|
||||
m_HBAO.ApplyPreset(m_Presets[m_SelectedPreset]);
|
||||
EditorUtility.SetDirty(target);
|
||||
/*if (!EditorApplication.isPlaying)
|
||||
{
|
||||
UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager.GetActiveScene());
|
||||
}*/
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var field in group.Value)
|
||||
{
|
||||
// warn about URP10+ required when mode is LitAO
|
||||
if (group.Key.GetType() == typeof(HBAO.GeneralSettings) && field.Name == "renderingPath")
|
||||
{
|
||||
if (m_HBAO.mode.overrideState && m_HBAO.mode.value == HBAO.Mode.LitAO)
|
||||
{
|
||||
#if !URP_10_0_0_OR_NEWER
|
||||
GUILayout.Space(6.0f);
|
||||
EditorGUILayout.HelpBox("LitAO mode requires URP 10 or newer!", MessageType.Warning);
|
||||
#endif
|
||||
}
|
||||
#if UNITY_2021_2_OR_NEWER
|
||||
else continue; // hides rendering path settings when not LitAO
|
||||
#else
|
||||
continue; // hides rendering path before URP12
|
||||
#endif
|
||||
}
|
||||
|
||||
// hide resolution when deinterleaved HBAO is on
|
||||
if (group.Key.GetType() == typeof(HBAO.GeneralSettings) && field.Name == "resolution")
|
||||
{
|
||||
if (m_HBAO.deinterleaving.overrideState && m_HBAO.GetDeinterleaving() != HBAO.Deinterleaving.Disabled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// warn about deinterleaving not supported with SPSR
|
||||
/*else if (group.Key.GetType() == typeof(HBAO.GeneralSettings) && field.Name == "debugMode")
|
||||
{
|
||||
if (m_HBAO.GetDeinterleaving() != HBAO.Deinterleaving.Disabled &&
|
||||
IsVrRunning() && PlayerSettings.stereoRenderingPath == StereoRenderingPath.SinglePass)
|
||||
{
|
||||
GUILayout.Space(6.0f);
|
||||
EditorGUILayout.HelpBox("Deinterleaving is not supported with Single Pass Stereo Rendering...", MessageType.Warning);
|
||||
}
|
||||
}*/
|
||||
// hide noise type when deinterleaved HBAO is on
|
||||
else if (group.Key.GetType() == typeof(HBAO.GeneralSettings) && field.Name == "noiseType")
|
||||
{
|
||||
if (m_HBAO.deinterleaving.overrideState && m_HBAO.GetDeinterleaving() != HBAO.Deinterleaving.Disabled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// warn about HBAO being disabled by default
|
||||
else if (group.Key.GetType() == typeof(HBAO.AOSettings) && field.Name == "radius")
|
||||
{
|
||||
if (m_HBAO.intensity.overrideState == false)
|
||||
{
|
||||
GUILayout.Space(6.0f);
|
||||
EditorGUILayout.HelpBox("The effect is disabled by default, you need to override intensity value in order to enable HBAO.", MessageType.Warning);
|
||||
}
|
||||
}
|
||||
// hide useMultiBounce setting when mode is LitAO
|
||||
else if (group.Key.GetType() == typeof(HBAO.AOSettings) && field.Name == "useMultiBounce")
|
||||
{
|
||||
if (m_HBAO.mode.overrideState && m_HBAO.mode.value == HBAO.Mode.LitAO)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// hide multiBounceInfluence setting when not used or when mode is LitAO
|
||||
else if (group.Key.GetType() == typeof(HBAO.AOSettings) && field.Name == "multiBounceInfluence")
|
||||
{
|
||||
if (!m_HBAO.useMultiBounce.overrideState || !m_HBAO.UseMultiBounce() ||
|
||||
(m_HBAO.mode.overrideState && m_HBAO.mode.value == HBAO.Mode.LitAO))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// hide directLightingStrength setting when mode is normal
|
||||
else if (group.Key.GetType() == typeof(HBAO.AOSettings) && field.Name == "directLightingStrength")
|
||||
{
|
||||
if (!m_HBAO.mode.overrideState || m_HBAO.mode.value == HBAO.Mode.Normal)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// warn about distance falloff greater than max distance
|
||||
else if (group.Key.GetType() == typeof(HBAO.AOSettings) && field.Name == "perPixelNormals")
|
||||
{
|
||||
if ((m_HBAO.distanceFalloff.overrideState || m_HBAO.maxDistance.overrideState) && m_HBAO.GetAoDistanceFalloff() > m_HBAO.GetAoMaxDistance())
|
||||
{
|
||||
GUILayout.Space(6.0f);
|
||||
EditorGUILayout.HelpBox("Distance Falloff shoudn't be superior to Max Distance", MessageType.Warning);
|
||||
}
|
||||
}
|
||||
// warn about distance falloff greater than max distance
|
||||
/*else if (group.Key.GetType() == typeof(HBAO.AOSettings) && field.Name == "baseColor")
|
||||
{
|
||||
if (m_HBAO.perPixelNormals.overrideState && m_HBAO.GetAoPerPixelNormals() == HBAO.PerPixelNormals.Camera)
|
||||
{
|
||||
GUILayout.Space(6.0f);
|
||||
EditorGUILayout.HelpBox("Currently Universal Render Pipeline does not generate camera normals, awaiting support...", MessageType.Warning);
|
||||
}
|
||||
}*/
|
||||
#if !UNITY_2021_2_OR_NEWER
|
||||
else if (group.Key.GetType() == typeof(HBAO.TemporalFilterSettings) && field.Name == "temporalFilterEnabled")
|
||||
{
|
||||
GUILayout.Space(6.0f);
|
||||
EditorGUILayout.HelpBox("Requires motion vectors support available in 2021.2+", MessageType.Warning);
|
||||
|
||||
if (m_HBAO.IsTemporalFilterEnabled())
|
||||
m_HBAO.EnableTemporalFilter(false);
|
||||
}
|
||||
#endif
|
||||
else if (group.Key.GetType() == typeof(HBAO.ColorBleedingSettings) && field.Name == "colorBleedingEnabled")
|
||||
{
|
||||
if (m_HBAO.mode.overrideState && m_HBAO.mode.value == HBAO.Mode.LitAO)
|
||||
{
|
||||
GUILayout.Space(6.0f);
|
||||
EditorGUILayout.HelpBox("Color bleeding can't be used in LitAO mode as AO is being injected into the lighting.", MessageType.Warning);
|
||||
|
||||
if (m_HBAO.IsColorBleedingEnabled())
|
||||
m_HBAO.EnableColorBleeding(false);
|
||||
}
|
||||
}
|
||||
|
||||
var parameter = Unpack(m_PropertyFetcher.Find(field.Name));
|
||||
var displayName = parameter.displayName;
|
||||
var hasDisplayName = field.GetCustomAttributes(typeof(HBAO.ParameterDisplayName)).Any();
|
||||
if (hasDisplayName)
|
||||
{
|
||||
var displayNameAttribute = field.GetCustomAttributes(typeof(HBAO.ParameterDisplayName)).First() as HBAO.ParameterDisplayName;
|
||||
displayName = displayNameAttribute.name;
|
||||
}
|
||||
|
||||
PropertyField(parameter, new GUIContent(displayName));
|
||||
}
|
||||
|
||||
GUILayout.Space(6.0f);
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
private void SetStyles()
|
||||
{
|
||||
// set banner label style
|
||||
m_TitleLabelStyle = new GUIStyle(GUI.skin.label);
|
||||
m_TitleLabelStyle.alignment = TextAnchor.MiddleCenter;
|
||||
m_TitleLabelStyle.contentOffset = new Vector2(0f, 0f);
|
||||
|
||||
// get shuriken module title style
|
||||
GUIStyle skurikenModuleTitleStyle = "ShurikenModuleTitle";
|
||||
|
||||
// clone it as to not interfere with the original, and adjust it
|
||||
m_SettingsGroupStyle = new GUIStyle(skurikenModuleTitleStyle);
|
||||
m_SettingsGroupStyle.font = (new GUIStyle("Label")).font;
|
||||
m_SettingsGroupStyle.fontStyle = FontStyle.Bold;
|
||||
m_SettingsGroupStyle.border = new RectOffset(15, 7, 4, 4);
|
||||
m_SettingsGroupStyle.fixedHeight = 22;
|
||||
m_SettingsGroupStyle.contentOffset = new Vector2(10f, -2f);
|
||||
}
|
||||
|
||||
List<UnityEngine.XR.XRDisplaySubsystemDescriptor> displaysDescs = new List<UnityEngine.XR.XRDisplaySubsystemDescriptor>();
|
||||
List<UnityEngine.XR.XRDisplaySubsystem> displays = new List<UnityEngine.XR.XRDisplaySubsystem>();
|
||||
|
||||
private bool IsVrRunning()
|
||||
{
|
||||
bool vrIsRunning = false;
|
||||
displays.Clear();
|
||||
SubsystemManager.GetSubsystems(displays);
|
||||
foreach (var displaySubsystem in displays)
|
||||
{
|
||||
if (displaySubsystem.running)
|
||||
{
|
||||
vrIsRunning = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return vrIsRunning;
|
||||
}
|
||||
|
||||
[VolumeParameterDrawer(typeof(HBAO.MinMaxFloatParameter))]
|
||||
public class MaxFloatParameterDrawer : VolumeParameterDrawer
|
||||
{
|
||||
public override bool OnGUI(SerializedDataParameter parameter, GUIContent title)
|
||||
{
|
||||
if (parameter.value.propertyType == SerializedPropertyType.Vector2)
|
||||
{
|
||||
var o = parameter.GetObjectRef<HBAO.MinMaxFloatParameter>();
|
||||
var range = o.value;
|
||||
float x = range.x;
|
||||
float y = range.y;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUILayout.MinMaxSlider(title, ref x, ref y, o.min, o.max);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
range.x = x;
|
||||
range.y = y;
|
||||
o.SetValue(new HBAO.MinMaxFloatParameter(range, o.min, o.max));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.LabelField(title, "Use only with Vector2");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAOEditor.cs.meta
vendored
Normal file
11
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/HBAOEditor.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e055f53efc7d248489d6579ce7685547
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ad43aa805fd6dd44a59e307ed9aa4bc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources/hbao_urp.png
(Stored with Git LFS)
vendored
Normal file
BIN
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources/hbao_urp.png
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
115
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources/hbao_urp.png.meta
vendored
Normal file
115
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Editor/Resources/hbao_urp.png.meta
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef156e8079ba9474aa9c13a37223ef49
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 10
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f906a4e3c3820d4a9e15a21943c91ed
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
24
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.Universal.Runtime.asmdef
vendored
Normal file
24
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.Universal.Runtime.asmdef
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "HBAO.Universal.Runtime",
|
||||
"references": [
|
||||
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
|
||||
"GUID:15fc0a57446b3144c949da3e2b9737a9"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [
|
||||
"UNITY_2019_3_OR_NEWER"
|
||||
],
|
||||
"versionDefines": [
|
||||
{
|
||||
"name": "com.unity.render-pipelines.universal",
|
||||
"expression": "10.0.0-preview",
|
||||
"define": "URP_10_0_0_OR_NEWER"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09d385cb911270749b709e1bb48e9ea1
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
631
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.cs
vendored
Normal file
631
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.cs
vendored
Normal file
@ -0,0 +1,631 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
namespace HorizonBasedAmbientOcclusion.Universal
|
||||
{
|
||||
[ExecuteInEditMode, VolumeComponentMenu("Lighting/HBAO")]
|
||||
public class HBAO : VolumeComponent, IPostProcessComponent
|
||||
{
|
||||
public enum Preset
|
||||
{
|
||||
FastestPerformance,
|
||||
FastPerformance,
|
||||
Normal,
|
||||
HighQuality,
|
||||
HighestQuality,
|
||||
Custom
|
||||
}
|
||||
|
||||
public enum Mode
|
||||
{
|
||||
Normal,
|
||||
LitAO
|
||||
}
|
||||
|
||||
public enum RenderingPath
|
||||
{
|
||||
Forward,
|
||||
Deferred
|
||||
}
|
||||
|
||||
public enum Quality
|
||||
{
|
||||
Lowest,
|
||||
Low,
|
||||
Medium,
|
||||
High,
|
||||
Highest
|
||||
}
|
||||
|
||||
public enum Resolution
|
||||
{
|
||||
Full,
|
||||
Half
|
||||
}
|
||||
|
||||
public enum NoiseType
|
||||
{
|
||||
Dither,
|
||||
InterleavedGradientNoise,
|
||||
SpatialDistribution
|
||||
}
|
||||
|
||||
public enum Deinterleaving
|
||||
{
|
||||
Disabled,
|
||||
x4
|
||||
}
|
||||
|
||||
public enum DebugMode
|
||||
{
|
||||
Disabled,
|
||||
AOOnly,
|
||||
ColorBleedingOnly,
|
||||
SplitWithoutAOAndWithAO,
|
||||
SplitWithAOAndAOOnly,
|
||||
SplitWithoutAOAndAOOnly,
|
||||
ViewNormals
|
||||
}
|
||||
|
||||
public enum BlurType
|
||||
{
|
||||
None,
|
||||
Narrow,
|
||||
Medium,
|
||||
Wide,
|
||||
ExtraWide
|
||||
}
|
||||
|
||||
public enum PerPixelNormals
|
||||
{
|
||||
Reconstruct2Samples,
|
||||
Reconstruct4Samples,
|
||||
Camera
|
||||
}
|
||||
|
||||
public enum VarianceClipping
|
||||
{
|
||||
Disabled,
|
||||
_4Tap,
|
||||
_8Tap
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class PresetParameter : VolumeParameter<Preset>
|
||||
{
|
||||
public PresetParameter(Preset value, bool overrideState = false)
|
||||
: base(value, overrideState) { }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class ModeParameter : VolumeParameter<Mode>
|
||||
{
|
||||
public ModeParameter(Mode value, bool overrideState = false)
|
||||
: base(value, overrideState) { }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class RenderingPathParameter : VolumeParameter<RenderingPath>
|
||||
{
|
||||
public RenderingPathParameter(RenderingPath value, bool overrideState = false)
|
||||
: base(value, overrideState) { }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class QualityParameter : VolumeParameter<Quality>
|
||||
{
|
||||
public QualityParameter(Quality value, bool overrideState = false)
|
||||
: base(value, overrideState) { }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class DeinterleavingParameter : VolumeParameter<Deinterleaving>
|
||||
{
|
||||
public DeinterleavingParameter(Deinterleaving value, bool overrideState = false)
|
||||
: base(value, overrideState) { }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class ResolutionParameter : VolumeParameter<Resolution>
|
||||
{
|
||||
public ResolutionParameter(Resolution value, bool overrideState = false)
|
||||
: base(value, overrideState) { }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class NoiseTypeParameter : VolumeParameter<NoiseType>
|
||||
{
|
||||
public NoiseTypeParameter(NoiseType value, bool overrideState = false)
|
||||
: base(value, overrideState) { }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class DebugModeParameter : VolumeParameter<DebugMode>
|
||||
{
|
||||
public DebugModeParameter(DebugMode value, bool overrideState = false)
|
||||
: base(value, overrideState) { }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class PerPixelNormalsParameter : VolumeParameter<PerPixelNormals>
|
||||
{
|
||||
public PerPixelNormalsParameter(PerPixelNormals value, bool overrideState = false)
|
||||
: base(value, overrideState) { }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class VarianceClippingParameter : VolumeParameter<VarianceClipping>
|
||||
{
|
||||
public VarianceClippingParameter(VarianceClipping value, bool overrideState = false)
|
||||
: base(value, overrideState) { }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class BlurTypeParameter : VolumeParameter<BlurType>
|
||||
{
|
||||
public BlurTypeParameter(BlurType value, bool overrideState = false)
|
||||
: base(value, overrideState) { }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public sealed class MinMaxFloatParameter : VolumeParameter<Vector2>
|
||||
{
|
||||
public float min;
|
||||
public float max;
|
||||
|
||||
public MinMaxFloatParameter(Vector2 value, float min, float max, bool overrideState = false)
|
||||
: base(value, overrideState)
|
||||
{
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class SettingsGroup : Attribute
|
||||
{
|
||||
public bool isExpanded = true;
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class ParameterDisplayName : Attribute
|
||||
{
|
||||
public string name;
|
||||
|
||||
public ParameterDisplayName(string name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
public class Presets : SettingsGroup { }
|
||||
public class GeneralSettings : SettingsGroup { }
|
||||
public class AOSettings : SettingsGroup { }
|
||||
public class TemporalFilterSettings : SettingsGroup { }
|
||||
public class BlurSettings : SettingsGroup { }
|
||||
public class ColorBleedingSettings : SettingsGroup { }
|
||||
|
||||
[Presets]
|
||||
public PresetParameter preset = new PresetParameter(Preset.Normal);
|
||||
|
||||
[Tooltip("The mode of the AO.")]
|
||||
[GeneralSettings, Space(6)]
|
||||
public ModeParameter mode = new ModeParameter(Mode.Normal);
|
||||
[Tooltip("The rendering path used for AO. Temporary settings as for now rendering path is internal to renderer settings.")]
|
||||
[GeneralSettings, Space(6)]
|
||||
public RenderingPathParameter renderingPath = new RenderingPathParameter(RenderingPath.Forward);
|
||||
[Tooltip("The quality of the AO.")]
|
||||
[GeneralSettings, Space(6)]
|
||||
public QualityParameter quality = new QualityParameter(Quality.Medium);
|
||||
[Tooltip("The deinterleaving factor.")]
|
||||
[GeneralSettings]
|
||||
public DeinterleavingParameter deinterleaving = new DeinterleavingParameter(Deinterleaving.Disabled);
|
||||
[Tooltip("The resolution at which the AO is calculated.")]
|
||||
[GeneralSettings]
|
||||
public ResolutionParameter resolution = new ResolutionParameter(Resolution.Full);
|
||||
[Tooltip("The type of noise to use.")]
|
||||
[GeneralSettings, Space(10)]
|
||||
public NoiseTypeParameter noiseType = new NoiseTypeParameter(NoiseType.Dither);
|
||||
[Tooltip("The debug mode actually displayed on screen.")]
|
||||
[GeneralSettings, Space(10)]
|
||||
public DebugModeParameter debugMode = new DebugModeParameter(DebugMode.Disabled);
|
||||
|
||||
[Tooltip("AO radius: this is the distance outside which occluders are ignored.")]
|
||||
[AOSettings, Space(6)]
|
||||
public ClampedFloatParameter radius = new ClampedFloatParameter(0.8f, 0.25f, 5f);
|
||||
[Tooltip("Maximum radius in pixels: this prevents the radius to grow too much with close-up " +
|
||||
"object and impact on performances.")]
|
||||
[AOSettings]
|
||||
public ClampedFloatParameter maxRadiusPixels = new ClampedFloatParameter(128f, 16f, 256f);
|
||||
[Tooltip("For low-tessellated geometry, occlusion variations tend to appear at creases and " +
|
||||
"ridges, which betray the underlying tessellation. To remove these artifacts, we use " +
|
||||
"an angle bias parameter which restricts the hemisphere.")]
|
||||
[AOSettings]
|
||||
public ClampedFloatParameter bias = new ClampedFloatParameter(0.05f, 0f, 0.5f);
|
||||
[Tooltip("This value allows to scale up the ambient occlusion values.")]
|
||||
[AOSettings]
|
||||
public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0, 4f);
|
||||
[Tooltip("Enable/disable MultiBounce approximation.")]
|
||||
[AOSettings]
|
||||
public BoolParameter useMultiBounce = new BoolParameter(false);
|
||||
[Tooltip("MultiBounce approximation influence.")]
|
||||
[AOSettings]
|
||||
public ClampedFloatParameter multiBounceInfluence = new ClampedFloatParameter(1f, 0f, 1f);
|
||||
[Tooltip("How much AO affect direct lighting.")]
|
||||
[AOSettings]
|
||||
public ClampedFloatParameter directLightingStrength = new ClampedFloatParameter(0.25f, 0, 1f);
|
||||
[Tooltip("The amount of AO offscreen samples are contributing.")]
|
||||
[AOSettings]
|
||||
public ClampedFloatParameter offscreenSamplesContribution = new ClampedFloatParameter(0f, 0f, 1f);
|
||||
[Tooltip("The max distance to display AO.")]
|
||||
[AOSettings, Space(10)]
|
||||
public FloatParameter maxDistance = new FloatParameter(150f);
|
||||
[Tooltip("The distance before max distance at which AO start to decrease.")]
|
||||
[AOSettings]
|
||||
public FloatParameter distanceFalloff = new FloatParameter(50f);
|
||||
[Tooltip("The type of per pixel normals to use.")]
|
||||
[AOSettings, Space(10)]
|
||||
#if URP_10_0_0_OR_NEWER
|
||||
public PerPixelNormalsParameter perPixelNormals = new PerPixelNormalsParameter(PerPixelNormals.Camera);
|
||||
#else
|
||||
public PerPixelNormalsParameter perPixelNormals = new PerPixelNormalsParameter(PerPixelNormals.Reconstruct4Samples);
|
||||
#endif
|
||||
[Tooltip("This setting allow you to set the base color if the AO, the alpha channel value is unused.")]
|
||||
[AOSettings, Space(10)]
|
||||
public ColorParameter baseColor = new ColorParameter(Color.black);
|
||||
|
||||
[TemporalFilterSettings, ParameterDisplayName("Enabled"), Space(6)]
|
||||
public BoolParameter temporalFilterEnabled = new BoolParameter(false);
|
||||
[Tooltip("The type of variance clipping to use.")]
|
||||
[TemporalFilterSettings]
|
||||
public VarianceClippingParameter varianceClipping = new VarianceClippingParameter(VarianceClipping._4Tap);
|
||||
|
||||
[Tooltip("The type of blur to use.")]
|
||||
[BlurSettings, ParameterDisplayName("Type"), Space(6)]
|
||||
public BlurTypeParameter blurType = new BlurTypeParameter(BlurType.Medium);
|
||||
|
||||
[Tooltip("This parameter controls the depth-dependent weight of the bilateral filter, to " +
|
||||
"avoid bleeding across edges. A zero sharpness is a pure Gaussian blur. Increasing " +
|
||||
"the blur sharpness removes bleeding by using lower weights for samples with large " +
|
||||
"depth delta from the current pixel.")]
|
||||
[BlurSettings, Space(10)]
|
||||
public ClampedFloatParameter sharpness = new ClampedFloatParameter(8f, 0f, 16f);
|
||||
|
||||
[ColorBleedingSettings, ParameterDisplayName("Enabled"), Space(6)]
|
||||
public BoolParameter colorBleedingEnabled = new BoolParameter(false);
|
||||
[Tooltip("This value allows to control the saturation of the color bleeding.")]
|
||||
[ColorBleedingSettings, Space(10)]
|
||||
public ClampedFloatParameter saturation = new ClampedFloatParameter(1f, 0f, 4f);
|
||||
[Tooltip("Use masking on emissive pixels")]
|
||||
[ColorBleedingSettings]
|
||||
public ClampedFloatParameter brightnessMask = new ClampedFloatParameter(1f, 0f, 1f);
|
||||
[Tooltip("Brightness level where masking starts/ends")]
|
||||
[ColorBleedingSettings]
|
||||
public MinMaxFloatParameter brightnessMaskRange = new MinMaxFloatParameter(new Vector2(0f, 0.5f), 0f, 2f);
|
||||
|
||||
public void EnableHBAO(bool enable)
|
||||
{
|
||||
intensity.overrideState = enable;
|
||||
}
|
||||
|
||||
public Preset GetCurrentPreset()
|
||||
{
|
||||
return preset.value;
|
||||
}
|
||||
|
||||
public void ApplyPreset(Preset preset)
|
||||
{
|
||||
if (preset == Preset.Custom)
|
||||
{
|
||||
this.preset.Override(preset);
|
||||
return;
|
||||
}
|
||||
|
||||
var actualDebugMode = debugMode.value;
|
||||
var actualDebugModeOverride = debugMode.overrideState;
|
||||
SetAllOverridesTo(false);
|
||||
debugMode.overrideState = actualDebugModeOverride;
|
||||
debugMode.value = actualDebugMode;
|
||||
|
||||
switch (preset)
|
||||
{
|
||||
case Preset.FastestPerformance:
|
||||
SetQuality(Quality.Lowest);
|
||||
SetAoRadius(0.5f);
|
||||
SetAoMaxRadiusPixels(64.0f);
|
||||
SetBlurType(BlurType.ExtraWide);
|
||||
break;
|
||||
case Preset.FastPerformance:
|
||||
SetQuality(Quality.Low);
|
||||
SetAoRadius(0.5f);
|
||||
SetAoMaxRadiusPixels(64.0f);
|
||||
SetBlurType(BlurType.Wide);
|
||||
break;
|
||||
case Preset.HighQuality:
|
||||
SetQuality(Quality.High);
|
||||
SetAoRadius(1.0f);
|
||||
break;
|
||||
case Preset.HighestQuality:
|
||||
SetQuality(Quality.Highest);
|
||||
SetAoRadius(1.2f);
|
||||
SetAoMaxRadiusPixels(256.0f);
|
||||
SetBlurType(BlurType.Narrow);
|
||||
break;
|
||||
case Preset.Normal:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
this.preset.Override(preset);
|
||||
}
|
||||
|
||||
public Mode GetMode()
|
||||
{
|
||||
return mode.value;
|
||||
}
|
||||
|
||||
public void SetMode(Mode mode)
|
||||
{
|
||||
this.mode.Override(mode);
|
||||
}
|
||||
|
||||
public RenderingPath GetRenderingPath()
|
||||
{
|
||||
return renderingPath.value;
|
||||
}
|
||||
|
||||
public void SetRenderingPath(RenderingPath renderingPath)
|
||||
{
|
||||
this.renderingPath.Override(renderingPath);
|
||||
}
|
||||
|
||||
public Quality GetQuality()
|
||||
{
|
||||
return quality.value;
|
||||
}
|
||||
|
||||
public void SetQuality(Quality quality)
|
||||
{
|
||||
this.quality.Override(quality);
|
||||
}
|
||||
|
||||
public Deinterleaving GetDeinterleaving()
|
||||
{
|
||||
return deinterleaving.value;
|
||||
}
|
||||
|
||||
public void SetDeinterleaving(Deinterleaving deinterleaving)
|
||||
{
|
||||
this.deinterleaving.Override(deinterleaving);
|
||||
}
|
||||
|
||||
public Resolution GetResolution()
|
||||
{
|
||||
return resolution.value;
|
||||
}
|
||||
|
||||
public void SetResolution(Resolution resolution)
|
||||
{
|
||||
this.resolution.Override(resolution);
|
||||
}
|
||||
|
||||
public NoiseType GetNoiseType()
|
||||
{
|
||||
return noiseType.value;
|
||||
}
|
||||
|
||||
public void SetNoiseType(NoiseType noiseType)
|
||||
{
|
||||
this.noiseType.Override(noiseType);
|
||||
}
|
||||
|
||||
public DebugMode GetDebugMode()
|
||||
{
|
||||
return debugMode.value;
|
||||
}
|
||||
|
||||
public void SetDebugMode(DebugMode debugMode)
|
||||
{
|
||||
this.debugMode.Override(debugMode);
|
||||
}
|
||||
|
||||
public float GetAoRadius()
|
||||
{
|
||||
return radius.value;
|
||||
}
|
||||
|
||||
public void SetAoRadius(float radius)
|
||||
{
|
||||
this.radius.Override(Mathf.Clamp(radius, this.radius.min, this.radius.max));
|
||||
}
|
||||
|
||||
public float GetAoMaxRadiusPixels()
|
||||
{
|
||||
return maxRadiusPixels.value;
|
||||
}
|
||||
|
||||
public void SetAoMaxRadiusPixels(float maxRadiusPixels)
|
||||
{
|
||||
this.maxRadiusPixels.Override(Mathf.Clamp(maxRadiusPixels, this.maxRadiusPixels.min, this.maxRadiusPixels.max));
|
||||
}
|
||||
|
||||
public float GetAoBias()
|
||||
{
|
||||
return bias.value;
|
||||
}
|
||||
|
||||
public void SetAoBias(float bias)
|
||||
{
|
||||
this.bias.Override(Mathf.Clamp(bias, this.bias.min, this.bias.max));
|
||||
}
|
||||
|
||||
public float GetAoOffscreenSamplesContribution()
|
||||
{
|
||||
return offscreenSamplesContribution.value;
|
||||
}
|
||||
|
||||
public void SetAoOffscreenSamplesContribution(float offscreenSamplesContribution)
|
||||
{
|
||||
this.offscreenSamplesContribution.Override(Mathf.Clamp(offscreenSamplesContribution, this.offscreenSamplesContribution.min, this.offscreenSamplesContribution.max));
|
||||
}
|
||||
|
||||
public float GetAoMaxDistance()
|
||||
{
|
||||
return maxDistance.value;
|
||||
}
|
||||
|
||||
public void SetAoMaxDistance(float maxDistance)
|
||||
{
|
||||
this.maxDistance.Override(maxDistance);
|
||||
}
|
||||
|
||||
public float GetAoDistanceFalloff()
|
||||
{
|
||||
return distanceFalloff.value;
|
||||
}
|
||||
|
||||
public void SetAoDistanceFalloff(float distanceFalloff)
|
||||
{
|
||||
this.distanceFalloff.Override(distanceFalloff);
|
||||
}
|
||||
|
||||
public PerPixelNormals GetAoPerPixelNormals()
|
||||
{
|
||||
return perPixelNormals.value;
|
||||
}
|
||||
|
||||
public void SetAoPerPixelNormals(PerPixelNormals perPixelNormals)
|
||||
{
|
||||
this.perPixelNormals.Override(perPixelNormals);
|
||||
}
|
||||
|
||||
public Color GetAoColor()
|
||||
{
|
||||
return baseColor.value;
|
||||
}
|
||||
|
||||
public void SetAoColor(Color baseColor)
|
||||
{
|
||||
this.baseColor.Override(baseColor);
|
||||
}
|
||||
|
||||
public float GetAoIntensity()
|
||||
{
|
||||
return intensity.value;
|
||||
}
|
||||
|
||||
public void SetAoIntensity(float intensity)
|
||||
{
|
||||
this.intensity.Override(Mathf.Clamp(intensity, this.intensity.min, this.intensity.max));
|
||||
}
|
||||
|
||||
public bool UseMultiBounce()
|
||||
{
|
||||
return useMultiBounce.value;
|
||||
}
|
||||
|
||||
public void EnableMultiBounce(bool enabled = true)
|
||||
{
|
||||
useMultiBounce.Override(enabled);
|
||||
}
|
||||
|
||||
public float GetAoMultiBounceInfluence()
|
||||
{
|
||||
return multiBounceInfluence.value;
|
||||
}
|
||||
|
||||
public void SetAoMultiBounceInfluence(float multiBounceInfluence)
|
||||
{
|
||||
this.multiBounceInfluence.Override(Mathf.Clamp(multiBounceInfluence, this.multiBounceInfluence.min, this.multiBounceInfluence.max));
|
||||
}
|
||||
|
||||
public bool IsTemporalFilterEnabled()
|
||||
{
|
||||
return temporalFilterEnabled.value;
|
||||
}
|
||||
|
||||
public void EnableTemporalFilter(bool enabled = true)
|
||||
{
|
||||
temporalFilterEnabled.Override(enabled);
|
||||
}
|
||||
|
||||
public VarianceClipping GetTemporalFilterVarianceClipping()
|
||||
{
|
||||
return varianceClipping.value;
|
||||
}
|
||||
|
||||
public void SetTemporalFilterVarianceClipping(VarianceClipping varianceClipping)
|
||||
{
|
||||
this.varianceClipping.Override(varianceClipping);
|
||||
}
|
||||
|
||||
public BlurType GetBlurType()
|
||||
{
|
||||
return blurType.value;
|
||||
}
|
||||
|
||||
public void SetBlurType(BlurType blurType)
|
||||
{
|
||||
this.blurType.Override(blurType);
|
||||
}
|
||||
|
||||
public float GetBlurSharpness()
|
||||
{
|
||||
return sharpness.value;
|
||||
}
|
||||
|
||||
public void SetBlurSharpness(float sharpness)
|
||||
{
|
||||
this.sharpness.Override(Mathf.Clamp(sharpness, this.sharpness.min, this.sharpness.max));
|
||||
}
|
||||
|
||||
public bool IsColorBleedingEnabled()
|
||||
{
|
||||
return colorBleedingEnabled.value;
|
||||
}
|
||||
|
||||
public void EnableColorBleeding(bool enabled = true)
|
||||
{
|
||||
colorBleedingEnabled.Override(enabled);
|
||||
}
|
||||
|
||||
public float GetColorBleedingSaturation()
|
||||
{
|
||||
return saturation.value;
|
||||
}
|
||||
|
||||
public void SetColorBleedingSaturation(float saturation)
|
||||
{
|
||||
this.saturation.Override(Mathf.Clamp(saturation, this.saturation.min, this.saturation.max));
|
||||
}
|
||||
|
||||
public float GetColorBleedingBrightnessMask()
|
||||
{
|
||||
return brightnessMask.value;
|
||||
}
|
||||
|
||||
public void SetColorBleedingBrightnessMask(float brightnessMask)
|
||||
{
|
||||
this.brightnessMask.Override(Mathf.Clamp(brightnessMask, this.brightnessMask.min, this.brightnessMask.max));
|
||||
}
|
||||
|
||||
public Vector2 GetColorBleedingBrightnessMaskRange()
|
||||
{
|
||||
return brightnessMaskRange.value;
|
||||
}
|
||||
|
||||
public void SetColorBleedingBrightnessMaskRange(Vector2 brightnessMaskRange)
|
||||
{
|
||||
brightnessMaskRange.x = Mathf.Clamp(brightnessMaskRange.x, this.brightnessMaskRange.min, this.brightnessMaskRange.max);
|
||||
brightnessMaskRange.y = Mathf.Clamp(brightnessMaskRange.y, this.brightnessMaskRange.min, this.brightnessMaskRange.max);
|
||||
brightnessMaskRange.x = Mathf.Min(brightnessMaskRange.x, brightnessMaskRange.y);
|
||||
this.brightnessMaskRange.Override(brightnessMaskRange);
|
||||
}
|
||||
|
||||
public bool IsActive() => intensity.overrideState && intensity.value > 0;
|
||||
|
||||
public bool IsTileCompatible() => true;
|
||||
}
|
||||
}
|
||||
11
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.cs.meta
vendored
Normal file
11
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAO.cs.meta
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90fbf49926625114084d7e0c0cffe8d1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1003
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAORendererFeature.cs
vendored
Normal file
1003
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAORendererFeature.cs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
13
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAORendererFeature.cs.meta
vendored
Normal file
13
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Runtime/HBAORendererFeature.cs.meta
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7c2c2c3c19808149a4d3454e1019255
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- settings: {fileID: 11400000, guid: 68dde9df85a05a54fbc92e3b6f3a8c42, type: 2}
|
||||
- hbaoShader: {fileID: 4800000, guid: bf610497676b34e4dbe0f14fe3fe311c, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39ee3648c2c58684590305025db692f6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
370
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO.shader
vendored
Normal file
370
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO.shader
vendored
Normal file
@ -0,0 +1,370 @@
|
||||
Shader "Hidden/Universal Render Pipeline/HBAO"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("", any) = "" {}
|
||||
_HBAOTex("", any) = "" {}
|
||||
_TempTex("", any) = "" {}
|
||||
_NoiseTex("", 2D) = "" {}
|
||||
_DepthTex("", any) = "" {}
|
||||
_NormalsTex("", any) = "" {}
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
|
||||
#pragma target 3.0
|
||||
#pragma prefer_hlslcc gles
|
||||
#pragma exclude_renderers d3d11_9x
|
||||
#pragma editor_sync_compilation
|
||||
//#pragma enable_d3d11_debug_symbols
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
TEXTURE2D_X(_MainTex);
|
||||
TEXTURE2D_X(_HBAOTex);
|
||||
TEXTURE2D_X(_TempTex);
|
||||
TEXTURE2D_X(_DepthTex);
|
||||
TEXTURE2D_X(_NormalsTex);
|
||||
//TEXTURE2D_X(_CameraNormalsTexture);
|
||||
TEXTURE2D_X(_MotionVectorTexture);
|
||||
TEXTURE2D(_NoiseTex);
|
||||
// SAMPLER(sampler_PointRepeat);
|
||||
// SAMPLER(sampler_PointClamp);
|
||||
|
||||
float4 _HistoryBuffer_RTHandleScale;
|
||||
|
||||
CBUFFER_START(FrequentlyUpdatedUniforms)
|
||||
float4 _Input_TexelSize;
|
||||
float4 _AO_TexelSize;
|
||||
float4 _DeinterleavedAO_TexelSize;
|
||||
float4 _ReinterleavedAO_TexelSize;
|
||||
float4 _TargetScale;
|
||||
float4 _UVToView;
|
||||
float4x4 _WorldToCameraMatrix;
|
||||
float _Radius;
|
||||
float _MaxRadiusPixels;
|
||||
float _NegInvRadius2;
|
||||
float _AngleBias;
|
||||
float _AOmultiplier;
|
||||
float _Intensity;
|
||||
half4 _BaseColor;
|
||||
float _MultiBounceInfluence;
|
||||
float _OffscreenSamplesContrib;
|
||||
float _MaxDistance;
|
||||
float _DistanceFalloff;
|
||||
float _BlurSharpness;
|
||||
float _ColorBleedSaturation;
|
||||
float _ColorBleedBrightnessMask;
|
||||
float2 _ColorBleedBrightnessMaskRange;
|
||||
float2 _TemporalParams;
|
||||
CBUFFER_END
|
||||
|
||||
CBUFFER_START(PerPassUpdatedUniforms)
|
||||
float2 _BlurDeltaUV;
|
||||
CBUFFER_END
|
||||
|
||||
CBUFFER_START(PerPassUpdatedDeinterleavingUniforms)
|
||||
float2 _Deinterleave_Offset00;
|
||||
float2 _Deinterleave_Offset10;
|
||||
float2 _Deinterleave_Offset01;
|
||||
float2 _Deinterleave_Offset11;
|
||||
float2 _AtlasOffset;
|
||||
float2 _Jitter;
|
||||
CBUFFER_END
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
Varyings Vert(Attributes input)
|
||||
{
|
||||
Varyings output;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
//output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
|
||||
// Note: The pass is setup with a mesh already in CS
|
||||
// Therefore, we can just output vertex position
|
||||
output.positionCS = float4(input.positionOS.xyz, 1.0);
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
output.positionCS.y *= -1;
|
||||
#endif
|
||||
output.uv = input.uv;
|
||||
return output;
|
||||
}
|
||||
|
||||
Varyings Vert_Atlas(Attributes input)
|
||||
{
|
||||
Varyings output;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
//float3 pos = input.positionOS.xyz;
|
||||
//pos.xy = pos.xy * (_DeinterleavedAO_TexelSize.zw / _ReinterleavedAO_TexelSize.zw) + _AtlasOffset * _ReinterleavedAO_TexelSize.xy;
|
||||
//output.positionCS = TransformObjectToHClip(pos);
|
||||
output.positionCS = float4((input.positionOS.xy + float2(-3.0, 1.0)) * (_DeinterleavedAO_TexelSize.zw / _ReinterleavedAO_TexelSize.zw) + 2.0 * _AtlasOffset * _ReinterleavedAO_TexelSize.xy, 0.0, 1.0);
|
||||
// flip triangle upside down
|
||||
output.positionCS.y = 1 - output.positionCS.y;
|
||||
output.uv = input.uv;
|
||||
return output;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" }
|
||||
LOD 100
|
||||
ZWrite Off ZTest Always Blend Off Cull Off
|
||||
|
||||
Pass // 0
|
||||
{
|
||||
Name "HBAO - AO"
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION
|
||||
#pragma multi_compile_local __ COLOR_BLEEDING
|
||||
#pragma multi_compile_local __ OFFSCREEN_SAMPLES_CONTRIBUTION
|
||||
#pragma multi_compile_local __ NORMALS_RECONSTRUCT2 NORMALS_RECONSTRUCT4
|
||||
#pragma multi_compile_local __ INTERLEAVED_GRADIENT_NOISE
|
||||
#pragma multi_compile_local QUALITY_LOWEST QUALITY_LOW QUALITY_MEDIUM QUALITY_HIGH QUALITY_HIGHEST
|
||||
#pragma multi_compile_fragment __ _GBUFFER_NORMALS_OCT // support octahedron endoded normals
|
||||
|
||||
#if QUALITY_LOWEST
|
||||
#define DIRECTIONS 3
|
||||
#define STEPS 2
|
||||
#elif QUALITY_LOW
|
||||
#define DIRECTIONS 4
|
||||
#define STEPS 3
|
||||
#elif QUALITY_MEDIUM
|
||||
#define DIRECTIONS 6
|
||||
#define STEPS 4
|
||||
#elif QUALITY_HIGH
|
||||
#define DIRECTIONS 8
|
||||
#define STEPS 4
|
||||
#elif QUALITY_HIGHEST
|
||||
#define DIRECTIONS 8
|
||||
#define STEPS 6
|
||||
#else
|
||||
#define DIRECTIONS 1
|
||||
#define STEPS 1
|
||||
#endif
|
||||
|
||||
#pragma vertex Vert
|
||||
#pragma fragment AO_Frag
|
||||
|
||||
#include "HBAO_AO.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass // 1
|
||||
{
|
||||
Name "HBAO - AO Deinterleaved"
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION
|
||||
#pragma multi_compile_local __ COLOR_BLEEDING
|
||||
#pragma multi_compile_local __ OFFSCREEN_SAMPLES_CONTRIBUTION
|
||||
#pragma multi_compile_local QUALITY_LOWEST QUALITY_LOW QUALITY_MEDIUM QUALITY_HIGH QUALITY_HIGHEST
|
||||
|
||||
#if QUALITY_LOWEST
|
||||
#define DIRECTIONS 3
|
||||
#define STEPS 2
|
||||
#elif QUALITY_LOW
|
||||
#define DIRECTIONS 4
|
||||
#define STEPS 3
|
||||
#elif QUALITY_MEDIUM
|
||||
#define DIRECTIONS 6
|
||||
#define STEPS 4
|
||||
#elif QUALITY_HIGH
|
||||
#define DIRECTIONS 8
|
||||
#define STEPS 4
|
||||
#elif QUALITY_HIGHEST
|
||||
#define DIRECTIONS 8
|
||||
#define STEPS 6
|
||||
#else
|
||||
#define DIRECTIONS 1
|
||||
#define STEPS 1
|
||||
#endif
|
||||
|
||||
#define DEINTERLEAVED
|
||||
|
||||
#pragma vertex Vert
|
||||
#pragma fragment AO_Frag
|
||||
|
||||
#include "HBAO_AO.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// 2
|
||||
Pass {
|
||||
Name "HBAO - Deinterleave Depth"
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment DeinterleaveDepth_Frag
|
||||
|
||||
#include "HBAO_Deinterleaving.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// 3
|
||||
Pass {
|
||||
Name "HBAO - Deinterleave Normals"
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION
|
||||
#pragma multi_compile_local __ NORMALS_RECONSTRUCT2 NORMALS_RECONSTRUCT4
|
||||
#pragma multi_compile_fragment __ _GBUFFER_NORMALS_OCT // support octahedron endoded normals
|
||||
|
||||
#pragma vertex Vert
|
||||
#pragma fragment DeinterleaveNormals_Frag
|
||||
|
||||
#include "HBAO_Deinterleaving.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// 4
|
||||
Pass {
|
||||
Name "HBAO - Atlas Deinterleaved AO"
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex Vert_Atlas
|
||||
#pragma fragment Frag
|
||||
|
||||
half4 Frag(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(input.uv);
|
||||
return SAMPLE_TEXTURE2D_X(_MainTex, sampler_PointClamp, uv);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// 5
|
||||
Pass {
|
||||
Name "HBAO - Reinterleave AO"
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment ReinterleaveAO_Frag
|
||||
|
||||
#include "HBAO_Deinterleaving.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass // 6
|
||||
{
|
||||
Name "HBAO - Blur"
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION
|
||||
#pragma multi_compile_local __ COLOR_BLEEDING
|
||||
#pragma multi_compile_local BLUR_RADIUS_2 BLUR_RADIUS_3 BLUR_RADIUS_4 BLUR_RADIUS_5
|
||||
|
||||
#if BLUR_RADIUS_2
|
||||
#define KERNEL_RADIUS 2
|
||||
#elif BLUR_RADIUS_3
|
||||
#define KERNEL_RADIUS 3
|
||||
#elif BLUR_RADIUS_4
|
||||
#define KERNEL_RADIUS 4
|
||||
#elif BLUR_RADIUS_5
|
||||
#define KERNEL_RADIUS 5
|
||||
#else
|
||||
#define KERNEL_RADIUS 0
|
||||
#endif
|
||||
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Blur_Frag
|
||||
|
||||
#include "HBAO_Blur.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass // 7
|
||||
{
|
||||
Name "HBAO - Temporal Filter"
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_local __ COLOR_BLEEDING
|
||||
#pragma multi_compile_local __ VARIANCE_CLIPPING_4TAP VARIANCE_CLIPPING_8TAP
|
||||
|
||||
#pragma vertex Vert
|
||||
#pragma fragment TemporalFilter_Frag
|
||||
|
||||
#include "HBAO_TemporalFilter.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass // 8
|
||||
{
|
||||
Name "HBAO - Copy"
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag
|
||||
|
||||
half4 Frag(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(input.uv);
|
||||
return SAMPLE_TEXTURE2D_X(_MainTex, sampler_PointClamp, uv);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass // 9
|
||||
{
|
||||
Name "HBAO - Composite"
|
||||
|
||||
ColorMask RGB
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_local __ LIT_AO
|
||||
#pragma multi_compile_local __ COLOR_BLEEDING
|
||||
#pragma multi_compile_local __ MULTIBOUNCE
|
||||
#pragma multi_compile_local __ DEBUG_AO DEBUG_COLORBLEEDING DEBUG_NOAO_AO DEBUG_AO_AOONLY DEBUG_NOAO_AOONLY
|
||||
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Composite_Frag
|
||||
|
||||
#include "HBAO_Composite.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass // 10
|
||||
{
|
||||
Name "HBAO - Debug ViewNormals"
|
||||
|
||||
ColorMask RGB
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION
|
||||
#pragma multi_compile_local __ NORMALS_RECONSTRUCT2 NORMALS_RECONSTRUCT4
|
||||
#pragma multi_compile_fragment __ _GBUFFER_NORMALS_OCT // support octahedron endoded normals
|
||||
|
||||
#pragma vertex Vert
|
||||
#pragma fragment AO_Frag
|
||||
|
||||
#define DIRECTIONS 1
|
||||
#define STEPS 1
|
||||
#define DEBUG_VIEWNORMALS
|
||||
|
||||
#include "HBAO_AO.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO.shader.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO.shader.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf610497676b34e4dbe0f14fe3fe311c
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
205
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_AO.hlsl
vendored
Normal file
205
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_AO.hlsl
vendored
Normal file
@ -0,0 +1,205 @@
|
||||
//----------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
#ifndef HBAO_AO_INCLUDED
|
||||
#define HBAO_AO_INCLUDED
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Macros.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "HBAO_Common.hlsl"
|
||||
|
||||
inline float3 FetchLayerViewPos(float2 uv) {
|
||||
float depth = LinearizeDepth(SAMPLE_TEXTURE2D_X(_DepthTex, sampler_PointClamp, uv).r);
|
||||
#if ORTHOGRAPHIC_PROJECTION
|
||||
return float3((uv * _UVToView.xy + _UVToView.zw), depth);
|
||||
#else
|
||||
return float3((uv * _UVToView.xy + _UVToView.zw) * depth, depth);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
inline float Falloff(float distanceSquare) {
|
||||
// 1 scalar mad instruction
|
||||
return distanceSquare * _NegInvRadius2 + 1.0;
|
||||
}
|
||||
|
||||
inline float ComputeAO(float3 P, float3 N, float3 S) {
|
||||
float3 V = S - P;
|
||||
float VdotV = dot(V, V);
|
||||
float NdotV = dot(N, V) * rsqrt(VdotV);
|
||||
|
||||
// Use saturate(x) instead of max(x,0.f) because that is faster on Kepler
|
||||
return saturate(NdotV - _AngleBias) * saturate(Falloff(VdotV));
|
||||
}
|
||||
|
||||
inline float2 RotateDirections(float2 dir, float2 rot) {
|
||||
return float2(dir.x * rot.x - dir.y * rot.y,
|
||||
dir.x * rot.y + dir.y * rot.x);
|
||||
}
|
||||
|
||||
inline float InterleavedGradientNoise(float2 screenPos) {
|
||||
// http://www.iryoku.com/downloads/Next-Generation-Post-Processing-in-Call-of-Duty-Advanced-Warfare-v18.pptx (slide 123)
|
||||
float3 magic = float3(0.06711056, 0.00583715, 52.9829189);
|
||||
return frac(magic.z * frac(dot(screenPos, magic.xy)));
|
||||
}
|
||||
|
||||
inline float2 FetchNoise(float2 screenPos) {
|
||||
#if INTERLEAVED_GRADIENT_NOISE
|
||||
// Use Jorge Jimenez's IGN noise and GTAO spatial offsets distribution
|
||||
// https://blog.selfshadow.com/publications/s2016-shading-course/activision/s2016_pbs_activision_occlusion.pdf (slide 93)
|
||||
return float2(InterleavedGradientNoise(screenPos), SAMPLE_TEXTURE2D(_NoiseTex, sampler_PointRepeat, screenPos / 4.0).g);
|
||||
#else
|
||||
// (cos(alpha), sin(alpha), jitter)
|
||||
return SAMPLE_TEXTURE2D(_NoiseTex, sampler_PointRepeat, screenPos / 4.0).rg;
|
||||
#endif
|
||||
}
|
||||
|
||||
float4 AO_Frag(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(input.uv);
|
||||
//uint2 positionSS = input.uv * _ScreenSize.xy;
|
||||
|
||||
#ifdef DEINTERLEAVED
|
||||
float3 P = FetchLayerViewPos(uv);
|
||||
#else
|
||||
float3 P = FetchViewPos(uv);
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_VIEWNORMALS
|
||||
clip(_MaxDistance - P.z);
|
||||
#endif
|
||||
|
||||
#if ORTHOGRAPHIC_PROJECTION
|
||||
float stepSize = min(_Radius, _MaxRadiusPixels) / (STEPS + 1.0);
|
||||
#else
|
||||
float stepSize = min((_Radius / P.z), _MaxRadiusPixels) / (STEPS + 1.0);
|
||||
#endif
|
||||
|
||||
#ifdef DEINTERLEAVED
|
||||
float3 N = SAMPLE_TEXTURE2D_X(_NormalsTex, sampler_PointClamp, uv).rgb * 2.0 - 1.0;
|
||||
float2 rand = _Jitter; // angle, jitter
|
||||
#else
|
||||
float3 N = FetchViewNormals(uv, _AO_TexelSize.xy, P);
|
||||
//float2 rand = FetchNoise(positionSS);
|
||||
//float2 rand = FetchNoise(input.positionCS.xy);
|
||||
float2 rand = FetchNoise(uv * _AO_TexelSize.zw);
|
||||
#endif
|
||||
|
||||
const float alpha = 2.0 * PI / DIRECTIONS;
|
||||
float ao = 0;
|
||||
|
||||
#if COLOR_BLEEDING
|
||||
static float2 cbUVs[DIRECTIONS * STEPS];
|
||||
static float cbContribs[DIRECTIONS * STEPS];
|
||||
#endif
|
||||
|
||||
UNITY_UNROLL
|
||||
for (int d = 0; d < DIRECTIONS; ++d) {
|
||||
float angle = alpha * (float(d) + rand.x + _TemporalParams.x);
|
||||
|
||||
// Compute normalized 2D direction
|
||||
float cosA, sinA;
|
||||
sincos(angle, sinA, cosA);
|
||||
float2 direction = float2(cosA, sinA);
|
||||
|
||||
// Jitter starting sample within the first step
|
||||
float rayPixels = (frac(rand.y + _TemporalParams.y) * stepSize + 1.0);
|
||||
|
||||
UNITY_UNROLL
|
||||
for (int s = 0; s < STEPS; ++s) {
|
||||
|
||||
#ifdef DEINTERLEAVED
|
||||
float2 snappedUV = round(rayPixels * direction) * _DeinterleavedAO_TexelSize.xy + uv;
|
||||
float3 S = FetchLayerViewPos(snappedUV);
|
||||
#else
|
||||
float2 snappedUV = round(rayPixels * direction) * _Input_TexelSize.xy + uv;
|
||||
float3 S = FetchViewPos(snappedUV);
|
||||
#endif
|
||||
|
||||
rayPixels += stepSize;
|
||||
|
||||
float contrib = ComputeAO(P, N, S);
|
||||
#if OFFSCREEN_SAMPLES_CONTRIBUTION
|
||||
float2 offscreenAmount = _OffscreenSamplesContrib * (snappedUV - saturate(snappedUV) != 0 ? 1 : 0);
|
||||
contrib = max(contrib, offscreenAmount.x);
|
||||
contrib = max(contrib, offscreenAmount.y);
|
||||
#endif
|
||||
ao += contrib;
|
||||
|
||||
#if COLOR_BLEEDING
|
||||
int sampleIdx = d * s;
|
||||
cbUVs[sampleIdx] = snappedUV;
|
||||
cbContribs[sampleIdx] = contrib;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_VIEWNORMALS
|
||||
return float4(N * 0.5 + 0.5, 1);
|
||||
#else
|
||||
|
||||
#if COLOR_BLEEDING
|
||||
half3 col = half3(0, 0, 0);
|
||||
UNITY_UNROLL
|
||||
for (int s = 0; s < DIRECTIONS * STEPS; s += 2) {
|
||||
half3 emission = SAMPLE_TEXTURE2D_X_LOD(_MainTex, sampler_LinearClamp, cbUVs[s], 0).rgb;
|
||||
half average = (emission.x + emission.y + emission.z) / 3;
|
||||
half scaledAverage = saturate((average - _ColorBleedBrightnessMaskRange.x) / (_ColorBleedBrightnessMaskRange.y - _ColorBleedBrightnessMaskRange.x + 1e-6));
|
||||
half maskMultiplier = 1 - (scaledAverage * _ColorBleedBrightnessMask);
|
||||
col += emission * cbContribs[s] * maskMultiplier;
|
||||
}
|
||||
float4 aoOutput = float4(col, ao);
|
||||
#else
|
||||
float aoOutput = ao;
|
||||
#endif
|
||||
|
||||
// apply bias multiplier
|
||||
aoOutput *= (_AOmultiplier / (STEPS * DIRECTIONS));
|
||||
|
||||
float fallOffStart = _MaxDistance - _DistanceFalloff;
|
||||
float distFactor = saturate((P.z - fallOffStart) / (_MaxDistance - fallOffStart));
|
||||
|
||||
#if COLOR_BLEEDING
|
||||
//aoOutput.rgb = saturate(1 - lerp(dot(aoOutput.rgb, 0.333).xxx, aoOutput.rgb, _ColorBleedSaturation));
|
||||
aoOutput.rgb = saturate(lerp(dot(aoOutput.rgb, 0.333).xxx, aoOutput.rgb, _ColorBleedSaturation));
|
||||
aoOutput = lerp(saturate(float4(aoOutput.rgb, 1 - aoOutput.a)), float4(0, 0, 0, 1), distFactor);
|
||||
return aoOutput;
|
||||
#else
|
||||
aoOutput = lerp(saturate(1 - aoOutput), 1, distFactor);
|
||||
return float4(EncodeFloatRG(saturate(P.z * (1.0 / _ProjectionParams.z))), 1.0, aoOutput);
|
||||
#endif
|
||||
|
||||
#endif // DEBUG_VIEWNORMALS
|
||||
}
|
||||
|
||||
#endif // HBAO_AO_INCLUDED
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_AO.hlsl.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_AO.hlsl.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1361d098ef86d6c41a6a6c41e84c33a4
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
143
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Blur.hlsl
vendored
Normal file
143
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Blur.hlsl
vendored
Normal file
@ -0,0 +1,143 @@
|
||||
//----------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
#ifndef HBAO_BLUR_INCLUDED
|
||||
#define HBAO_BLUR_INCLUDED
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "HBAO_Common.hlsl"
|
||||
|
||||
#if COLOR_BLEEDING
|
||||
|
||||
inline void FetchAoAndDepth(float2 uv, inout half4 ao, inout float depth) {
|
||||
ao = SAMPLE_TEXTURE2D_X_LOD(_MainTex, sampler_PointClamp, uv, 0);
|
||||
depth = LinearizeDepth(FetchRawDepth(uv));
|
||||
}
|
||||
|
||||
inline float CrossBilateralWeight(float r, float d, float d0) {
|
||||
const float BlurSigma = (float)KERNEL_RADIUS * 0.5;
|
||||
const float BlurFalloff = 1.0 / (2.0*BlurSigma*BlurSigma);
|
||||
|
||||
float dz = (d0 - d) * _BlurSharpness;
|
||||
return exp2(-r*r*BlurFalloff - dz*dz);
|
||||
}
|
||||
|
||||
inline void ProcessSample(float4 ao, float z, float r, float d0, inout half4 totalAO, inout float totalW) {
|
||||
float w = CrossBilateralWeight(r, d0, z);
|
||||
totalW += w;
|
||||
totalAO += w * ao;
|
||||
}
|
||||
|
||||
inline void ProcessRadius(float2 uv0, float2 deltaUV, float d0, inout half4 totalAO, inout float totalW) {
|
||||
half4 ao;
|
||||
float z;
|
||||
float2 uv;
|
||||
UNITY_UNROLL
|
||||
for (int r = 1; r <= KERNEL_RADIUS; r++) {
|
||||
uv = uv0 + r * deltaUV;
|
||||
FetchAoAndDepth(uv, ao, z);
|
||||
ProcessSample(ao, z, r, d0, totalAO, totalW);
|
||||
}
|
||||
}
|
||||
|
||||
inline half4 ComputeBlur(float2 uv0, float2 deltaUV) {
|
||||
half4 totalAO;
|
||||
float depth;
|
||||
FetchAoAndDepth(uv0, totalAO, depth);
|
||||
float totalW = 1.0;
|
||||
|
||||
ProcessRadius(uv0, -deltaUV, depth, totalAO, totalW);
|
||||
ProcessRadius(uv0, deltaUV, depth, totalAO, totalW);
|
||||
|
||||
totalAO /= totalW;
|
||||
return totalAO;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
inline void FetchAoAndDepth(float2 uv, inout half ao, inout float2 depth) {
|
||||
float3 aod = SAMPLE_TEXTURE2D_X_LOD(_MainTex, sampler_PointClamp, uv, 0).rga;
|
||||
ao = aod.z;
|
||||
depth = aod.xy;
|
||||
}
|
||||
|
||||
inline float CrossBilateralWeight(float r, float d, float d0) {
|
||||
const float BlurSigma = (float)KERNEL_RADIUS * 0.5;
|
||||
const float BlurFalloff = 1.0 / (2.0*BlurSigma*BlurSigma);
|
||||
|
||||
float dz = (d0 - d) * _ProjectionParams.z * _BlurSharpness;
|
||||
return exp2(-r*r*BlurFalloff - dz*dz);
|
||||
}
|
||||
|
||||
inline void ProcessSample(float2 aoz, float r, float d0, inout half totalAO, inout float totalW) {
|
||||
float w = CrossBilateralWeight(r, d0, aoz.y);
|
||||
totalW += w;
|
||||
totalAO += w * aoz.x;
|
||||
}
|
||||
|
||||
inline void ProcessRadius(float2 uv0, float2 deltaUV, float d0, inout half totalAO, inout float totalW) {
|
||||
half ao;
|
||||
float z;
|
||||
float2 d, uv;
|
||||
UNITY_UNROLL
|
||||
for (int r = 1; r <= KERNEL_RADIUS; r++) {
|
||||
uv = uv0 + r * deltaUV;
|
||||
FetchAoAndDepth(uv, ao, d);
|
||||
z = DecodeFloatRG(d);
|
||||
ProcessSample(float2(ao, z), r, d0, totalAO, totalW);
|
||||
}
|
||||
}
|
||||
|
||||
inline float4 ComputeBlur(float2 uv0, float2 deltaUV) {
|
||||
half totalAO;
|
||||
float2 depth;
|
||||
FetchAoAndDepth(uv0, totalAO, depth);
|
||||
float d0 = DecodeFloatRG(depth);
|
||||
float totalW = 1.0;
|
||||
|
||||
ProcessRadius(uv0, -deltaUV, d0, totalAO, totalW);
|
||||
ProcessRadius(uv0, deltaUV, d0, totalAO, totalW);
|
||||
|
||||
totalAO /= totalW;
|
||||
return float4(depth, 1.0, totalAO);
|
||||
}
|
||||
#endif // COLOR_BLEEDING
|
||||
|
||||
float4 Blur_Frag(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(input.uv);
|
||||
|
||||
return ComputeBlur(uv, _BlurDeltaUV);
|
||||
}
|
||||
|
||||
#endif // HBAO_BLUR_INCLUDED
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Blur.hlsl.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Blur.hlsl.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88f16f7670609254aa357e3d46e3dffe
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
91
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Common.hlsl
vendored
Normal file
91
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Common.hlsl
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
#ifndef HBAO_COMMON_INCLUDED
|
||||
#define HBAO_COMMON_INCLUDED
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
|
||||
#if VERSION_GREATER_EQUAL(10, 0)
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl"
|
||||
#endif
|
||||
|
||||
inline float FetchRawDepth(float2 uv) {
|
||||
return SampleSceneDepth(uv * _TargetScale.xy);
|
||||
}
|
||||
|
||||
inline float LinearizeDepth(float depth) {
|
||||
// References: https://docs.unity3d.com/Manual/SL-PlatformDifferences.html
|
||||
#if ORTHOGRAPHIC_PROJECTION
|
||||
#if UNITY_REVERSED_Z
|
||||
depth = 1 - depth;
|
||||
#endif // UNITY_REVERSED_Z
|
||||
float linearDepth = _ProjectionParams.y + depth * (_ProjectionParams.z - _ProjectionParams.y); // near + depth * (far - near)
|
||||
#else
|
||||
float linearDepth = LinearEyeDepth(depth, _ZBufferParams);
|
||||
#endif // ORTHOGRAPHIC_PROJECTION
|
||||
return linearDepth;
|
||||
}
|
||||
|
||||
inline float3 FetchViewPos(float2 uv) {
|
||||
float depth = LinearizeDepth(FetchRawDepth(uv));
|
||||
#if ORTHOGRAPHIC_PROJECTION
|
||||
return float3((uv * _UVToView.xy + _UVToView.zw), depth);
|
||||
#else
|
||||
return float3((uv * _UVToView.xy + _UVToView.zw) * depth, depth);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline float3 MinDiff(float3 P, float3 Pr, float3 Pl) {
|
||||
float3 V1 = Pr - P;
|
||||
float3 V2 = P - Pl;
|
||||
return (dot(V1, V1) < dot(V2, V2)) ? V1 : V2;
|
||||
}
|
||||
|
||||
inline float3 FetchViewNormals(float2 uv, float2 delta, float3 P) {
|
||||
#if NORMALS_RECONSTRUCT4
|
||||
float3 Pr, Pl, Pt, Pb;
|
||||
Pr = FetchViewPos(uv + float2(delta.x, 0));
|
||||
Pl = FetchViewPos(uv + float2(-delta.x, 0));
|
||||
Pt = FetchViewPos(uv + float2(0, delta.y));
|
||||
Pb = FetchViewPos(uv + float2(0, -delta.y));
|
||||
float3 N = normalize(cross(MinDiff(P, Pr, Pl), MinDiff(P, Pt, Pb)));
|
||||
#elif NORMALS_RECONSTRUCT2
|
||||
float3 Pr, Pt;
|
||||
Pr = FetchViewPos(uv + float2(delta.x, 0));
|
||||
Pt = FetchViewPos(uv + float2(0, delta.y));
|
||||
float3 N = normalize(cross(Pt - P, P - Pr));
|
||||
#else
|
||||
#if VERSION_GREATER_EQUAL(10, 0)
|
||||
float3 N = SampleSceneNormals(uv * _TargetScale.xy);
|
||||
#if VERSION_GREATER_EQUAL(12, 0)
|
||||
N = mul((float3x3)_WorldToCameraMatrix, N); // normals are worldspace, convert to viewspace
|
||||
N = float3(N.x, -N.yz);
|
||||
#else
|
||||
N = float3(N.x, -N.y, N.z);
|
||||
#endif
|
||||
#else
|
||||
float3 N = float3(0, 0, 0);
|
||||
#endif
|
||||
#endif
|
||||
return N;
|
||||
}
|
||||
|
||||
inline float3 FetchViewNormals(float2 uv, float2 delta) {
|
||||
|
||||
float3 P = FetchViewPos(uv);
|
||||
return FetchViewNormals(uv, delta, P);
|
||||
}
|
||||
|
||||
// https://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
|
||||
|
||||
inline float2 EncodeFloatRG(float v) {
|
||||
float2 enc = float2(1.0, 255.0) * v;
|
||||
enc = frac(enc);
|
||||
enc.x -= enc.y * (1.0 / 255.0);
|
||||
return enc;
|
||||
}
|
||||
|
||||
inline float DecodeFloatRG(float2 rg) {
|
||||
return dot(rg, float2(1.0, 1 / 255.0));
|
||||
}
|
||||
|
||||
#endif // HBAO_COMMON_INCLUDED
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Common.hlsl.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Common.hlsl.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9db0967d4ddb8d4da2fc53a15906f15
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
86
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Composite.hlsl
vendored
Normal file
86
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Composite.hlsl
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
#ifndef HBAO_COMPOSITE_INCLUDED
|
||||
#define HBAO_COMPOSITE_INCLUDED
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "HBAO_Common.hlsl"
|
||||
|
||||
inline half4 FetchOcclusion(float2 uv) {
|
||||
uv *= _HistoryBuffer_RTHandleScale.xy;
|
||||
return SAMPLE_TEXTURE2D_X(_HBAOTex, sampler_PointClamp, uv * _TargetScale.zw);
|
||||
}
|
||||
|
||||
inline half4 FetchSceneColor(float2 uv) {
|
||||
//return LOAD_TEXTURE2D_X(_MainTex, positionSS); // load not supported on GLES2
|
||||
return SAMPLE_TEXTURE2D_X(_MainTex, sampler_PointClamp, uv);
|
||||
}
|
||||
|
||||
inline half3 MultiBounceAO(float visibility, half3 albedo) {
|
||||
half3 a = 2.0404 * albedo - 0.3324;
|
||||
half3 b = -4.7951 * albedo + 0.6417;
|
||||
half3 c = 2.7552 * albedo + 0.6903;
|
||||
|
||||
float x = visibility;
|
||||
return max(x, ((x * a + b) * x + c) * x);
|
||||
}
|
||||
|
||||
float4 Composite_Frag(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
//uint2 positionSS = input.uv * _ScreenSize.xy;
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(input.uv);
|
||||
|
||||
half4 ao = FetchOcclusion(uv);
|
||||
half4 col = FetchSceneColor(uv);
|
||||
|
||||
// AO 강도 조절
|
||||
ao.a = saturate(pow(abs(ao.a), _Intensity));
|
||||
|
||||
#if LIT_AO
|
||||
half3 aoColor = ao.aaa;
|
||||
col = ao.aaaa;
|
||||
#else
|
||||
// AO 색상 계산
|
||||
half3 aoColor = lerp(_BaseColor.rgb, half3(1.0, 1.0, 1.0), ao.a);
|
||||
|
||||
#if MULTIBOUNCE
|
||||
aoColor = lerp(aoColor, MultiBounceAO(ao.a, lerp(col.rgb, _BaseColor.rgb, _BaseColor.rgb)), _MultiBounceInfluence);
|
||||
#endif
|
||||
|
||||
// 최종 색상 계산 - 직접적인 블렌딩
|
||||
half3 finalColor = col.rgb * aoColor;
|
||||
|
||||
// 원본 색상과 AO를 자연스럽게 혼합
|
||||
col.rgb = lerp(finalColor, col.rgb, 0.3);
|
||||
|
||||
#if COLOR_BLEEDING
|
||||
// 컬러 블리딩 효과
|
||||
half3 bleedColor = ao.rgb * col.rgb;
|
||||
col.rgb = lerp(col.rgb, bleedColor, 0.2);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if DEBUG_AO
|
||||
col.rgb = aoColor;
|
||||
#elif DEBUG_COLORBLEEDING && COLOR_BLEEDING
|
||||
col.rgb = ao.rgb;
|
||||
#elif DEBUG_NOAO_AO || DEBUG_AO_AOONLY || DEBUG_NOAO_AOONLY
|
||||
if (uv.x <= 0.4985) {
|
||||
#if DEBUG_NOAO_AO || DEBUG_NOAO_AOONLY
|
||||
col = FetchSceneColor(uv);
|
||||
#endif
|
||||
return col;
|
||||
}
|
||||
if (uv.x > 0.4985 && uv.x < 0.5015) {
|
||||
return half4(0, 0, 0, 1);
|
||||
}
|
||||
#if DEBUG_AO_AOONLY || DEBUG_NOAO_AOONLY
|
||||
col.rgb = aoColor;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
#endif // HBAO_COMPOSITE_INCLUDED
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Composite.hlsl.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Composite.hlsl.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5724686e7ad5fff4cb8cc1ad5529cd06
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
70
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Deinterleaving.hlsl
vendored
Normal file
70
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_Deinterleaving.hlsl
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
#ifndef HBAO_DEINTERLEAVING_INCLUDED
|
||||
#define HBAO_DEINTERLEAVING_INCLUDED
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "HBAO_Common.hlsl"
|
||||
|
||||
struct DeinterleavedOutput {
|
||||
float4 Z00 : SV_Target0;
|
||||
float4 Z10 : SV_Target1;
|
||||
float4 Z01 : SV_Target2;
|
||||
float4 Z11 : SV_Target3;
|
||||
};
|
||||
|
||||
DeinterleavedOutput DeinterleaveDepth_Frag(Varyings input)
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
DeinterleavedOutput o;
|
||||
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(input.uv);
|
||||
|
||||
float2 pos = floor(uv * _DeinterleavedAO_TexelSize.zw) * 4.0;
|
||||
float2 uv00 = (pos + _Deinterleave_Offset00 + 0.5) * _ReinterleavedAO_TexelSize.xy;
|
||||
float2 uv10 = (pos + _Deinterleave_Offset10 + 0.5) * _ReinterleavedAO_TexelSize.xy;
|
||||
float2 uv01 = (pos + _Deinterleave_Offset01 + 0.5) * _ReinterleavedAO_TexelSize.xy;
|
||||
float2 uv11 = (pos + _Deinterleave_Offset11 + 0.5) * _ReinterleavedAO_TexelSize.xy;
|
||||
|
||||
o.Z00 = FetchRawDepth(uv00).rrrr;
|
||||
o.Z10 = FetchRawDepth(uv10).rrrr;
|
||||
o.Z01 = FetchRawDepth(uv01).rrrr;
|
||||
o.Z11 = FetchRawDepth(uv11).rrrr;
|
||||
return o;
|
||||
}
|
||||
|
||||
DeinterleavedOutput DeinterleaveNormals_Frag(Varyings input)
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
DeinterleavedOutput o;
|
||||
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(input.uv);
|
||||
|
||||
float2 pos = floor(uv * _DeinterleavedAO_TexelSize.zw) * 4.0;
|
||||
float2 uv00 = (pos + _Deinterleave_Offset00 + 0.5) * _ReinterleavedAO_TexelSize.xy;
|
||||
float2 uv10 = (pos + _Deinterleave_Offset10 + 0.5) * _ReinterleavedAO_TexelSize.xy;
|
||||
float2 uv01 = (pos + _Deinterleave_Offset01 + 0.5) * _ReinterleavedAO_TexelSize.xy;
|
||||
float2 uv11 = (pos + _Deinterleave_Offset11 + 0.5) * _ReinterleavedAO_TexelSize.xy;
|
||||
|
||||
o.Z00 = float4(FetchViewNormals(uv00, _ReinterleavedAO_TexelSize.xy) * 0.5 + 0.5, 0);
|
||||
o.Z10 = float4(FetchViewNormals(uv10, _ReinterleavedAO_TexelSize.xy) * 0.5 + 0.5, 0);
|
||||
o.Z01 = float4(FetchViewNormals(uv01, _ReinterleavedAO_TexelSize.xy) * 0.5 + 0.5, 0);
|
||||
o.Z11 = float4(FetchViewNormals(uv11, _ReinterleavedAO_TexelSize.xy) * 0.5 + 0.5, 0);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 ReinterleaveAO_Frag(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(input.uv);
|
||||
|
||||
float2 offset = fmod(floor(uv * _ReinterleavedAO_TexelSize.zw), 4.0);
|
||||
uv = (floor(uv * _DeinterleavedAO_TexelSize.zw) + (offset * _DeinterleavedAO_TexelSize.zw) + 0.5) * _ReinterleavedAO_TexelSize.xy;
|
||||
|
||||
return SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv);
|
||||
}
|
||||
|
||||
#endif // HBAO_DEINTERLEAVING_INCLUDED
|
||||
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 713016b17f006794a883de31a276c28e
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
175
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_TemporalFilter.hlsl
vendored
Normal file
175
Assets/External/Horizon Based Ambient Occlusion/SRP 1/URP/Shaders/HBAO_TemporalFilter.hlsl
vendored
Normal file
@ -0,0 +1,175 @@
|
||||
#ifndef HBAO_TEMPORALFILTER_INCLUDED
|
||||
#define HBAO_TEMPORALFILTER_INCLUDED
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "HBAO_Common.hlsl"
|
||||
|
||||
struct HistoryOutput {
|
||||
float4 aoHistory : SV_Target0;
|
||||
#if COLOR_BLEEDING
|
||||
half4 colorBleedingHistory : SV_Target1;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if COLOR_BLEEDING
|
||||
#define CTYPE half4
|
||||
#else
|
||||
#define CTYPE half
|
||||
#endif
|
||||
|
||||
inline void FetchAoAndDepth(float2 uv, inout CTYPE ao, inout float2 depth) {
|
||||
#if COLOR_BLEEDING
|
||||
ao = SAMPLE_TEXTURE2D_X(_HBAOTex, sampler_PointClamp, uv);
|
||||
depth = EncodeFloatRG(saturate(LinearizeDepth(FetchRawDepth(uv)) * (1.0 / _ProjectionParams.z)));
|
||||
#else
|
||||
float3 aod = SAMPLE_TEXTURE2D_X(_HBAOTex, sampler_PointClamp, uv).rga;
|
||||
ao = aod.z;
|
||||
depth = aod.xy;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline float2 FetchMotionVectors(float2 uv) {
|
||||
return SAMPLE_TEXTURE2D_X(_MotionVectorTexture, sampler_PointClamp, uv * _TargetScale.xy).rg;
|
||||
}
|
||||
|
||||
inline float4 FetchAoHistory(float2 uv) {
|
||||
return SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv * _HistoryBuffer_RTHandleScale.zw);
|
||||
}
|
||||
|
||||
inline half4 FetchColorBleedingHistory(float2 uv) {
|
||||
return SAMPLE_TEXTURE2D_X(_TempTex, sampler_LinearClamp, uv * _HistoryBuffer_RTHandleScale.zw);
|
||||
}
|
||||
|
||||
inline CTYPE FetchNeighbor(float2 uv, float2 offset) {
|
||||
#if COLOR_BLEEDING
|
||||
return SAMPLE_TEXTURE2D_X(_HBAOTex, sampler_PointClamp, uv + _AO_TexelSize.xy * offset);
|
||||
#else
|
||||
return SAMPLE_TEXTURE2D_X(_HBAOTex, sampler_PointClamp, uv + _AO_TexelSize.xy * offset).a;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline half DisocclusionTest(float2 uvm1, float2 depth, float2 depthm1) {
|
||||
|
||||
// disocclusion test
|
||||
// https://developer.nvidia.com/sites/default/files/akamai/gamedev/files/gdc12/GDC12_Bavoil_Stable_SSAO_In_BF3_With_STF.pdf (Page 19)
|
||||
float z = DecodeFloatRG(depth);
|
||||
float zm1 = DecodeFloatRG(depthm1);
|
||||
// for fetching zi-1, use clamp-to-border to discard out-of-frame data, with borderZ = 0.f
|
||||
// https://developer.nvidia.com/sites/default/files/akamai/gamedev/files/gdc12/GDC12_Bavoil_Stable_SSAO_In_BF3_With_STF.pdf (Page 39)
|
||||
// if (uvm1.x < 0 || uvm1.y < 0 || uvm1.x > 1 || uvm1.y > 1) zm1 = 0;
|
||||
// if (uvm1.x < 0 || uvm1.y < 0 || uvm1.x > 1 || uvm1.y > 1) => dot(step(half4(uvm1, 1, 1), half4(0, 0, uvm1)), 1) is 1 if out-of-frame, so
|
||||
zm1 *= 1.0 - dot(step(float4(uvm1, 1, 1), float4(0, 0, uvm1)), 1);
|
||||
// relaxed disocclusion test: abs(1.0 - (z / zm1)) > 0.1 => 10%
|
||||
// float disocclusion = max(sign(abs(1.0 - (z / zm1)) - 0.1), 0.0);
|
||||
float disocclusion = abs(1.0 - (z / zm1)) > 0.1;
|
||||
|
||||
return disocclusion;
|
||||
}
|
||||
|
||||
inline CTYPE VarianceClipping(float2 uv, CTYPE ao, CTYPE aom1, float velocityWeight) {
|
||||
|
||||
// neighborhood clamping
|
||||
// http://twvideo01.ubm-us.net/o1/vault/gdc2016/Presentations/Pedersen_LasseJonFuglsang_TemporalReprojectionAntiAliasing.pdf // (pages 26-28)
|
||||
// superseded by variance clipping
|
||||
// http://developer.download.nvidia.com/gameworks/events/GDC2016/msalvi_temporal_supersampling.pdf (page 23-29)
|
||||
#if VARIANCE_CLIPPING_4TAP
|
||||
CTYPE cT = FetchNeighbor(uv, float2(0, 1));
|
||||
CTYPE cR = FetchNeighbor(uv, float2(1, 0));
|
||||
CTYPE cB = FetchNeighbor(uv, float2(0, -1));
|
||||
CTYPE cL = FetchNeighbor(uv, float2(-1, 0));
|
||||
// compute 1st and 2nd color moments
|
||||
CTYPE m1 = ao + cT + cR + cB + cL;
|
||||
CTYPE m2 = ao * ao + cT * cT + cR * cR + cB * cB + cL * cL;
|
||||
// aabb from mean u and variance sigma2
|
||||
CTYPE mu = m1 / 5.0;
|
||||
CTYPE sigma = sqrt(m2 / 5.0 - mu * mu);
|
||||
|
||||
#elif VARIANCE_CLIPPING_8TAP
|
||||
CTYPE cTL = FetchNeighbor(uv, float2(-1, 1));
|
||||
CTYPE cT = FetchNeighbor(uv, float2(0, 1));
|
||||
CTYPE cTR = FetchNeighbor(uv, float2(1, 1));
|
||||
CTYPE cR = FetchNeighbor(uv, float2(1, 0));
|
||||
CTYPE cBR = FetchNeighbor(uv, float2(1, -1));
|
||||
CTYPE cB = FetchNeighbor(uv, float2(0, -1));
|
||||
CTYPE cBL = FetchNeighbor(uv, float2(-1, -1));
|
||||
CTYPE cL = FetchNeighbor(uv, float2(-1, 0));
|
||||
// compute 1st and 2nd color moments
|
||||
CTYPE m1 = ao + cTL + cT + cTR + cR + cBR + cB + cBL + cL;
|
||||
CTYPE m2 = ao * ao + cTL * cTL + cT * cT + cTR * cTR + cR * cR + cBR * cBR + cB * cB + cBL * cBL + cL * cL;
|
||||
// aabb from mean u and variance sigma2
|
||||
CTYPE mu = m1 / 9.0;
|
||||
CTYPE sigma = sqrt(m2 / 9.0 - mu * mu);
|
||||
#endif
|
||||
|
||||
#if VARIANCE_CLIPPING_4TAP || VARIANCE_CLIPPING_8TAP
|
||||
float gamma = lerp(75.0, 0.75, velocityWeight); // scale down sigma for reduced ghosting
|
||||
CTYPE cmin = mu - gamma * sigma;
|
||||
CTYPE cmax = mu + gamma * sigma;
|
||||
|
||||
// clipping
|
||||
return clamp(aom1, cmin, cmax);
|
||||
#else
|
||||
return aom1;
|
||||
#endif
|
||||
}
|
||||
|
||||
HistoryOutput TemporalFilter_Frag(Varyings input)
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(input.uv);
|
||||
|
||||
// fetch current frame data
|
||||
CTYPE ao; float2 depth;
|
||||
FetchAoAndDepth(uv, ao, depth);
|
||||
|
||||
// fetch motion vectors, calculate previous frame uv
|
||||
float2 mv = FetchMotionVectors(uv);
|
||||
float2 uvm1 = uv - mv.xy;
|
||||
float mvl = length(mv);
|
||||
|
||||
// fetch history
|
||||
float4 aoHistory = FetchAoHistory(uvm1);
|
||||
#if COLOR_BLEEDING
|
||||
half4 colorBleedingHistory = FetchColorBleedingHistory(uvm1);
|
||||
CTYPE aom1 = colorBleedingHistory;
|
||||
#else
|
||||
CTYPE aom1 = aoHistory.w;
|
||||
#endif
|
||||
float2 depthm1 = aoHistory.xy;
|
||||
float mvlm1 = aoHistory.z;
|
||||
|
||||
// velocity weight
|
||||
float velocityWeight = saturate(abs(mvl - mvlm1) * 300.0);
|
||||
|
||||
// do disocclusion test
|
||||
half disocclusion = DisocclusionTest(uvm1, depth, depthm1);
|
||||
|
||||
// apply velocity weight and disocclusion
|
||||
#if COLOR_BLEEDING
|
||||
aom1.a = aom1.a + saturate(dot(float2(velocityWeight, disocclusion), 1.0)) * (ao.a - aom1.a);
|
||||
#else
|
||||
aom1 = aom1 + saturate(dot(float2(velocityWeight, disocclusion), 1.0)) * (ao - aom1);
|
||||
#endif
|
||||
|
||||
// do variance clipping
|
||||
aom1 = VarianceClipping(uv, ao, aom1, velocityWeight);
|
||||
|
||||
// exponential accumulation buffer
|
||||
// http://www.klayge.org/material/4_11/Filmic%20SMAA%20v7.pdf (page 54)
|
||||
// http://developer.download.nvidia.com/gameworks/events/GDC2016/msalvi_temporal_supersampling.pdf (page 13)
|
||||
ao = aom1 + 0.1 * (ao - aom1);
|
||||
|
||||
HistoryOutput o;
|
||||
#if COLOR_BLEEDING
|
||||
o.aoHistory = float4(depth, mvl, ao.a);
|
||||
o.colorBleedingHistory = ao;
|
||||
#else
|
||||
o.aoHistory = float4(depth, mvl, ao);
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
#endif // HBAO_TEMPORALFILTER_INCLUDED
|
||||
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbf71e1c97b8d654da3f7646050e713e
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/SRP.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/SRP.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b9eaca9eab5e52347a811cead6015f6f
|
||||
folderAsset: yes
|
||||
timeCreated: 1582907081
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/External/Horizon Based Ambient Occlusion/SRP/Readme.txt
(Stored with Git LFS)
vendored
Normal file
BIN
Assets/External/Horizon Based Ambient Occlusion/SRP/Readme.txt
(Stored with Git LFS)
vendored
Normal file
Binary file not shown.
8
Assets/External/Horizon Based Ambient Occlusion/SRP/Readme.txt.meta
vendored
Normal file
8
Assets/External/Horizon Based Ambient Occlusion/SRP/Readme.txt.meta
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15a5b7bce341d6a4189869b3d1c95ca1
|
||||
timeCreated: 1582907133
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/Shaders.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/Shaders.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4a5705f6447808468fca071356bd185
|
||||
folderAsset: yes
|
||||
timeCreated: 1455959813
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
429
Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO.shader
vendored
Normal file
429
Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO.shader
vendored
Normal file
@ -0,0 +1,429 @@
|
||||
Shader "Hidden/HBAO"
|
||||
{
|
||||
Properties {
|
||||
_MainTex ("", any) = "" {}
|
||||
_HBAOTex ("", any) = "" {}
|
||||
_TempTex("", any) = "" {}
|
||||
_NoiseTex("", 2D) = "" {}
|
||||
_DepthTex("", any) = "" {}
|
||||
_NormalsTex("", any) = "" {}
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
|
||||
#pragma target 3.0
|
||||
#pragma editor_sync_compilation
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_MainTex);
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_HBAOTex);
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_TempTex);
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraDepthNormalsTexture);
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraGBufferTexture0); // diffuse color (RGB), occlusion (A)
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraGBufferTexture2); // normal (rgb), --unused-- (a)
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_CameraMotionVectorsTexture);
|
||||
UNITY_DECLARE_SCREENSPACE_TEXTURE(_NormalsTex);
|
||||
UNITY_DECLARE_TEX2D(_NoiseTex);
|
||||
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture);
|
||||
UNITY_DECLARE_DEPTH_TEXTURE(_DepthTex);
|
||||
|
||||
CBUFFER_START(FrequentlyUpdatedUniforms)
|
||||
float4 _Input_TexelSize;
|
||||
float4 _AO_TexelSize;
|
||||
float4 _DeinterleavedAO_TexelSize;
|
||||
float4 _ReinterleavedAO_TexelSize;
|
||||
float4 _TargetScale;
|
||||
float4 _UVToView;
|
||||
float4x4 _WorldToCameraMatrix;
|
||||
float _Radius;
|
||||
float _MaxRadiusPixels;
|
||||
float _NegInvRadius2;
|
||||
float _AngleBias;
|
||||
float _AOmultiplier;
|
||||
float _Intensity;
|
||||
half4 _BaseColor;
|
||||
float _MultiBounceInfluence;
|
||||
float _OffscreenSamplesContrib;
|
||||
float _MaxDistance;
|
||||
float _DistanceFalloff;
|
||||
float _BlurSharpness;
|
||||
float _ColorBleedSaturation;
|
||||
float _AlbedoMultiplier;
|
||||
float _ColorBleedBrightnessMask;
|
||||
float2 _ColorBleedBrightnessMaskRange;
|
||||
float2 _TemporalParams;
|
||||
CBUFFER_END
|
||||
|
||||
CBUFFER_START(PerPassUpdatedUniforms)
|
||||
float4 _UVTransform;
|
||||
float2 _BlurDeltaUV;
|
||||
CBUFFER_END
|
||||
|
||||
CBUFFER_START(PerPassUpdatedDeinterleavingUniforms)
|
||||
float2 _Deinterleave_Offset00;
|
||||
float2 _Deinterleave_Offset10;
|
||||
float2 _Deinterleave_Offset01;
|
||||
float2 _Deinterleave_Offset11;
|
||||
float2 _AtlasOffset;
|
||||
float2 _Jitter;
|
||||
CBUFFER_END
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float3 vertex : POSITION;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
//float2 uvStereo : TEXCOORD1;
|
||||
//#if STEREO_INSTANCING_ENABLED
|
||||
//uint stereoTargetEyeIndex : SV_RenderTargetArrayIndex;
|
||||
//#endif
|
||||
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
float2 TransformTriangleVertexToUV(float2 vertex)
|
||||
{
|
||||
float2 uv = (vertex + 1.0) * 0.5;
|
||||
return uv;
|
||||
}
|
||||
|
||||
Varyings Vert_Default(Attributes input)
|
||||
{
|
||||
Varyings o;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_OUTPUT(Varyings, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
o.vertex = float4(input.vertex.xy, 0.0, 1.0);
|
||||
o.uv = TransformTriangleVertexToUV(input.vertex.xy);
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
o.uv = o.uv * float2(1.0, -1.0) + float2(0.0, 1.0);
|
||||
#endif
|
||||
|
||||
//o.uvStereo = TransformStereoScreenSpaceTex(o.uv, 1.0);
|
||||
o.uv = TransformStereoScreenSpaceTex(o.uv, 1.0);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
Varyings Vert_Atlas(Attributes input)
|
||||
{
|
||||
Varyings o;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_OUTPUT(Varyings, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
o.vertex = float4((input.vertex.xy + float2(-3.0, 1.0)) * (_DeinterleavedAO_TexelSize.zw / _ReinterleavedAO_TexelSize.zw) + 2.0 * _AtlasOffset * _ReinterleavedAO_TexelSize.xy, 0.0, 1.0);
|
||||
o.uv = TransformTriangleVertexToUV(input.vertex.xy);
|
||||
|
||||
// flip triangle upside down
|
||||
o.vertex.y = 1 - o.vertex.y;
|
||||
|
||||
//o.uvStereo = TransformStereoScreenSpaceTex(o.uv, 1.0);
|
||||
o.uv = TransformStereoScreenSpaceTex(o.uv, 1.0);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
Varyings Vert_UVTransform(Attributes input)
|
||||
{
|
||||
Varyings o;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_OUTPUT(Varyings, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
o.vertex = float4(input.vertex.xy, 0.0, 1.0);
|
||||
o.uv = TransformTriangleVertexToUV(input.vertex.xy) * _UVTransform.xy + _UVTransform.zw;
|
||||
|
||||
//o.uvStereo = TransformStereoScreenSpaceTex(o.uv, 1.0);
|
||||
o.uv = TransformStereoScreenSpaceTex(o.uv, 1.0);
|
||||
|
||||
//#if STEREO_INSTANCING_ENABLED
|
||||
//o.stereoTargetEyeIndex = (uint)_DepthSlice;
|
||||
//#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
|
||||
SubShader {
|
||||
LOD 100
|
||||
ZTest Always Cull Off ZWrite Off
|
||||
|
||||
// 0
|
||||
Pass {
|
||||
Name "HBAO - AO"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma multi_compile_local __ DEFERRED_SHADING ORTHOGRAPHIC_PROJECTION
|
||||
#pragma multi_compile_local __ COLOR_BLEEDING
|
||||
#pragma multi_compile_local __ OFFSCREEN_SAMPLES_CONTRIBUTION
|
||||
#pragma multi_compile_local __ NORMALS_CAMERA NORMALS_RECONSTRUCT
|
||||
#pragma multi_compile_local __ INTERLEAVED_GRADIENT_NOISE
|
||||
#pragma multi_compile_local QUALITY_LOWEST QUALITY_LOW QUALITY_MEDIUM QUALITY_HIGH QUALITY_HIGHEST
|
||||
|
||||
#if QUALITY_LOWEST
|
||||
#define DIRECTIONS 3
|
||||
#define STEPS 2
|
||||
#elif QUALITY_LOW
|
||||
#define DIRECTIONS 4
|
||||
#define STEPS 3
|
||||
#elif QUALITY_MEDIUM
|
||||
#define DIRECTIONS 6
|
||||
#define STEPS 4
|
||||
#elif QUALITY_HIGH
|
||||
#define DIRECTIONS 8
|
||||
#define STEPS 4
|
||||
#elif QUALITY_HIGHEST
|
||||
#define DIRECTIONS 8
|
||||
#define STEPS 6
|
||||
#else
|
||||
#define DIRECTIONS 1
|
||||
#define STEPS 1
|
||||
#endif
|
||||
|
||||
#pragma vertex Vert_Default
|
||||
#pragma fragment AO_Frag
|
||||
|
||||
#include "HBAO_AO.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 1
|
||||
Pass {
|
||||
Name "HBAO - AO Deinterleaved"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma multi_compile_local __ DEFERRED_SHADING ORTHOGRAPHIC_PROJECTION
|
||||
#pragma multi_compile_local __ COLOR_BLEEDING
|
||||
#pragma multi_compile_local __ OFFSCREEN_SAMPLES_CONTRIBUTION
|
||||
#pragma multi_compile_local QUALITY_LOWEST QUALITY_LOW QUALITY_MEDIUM QUALITY_HIGH QUALITY_HIGHEST
|
||||
|
||||
#if QUALITY_LOWEST
|
||||
#define DIRECTIONS 3
|
||||
#define STEPS 2
|
||||
#elif QUALITY_LOW
|
||||
#define DIRECTIONS 4
|
||||
#define STEPS 3
|
||||
#elif QUALITY_MEDIUM
|
||||
#define DIRECTIONS 6
|
||||
#define STEPS 4
|
||||
#elif QUALITY_HIGH
|
||||
#define DIRECTIONS 8
|
||||
#define STEPS 4
|
||||
#elif QUALITY_HIGHEST
|
||||
#define DIRECTIONS 8
|
||||
#define STEPS 6
|
||||
#else
|
||||
#define DIRECTIONS 1
|
||||
#define STEPS 1
|
||||
#endif
|
||||
|
||||
#define DEINTERLEAVED
|
||||
|
||||
#pragma vertex Vert_Default
|
||||
#pragma fragment AO_Frag
|
||||
|
||||
#include "HBAO_AO.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 2
|
||||
Pass {
|
||||
Name "HBAO - Deinterleave Depth"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex Vert_Default
|
||||
#pragma fragment DeinterleaveDepth_Frag
|
||||
|
||||
#include "HBAO_Deinterleaving.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 3
|
||||
Pass {
|
||||
Name "HBAO - Deinterleave Normals"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION
|
||||
#pragma multi_compile_local __ NORMALS_CAMERA NORMALS_RECONSTRUCT
|
||||
|
||||
#pragma vertex Vert_Default
|
||||
#pragma fragment DeinterleaveNormals_Frag
|
||||
|
||||
#include "HBAO_Deinterleaving.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 4
|
||||
Pass {
|
||||
Name "HBAO - Atlas Deinterleaved AO"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex Vert_Atlas
|
||||
#pragma fragment Frag
|
||||
|
||||
half4 Frag(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, input.uv);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 5
|
||||
Pass {
|
||||
Name "HBAO - Reinterleave AO"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex Vert_UVTransform
|
||||
#pragma fragment ReinterleaveAO_Frag
|
||||
|
||||
#include "HBAO_Deinterleaving.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 6
|
||||
Pass {
|
||||
Name "HBAO - Blur"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION
|
||||
#pragma multi_compile_local __ COLOR_BLEEDING
|
||||
#pragma multi_compile_local BLUR_RADIUS_2 BLUR_RADIUS_3 BLUR_RADIUS_4 BLUR_RADIUS_5
|
||||
|
||||
#if BLUR_RADIUS_2
|
||||
#define KERNEL_RADIUS 2
|
||||
#elif BLUR_RADIUS_3
|
||||
#define KERNEL_RADIUS 3
|
||||
#elif BLUR_RADIUS_4
|
||||
#define KERNEL_RADIUS 4
|
||||
#elif BLUR_RADIUS_5
|
||||
#define KERNEL_RADIUS 5
|
||||
#endif
|
||||
|
||||
#pragma vertex Vert_Default
|
||||
#pragma fragment Blur_Frag
|
||||
|
||||
#include "HBAO_Blur.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 7
|
||||
Pass {
|
||||
Name "HBAO - Temporal Filter"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma multi_compile_local __ COLOR_BLEEDING
|
||||
#pragma multi_compile_local __ VARIANCE_CLIPPING_4TAP VARIANCE_CLIPPING_8TAP
|
||||
|
||||
#pragma vertex Vert_Default
|
||||
#pragma fragment TemporalFilter_Frag
|
||||
|
||||
#include "HBAO_TemporalFilter.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 8
|
||||
Pass {
|
||||
Name "HBAO - Copy"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex Vert_Default
|
||||
#pragma fragment Frag
|
||||
|
||||
half4 Frag(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
return UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, input.uv);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 9
|
||||
Pass {
|
||||
Name "HBAO - Composite"
|
||||
|
||||
ColorMask RGB
|
||||
|
||||
CGPROGRAM
|
||||
#pragma multi_compile_local __ COLOR_BLEEDING
|
||||
#pragma multi_compile_local __ MULTIBOUNCE
|
||||
#pragma multi_compile_local __ DEBUG_AO DEBUG_COLORBLEEDING DEBUG_NOAO_AO DEBUG_AO_AOONLY DEBUG_NOAO_AOONLY
|
||||
|
||||
#pragma vertex Vert_UVTransform
|
||||
#pragma fragment Composite_Frag
|
||||
|
||||
#include "HBAO_Composite.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 10
|
||||
Pass {
|
||||
Name "HBAO - Composite AfterLighting"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma multi_compile_local __ COLOR_BLEEDING
|
||||
#pragma multi_compile_local __ MULTIBOUNCE
|
||||
#pragma multi_compile_local __ LIGHTING_LOG_ENCODED
|
||||
|
||||
#pragma vertex Vert_Default
|
||||
#pragma fragment Composite_Frag
|
||||
|
||||
#include "HBAO_Composite.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 11
|
||||
Pass {
|
||||
Name "HBAO - Composite BeforeReflections"
|
||||
|
||||
CGPROGRAM
|
||||
#pragma multi_compile_local __ COLOR_BLEEDING
|
||||
#pragma multi_compile_local __ LIGHTING_LOG_ENCODED
|
||||
|
||||
#pragma vertex Vert_Default
|
||||
#pragma fragment Composite_Lit_Frag
|
||||
|
||||
#include "HBAO_Composite.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
// 12
|
||||
Pass {
|
||||
Name "HBAO - Debug ViewNormals"
|
||||
|
||||
ColorMask RGB
|
||||
|
||||
CGPROGRAM
|
||||
#pragma multi_compile_local __ ORTHOGRAPHIC_PROJECTION
|
||||
#pragma multi_compile_local __ NORMALS_CAMERA NORMALS_RECONSTRUCT
|
||||
|
||||
#pragma vertex Vert_UVTransform
|
||||
#pragma fragment AO_Frag
|
||||
|
||||
#define DIRECTIONS 1
|
||||
#define STEPS 1
|
||||
#define DEBUG_VIEWNORMALS
|
||||
#include "HBAO_AO.cginc"
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
FallBack off
|
||||
}
|
||||
9
Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO.shader.meta
vendored
Normal file
9
Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO.shader.meta
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b834eafaedd0d842bb05a969d9d14bd
|
||||
timeCreated: 1453645791
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
203
Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_AO.cginc
vendored
Normal file
203
Assets/External/Horizon Based Ambient Occlusion/Shaders/HBAO_AO.cginc
vendored
Normal file
@ -0,0 +1,203 @@
|
||||
//----------------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
#ifndef HBAO_AO_INCLUDED
|
||||
#define HBAO_AO_INCLUDED
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "HBAO_Common.cginc"
|
||||
|
||||
inline float3 FetchLayerViewPos(float2 uv) {
|
||||
float depth = LinearizeDepth(SAMPLE_DEPTH_TEXTURE(_DepthTex, uv));
|
||||
#if ORTHOGRAPHIC_PROJECTION
|
||||
return float3((uv * _UVToView.xy + _UVToView.zw), depth);
|
||||
#else
|
||||
return float3((uv * _UVToView.xy + _UVToView.zw) * depth, depth);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline float Falloff(float distanceSquare) {
|
||||
// 1 scalar mad instruction
|
||||
return distanceSquare * _NegInvRadius2 + 1.0;
|
||||
}
|
||||
|
||||
inline float ComputeAO(float3 P, float3 N, float3 S) {
|
||||
float3 V = S - P;
|
||||
float VdotV = dot(V, V);
|
||||
float NdotV = dot(N, V) * rsqrt(VdotV);
|
||||
|
||||
// Use saturate(x) instead of max(x,0.f) because that is faster on Kepler
|
||||
return saturate(NdotV - _AngleBias) * saturate(Falloff(VdotV));
|
||||
}
|
||||
|
||||
inline float2 RotateDirections(float2 dir, float2 rot) {
|
||||
return float2(dir.x * rot.x - dir.y * rot.y,
|
||||
dir.x * rot.y + dir.y * rot.x);
|
||||
}
|
||||
|
||||
inline float InterleavedGradientNoise(float2 screenPos) {
|
||||
// http://www.iryoku.com/downloads/Next-Generation-Post-Processing-in-Call-of-Duty-Advanced-Warfare-v18.pptx (slide 123)
|
||||
float3 magic = float3(0.06711056, 0.00583715, 52.9829189);
|
||||
return frac(magic.z * frac(dot(screenPos, magic.xy)));
|
||||
}
|
||||
|
||||
inline float2 FetchNoise(float2 screenPos) {
|
||||
#if INTERLEAVED_GRADIENT_NOISE
|
||||
// Use Jorge Jimenez's IGN noise and GTAO spatial offsets distribution
|
||||
// https://blog.selfshadow.com/publications/s2016-shading-course/activision/s2016_pbs_activision_occlusion.pdf (slide 93)
|
||||
return float2(InterleavedGradientNoise(screenPos), UNITY_SAMPLE_TEX2D(_NoiseTex, screenPos / 4.0).g);
|
||||
#else
|
||||
// (cos(alpha), sin(alpha), jitter)
|
||||
return UNITY_SAMPLE_TEX2D(_NoiseTex, screenPos / 4.0).rg;
|
||||
#endif
|
||||
}
|
||||
|
||||
float4 AO_Frag(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
#ifdef DEINTERLEAVED
|
||||
float3 P = FetchLayerViewPos(input.uv);
|
||||
#else
|
||||
float3 P = FetchViewPos(input.uv);
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_VIEWNORMALS
|
||||
clip(_MaxDistance - P.z);
|
||||
#endif
|
||||
|
||||
#if ORTHOGRAPHIC_PROJECTION
|
||||
float stepSize = min(_Radius, _MaxRadiusPixels) / (STEPS + 1.0);
|
||||
#else
|
||||
float stepSize = min((_Radius / P.z), _MaxRadiusPixels) / (STEPS + 1.0);
|
||||
#endif
|
||||
|
||||
#ifdef DEINTERLEAVED
|
||||
float3 N = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_NormalsTex, input.uv).rgb * 2.0 - 1.0;
|
||||
float2 rand = _Jitter; // angle, jitter
|
||||
#else
|
||||
float3 N = FetchViewNormals(input.uv, _AO_TexelSize.xy, P);
|
||||
float2 rand = FetchNoise(input.uv * _AO_TexelSize.zw); // angle, jitter
|
||||
#endif
|
||||
|
||||
const float alpha = 2.0 * UNITY_PI / DIRECTIONS;
|
||||
float ao = 0;
|
||||
|
||||
#if COLOR_BLEEDING
|
||||
static float2 cbUVs[DIRECTIONS * STEPS];
|
||||
static float cbContribs[DIRECTIONS * STEPS];
|
||||
#endif
|
||||
|
||||
UNITY_UNROLL
|
||||
for (int d = 0; d < DIRECTIONS; ++d) {
|
||||
float angle = alpha * (float(d) + rand.x + _TemporalParams.x);
|
||||
|
||||
// Compute normalized 2D direction
|
||||
float cosA, sinA;
|
||||
sincos(angle, sinA, cosA);
|
||||
float2 direction = float2(cosA, sinA);
|
||||
|
||||
// Jitter starting sample within the first step
|
||||
float rayPixels = (frac(rand.y + _TemporalParams.y) * stepSize + 1.0);
|
||||
|
||||
UNITY_UNROLL
|
||||
for (int s = 0; s < STEPS; ++s) {
|
||||
|
||||
#ifdef DEINTERLEAVED
|
||||
float2 snappedUV = round(rayPixels * direction) * _DeinterleavedAO_TexelSize.xy + input.uv;
|
||||
float3 S = FetchLayerViewPos(snappedUV);
|
||||
#else
|
||||
float2 snappedUV = round(rayPixels * direction) * _Input_TexelSize.xy + input.uv;
|
||||
float3 S = FetchViewPos(snappedUV);
|
||||
#endif
|
||||
rayPixels += stepSize;
|
||||
|
||||
float contrib = ComputeAO(P, N, S);
|
||||
|
||||
#if OFFSCREEN_SAMPLES_CONTRIBUTION
|
||||
float2 offscreenAmount = _OffscreenSamplesContrib * (snappedUV - saturate(snappedUV) != 0 ? 1 : 0);
|
||||
contrib = max(contrib, offscreenAmount.x);
|
||||
contrib = max(contrib, offscreenAmount.y);
|
||||
#endif
|
||||
ao += contrib;
|
||||
|
||||
#if COLOR_BLEEDING
|
||||
int sampleIdx = d * s;
|
||||
cbUVs[sampleIdx] = snappedUV;
|
||||
cbContribs[sampleIdx] = contrib;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_VIEWNORMALS
|
||||
N = float3(N.x, -N.y, N.z);
|
||||
return float4(N * 0.5 + 0.5, 1);
|
||||
#else
|
||||
|
||||
#if COLOR_BLEEDING
|
||||
half3 col = half3(0, 0, 0);
|
||||
UNITY_UNROLL
|
||||
for (int s = 0; s < DIRECTIONS * STEPS; s += 2) {
|
||||
half3 emission = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_MainTex, cbUVs[s]).rgb;
|
||||
half average = (emission.x + emission.y + emission.z) / 3;
|
||||
half scaledAverage = saturate((average - _ColorBleedBrightnessMaskRange.x) / (_ColorBleedBrightnessMaskRange.y - _ColorBleedBrightnessMaskRange.x + 1e-6));
|
||||
half maskMultiplier = 1 - (scaledAverage * _ColorBleedBrightnessMask);
|
||||
col += emission * cbContribs[s] * maskMultiplier;
|
||||
}
|
||||
#if DEFERRED_SHADING
|
||||
half3 albedo = UNITY_SAMPLE_SCREENSPACE_TEXTURE(_CameraGBufferTexture0, input.uv).rgb * 0.8 + 0.2;
|
||||
albedo *= _AlbedoMultiplier;
|
||||
#else
|
||||
half3 albedo = half3(1, 1, 1);
|
||||
#endif
|
||||
float4 aoOutput = float4(col, ao);
|
||||
#else
|
||||
float aoOutput = ao;
|
||||
#endif
|
||||
|
||||
// apply bias multiplier
|
||||
aoOutput *= (_AOmultiplier / (STEPS * DIRECTIONS));
|
||||
|
||||
float fallOffStart = _MaxDistance - _DistanceFalloff;
|
||||
float distFactor = saturate((P.z - fallOffStart) / (_MaxDistance - fallOffStart));
|
||||
|
||||
#if COLOR_BLEEDING
|
||||
//aoOutput.rgb = saturate(1 - lerp(dot(aoOutput.rgb, 0.333).xxx, aoOutput.rgb * albedo, _ColorBleedSaturation));
|
||||
aoOutput.rgb = saturate(lerp(dot(aoOutput.rgb, 0.333).xxx, aoOutput.rgb * albedo, _ColorBleedSaturation));
|
||||
aoOutput = lerp(saturate(float4(aoOutput.rgb, 1 - aoOutput.a)), float4(0, 0, 0, 1), distFactor);
|
||||
return aoOutput;
|
||||
#else
|
||||
aoOutput = lerp(saturate(1 - aoOutput), 1, distFactor);
|
||||
return float4(EncodeFloatRG(saturate(P.z * (1.0 / _ProjectionParams.z))), 1.0, aoOutput);
|
||||
#endif
|
||||
|
||||
#endif // DEBUG_VIEWNORMALS
|
||||
}
|
||||
#endif // HBAO_AO_INCLUDED
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user