Compare commits
8 Commits
maint/upda
...
feature/wo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df8e692c51 | ||
|
|
51429e6a62 | ||
|
|
5b5d7e5e05 | ||
|
|
096848a13c | ||
|
|
54f2d5a85f | ||
|
|
91ce080f51 | ||
|
|
521e13a843 | ||
|
|
2606545d37 |
1
.gitignore
vendored
@@ -72,3 +72,4 @@ crashlytics-build.properties
|
||||
# Temporary auto-generated Android Assets
|
||||
/[Aa]ssets/[Ss]treamingAssets/aa.meta
|
||||
/[Aa]ssets/[Ss]treamingAssets/aa/*
|
||||
ProjectSettings/ToonyColorsPro.json
|
||||
|
||||
@@ -119,7 +119,7 @@ Material:
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0.14117646, g: 0.58057773, b: 0.8, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 1.3818804, b: 2.06624, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
|
||||
@@ -16,9 +16,9 @@ MonoBehaviour:
|
||||
- {fileID: 2100000, guid: c22777d6e868e4f2fb421913386b154e, type: 2}
|
||||
- {fileID: 2100000, guid: 0b54b63be52c4f94ba30ff0d1ddb6cc8, type: 2}
|
||||
- {fileID: 2100000, guid: 9e9846162c23b624d8334dbfd2726184, type: 2}
|
||||
- {fileID: 2100000, guid: 4005e5f0044ff9e4e943eda4aeb744d8, type: 2}
|
||||
- {fileID: 2100000, guid: cbebec7947b8055469265d5c51a4fc1e, type: 2}
|
||||
- {fileID: 2100000, guid: ac80a53228487fc49957b1635bdb4649, type: 2}
|
||||
- {fileID: 2100000, guid: bf0cac97127c10f4e92189f8ae62a1e0, type: 2}
|
||||
- {fileID: 2100000, guid: 7f57b98b9625ec741b84af7f523be6cb, type: 2}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
|
||||
@@ -119,7 +119,7 @@ Material:
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0.5676508, g: 0.50746137, b: 0.41502768, a: 1}
|
||||
- _EmissionColor: {r: 3.6702042, g: 2.092814, b: 1.0214248, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
|
||||
@@ -18,10 +18,10 @@ MonoBehaviour:
|
||||
m_Value: 0
|
||||
threshold:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.5
|
||||
m_Value: 0.2
|
||||
intensity:
|
||||
m_OverrideState: 1
|
||||
m_Value: 2
|
||||
m_Value: 0.77
|
||||
scatter:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.852
|
||||
@@ -103,6 +103,140 @@ MonoBehaviour:
|
||||
rounded:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
--- !u!114 &-2433959604977798844
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
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: 5f17acff6deb4f089d110375635d4e37, type: 3}
|
||||
m_Name: HTraceSSGIVolume
|
||||
m_EditorClassIdentifier: HTraceSSGI::HTraceSSGI.Scripts.Infrastructure.URP.HTraceSSGIVolume
|
||||
active: 1
|
||||
Enable:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
DebugMode:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
HBuffer:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
ExcludeCastingMask:
|
||||
m_OverrideState: 0
|
||||
m_Value:
|
||||
serializedVersion: 0
|
||||
m_Bits: 0
|
||||
ExcludeReceivingMask:
|
||||
m_OverrideState: 0
|
||||
m_Value:
|
||||
serializedVersion: 0
|
||||
m_Bits: 0
|
||||
FallbackType:
|
||||
m_OverrideState: 1
|
||||
m_Value: 2
|
||||
SkyIntensity:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.517
|
||||
ViewBias:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0.1
|
||||
NormalBias:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0.25
|
||||
SamplingNoise:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0.1
|
||||
IntensityMultiplier:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
DenoiseFallback:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
MetallicIndirectFallback:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
AmbientOverride:
|
||||
m_OverrideState: 0
|
||||
m_Value: 1
|
||||
Multibounce:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
BackfaceLighting:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.25
|
||||
MaxRayLength:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1.6946087e+38
|
||||
ThicknessMode:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
Thickness:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.532
|
||||
Intensity:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1.08
|
||||
Falloff:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.328
|
||||
RayCount:
|
||||
m_OverrideState: 1
|
||||
m_Value: 4
|
||||
StepCount:
|
||||
m_OverrideState: 1
|
||||
m_Value: 36
|
||||
RefineIntersection:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
FullResolutionDepth:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
Checkerboard:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
RenderScale:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
BrightnessClamp:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
MaxValueBrightnessClamp:
|
||||
m_OverrideState: 1
|
||||
m_Value: 7
|
||||
MaxDeviationBrightnessClamp:
|
||||
m_OverrideState: 1
|
||||
m_Value: 3
|
||||
HalfStepValidation:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
SpatialOcclusionValidation:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
TemporalLightingValidation:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
TemporalOcclusionValidation:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
SpatialRadius:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.6
|
||||
Adaptivity:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.9
|
||||
RecurrentBlur:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
FireflySuppression:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
ShowBowels:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -122,6 +256,7 @@ MonoBehaviour:
|
||||
- {fileID: -3357603926938260329}
|
||||
- {fileID: -4572712511935420910}
|
||||
- {fileID: 7749192982097860104}
|
||||
- {fileID: 6137385787379973774}
|
||||
--- !u!114 &849379129802519247
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
@@ -162,6 +297,140 @@ MonoBehaviour:
|
||||
maxNits:
|
||||
m_OverrideState: 1
|
||||
m_Value: 647
|
||||
--- !u!114 &6137385787379973774
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
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: 5f17acff6deb4f089d110375635d4e37, type: 3}
|
||||
m_Name: HTraceSSGIVolume
|
||||
m_EditorClassIdentifier: HTraceSSGI::HTraceSSGI.Scripts.Infrastructure.URP.HTraceSSGIVolume
|
||||
active: 1
|
||||
Enable:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
DebugMode:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
HBuffer:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
ExcludeCastingMask:
|
||||
m_OverrideState: 0
|
||||
m_Value:
|
||||
serializedVersion: 0
|
||||
m_Bits: 0
|
||||
ExcludeReceivingMask:
|
||||
m_OverrideState: 0
|
||||
m_Value:
|
||||
serializedVersion: 0
|
||||
m_Bits: 0
|
||||
FallbackType:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
SkyIntensity:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.5
|
||||
ViewBias:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0.1
|
||||
NormalBias:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0.25
|
||||
SamplingNoise:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0.1
|
||||
IntensityMultiplier:
|
||||
m_OverrideState: 0
|
||||
m_Value: 1
|
||||
DenoiseFallback:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
MetallicIndirectFallback:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
AmbientOverride:
|
||||
m_OverrideState: 0
|
||||
m_Value: 1
|
||||
Multibounce:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
BackfaceLighting:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.25
|
||||
MaxRayLength:
|
||||
m_OverrideState: 1
|
||||
m_Value: 100
|
||||
ThicknessMode:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
Thickness:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.35
|
||||
Intensity:
|
||||
m_OverrideState: 1
|
||||
m_Value: 2.06
|
||||
Falloff:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.365
|
||||
RayCount:
|
||||
m_OverrideState: 1
|
||||
m_Value: 3
|
||||
StepCount:
|
||||
m_OverrideState: 1
|
||||
m_Value: 32
|
||||
RefineIntersection:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
FullResolutionDepth:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
Checkerboard:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
RenderScale:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.5
|
||||
BrightnessClamp:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
MaxValueBrightnessClamp:
|
||||
m_OverrideState: 1
|
||||
m_Value: 7
|
||||
MaxDeviationBrightnessClamp:
|
||||
m_OverrideState: 1
|
||||
m_Value: 3
|
||||
HalfStepValidation:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
SpatialOcclusionValidation:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
TemporalLightingValidation:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
TemporalOcclusionValidation:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
SpatialRadius:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.6
|
||||
Adaptivity:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.9
|
||||
RecurrentBlur:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
FireflySuppression:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
ShowBowels:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
--- !u!114 &7391319092446245454
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
|
||||
8
Assets/Map/Materials/Structure Materials.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6f950bb852729c41b4006f899e578b8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
241
Assets/Map/Materials/Structure Materials/BaseStructureMat.mat
Normal file
@@ -0,0 +1,241 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-2228814748603009970
|
||||
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: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
|
||||
version: 10
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: BaseStructureMat
|
||||
m_Shader: {fileID: 4800000, guid: 0327dc75d6819d949942e18f52b16935, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- _NORMALMAP
|
||||
m_InvalidKeywords:
|
||||
- _PARALLAXMAP
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses:
|
||||
- MOTIONVECTORS
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BaseColor:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BaseColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 2800000, guid: e4da0c5e5eed1124f9e599f0edbc3ead, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BaseMap2:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _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: e4da0c5e5eed1124f9e599f0edbc3ead, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MatCapMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MatCapTex:
|
||||
m_Texture: {fileID: 0}
|
||||
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: 2800000, guid: e76e0cdaf5291124e9c207baedccaae8, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _Ramp:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ReflectionTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ShadowBaseMap:
|
||||
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:
|
||||
- _AddPrecomputedVelocity: 0
|
||||
- _AlphaClip: 0
|
||||
- _AlphaToMask: 0
|
||||
- _Blend: 0
|
||||
- _BlendModePreserveSpecular: 1
|
||||
- _BumpScale: 0.08
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _Cull: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DirectIntensityOutline: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EmissionChannel: 4
|
||||
- _EnvironmentReflections: 1
|
||||
- _FresnelMax: 1.5
|
||||
- _FresnelMin: 0
|
||||
- _GlossMapScale: 0
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _IndirectIntensity: 1
|
||||
- _IndirectIntensityOutline: 0
|
||||
- _MatCapMaskChannel: 0
|
||||
- _MatCapType: 0
|
||||
- _Metallic: 0
|
||||
- _NormalsSource: 0
|
||||
- _NormalsUVType: 0
|
||||
- _OcclusionChannel: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _OutlineLightingType: 0
|
||||
- _OutlineLightingTypeURP: 0
|
||||
- _OutlineMaxWidth: 1
|
||||
- _OutlineMinWidth: 1
|
||||
- _OutlinePixelSizeType: 0
|
||||
- _OutlineTextureLOD: 5
|
||||
- _OutlineTextureType: 0
|
||||
- _OutlineWidth: 1
|
||||
- _Parallax: 0.005
|
||||
- _QueueOffset: 0
|
||||
- _RampBands: 4
|
||||
- _RampBandsSmoothing: 0.1
|
||||
- _RampOffset: 0
|
||||
- _RampScale: 1
|
||||
- _RampSmoothing: 0.42
|
||||
- _RampThreshold: 0.406
|
||||
- _RampType: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _ReceiveShadowsOff: 1
|
||||
- _ReflectionMapType: 0
|
||||
- _ReflectionSmoothness: 0.5
|
||||
- _RenderingMode: 0
|
||||
- _RimMax: 0.778
|
||||
- _RimMin: 0.493
|
||||
- _ShadowColorLightAtten: 1
|
||||
- _ShadowLineSmoothing: 0.1
|
||||
- _ShadowLineStrength: 1
|
||||
- _ShadowLineThreshold: 0.194
|
||||
- _SingleIndirectColor: 0
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SpecularMapType: 0
|
||||
- _SpecularRoughness: 0.5
|
||||
- _SpecularToonSize: 0.25
|
||||
- _SpecularToonSmoothness: 0.05
|
||||
- _SpecularType: 0
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 0
|
||||
- _UseAlphaTest: 0
|
||||
- _UseEmission: 0
|
||||
- _UseFresnelReflections: 1
|
||||
- _UseMatCap: 0
|
||||
- _UseMatCapMask: 0
|
||||
- _UseMobileMode: 0
|
||||
- _UseNormalMap: 1
|
||||
- _UseOcclusion: 0
|
||||
- _UseOutline: 0
|
||||
- _UseReflections: 0
|
||||
- _UseRim: 0
|
||||
- _UseRimLightMask: 1
|
||||
- _UseShadowTexture: 0
|
||||
- _UseSpecular: 0
|
||||
- _WorkflowMode: 1
|
||||
- _XRMotionVectorsPass: 1
|
||||
- _ZWrite: 1
|
||||
- __BeginGroup_ShadowHSV: 0
|
||||
- __EndGroup: 0
|
||||
- __dummy__: 0
|
||||
m_Colors:
|
||||
- _BaseAlbedo: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _BaseAlbedo2: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _BaseColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _BaseColor1: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 0.745283, g: 0.745283, b: 0.745283, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _HColor: {r: 0.66522783, g: 0.8139915, b: 0.9339623, a: 1}
|
||||
- _MatCapColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _ReflectionColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _RimColor: {r: 0, g: 0.46489573, b: 1, a: 0.5}
|
||||
- _RimDir: {r: 0, g: 0, b: -1, a: 0}
|
||||
- _SColor: {r: 0.2924528, g: 0.15517698, b: 0.13656995, a: 1}
|
||||
- _ShadowLineColor: {r: 1, g: 0, b: 0, a: 0.08627451}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _SpecularColor: {r: 0.75, g: 0.75, b: 0.75, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf0cac97127c10f4e92189f8ae62a1e0
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
137
Assets/Map/Materials/Structure Materials/DefaultLit.mat
Normal file
@@ -0,0 +1,137 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-7216474951084939940
|
||||
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: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
|
||||
version: 10
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: DefaultLit
|
||||
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: -1
|
||||
stringTagMap:
|
||||
RenderType: Opaque
|
||||
disabledShaderPasses:
|
||||
- MOTIONVECTORS
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _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: 0}
|
||||
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:
|
||||
- _AddPrecomputedVelocity: 0
|
||||
- _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.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 0
|
||||
- _WorkflowMode: 1
|
||||
- _XRMotionVectorsPass: 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
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f57b98b9625ec741b84af7f523be6cb
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,782 @@
|
||||
// Toony Colors Pro+Mobile 2
|
||||
// (c) 2014-2025 Jean Moreno
|
||||
|
||||
Shader "Reset/BaseStructureShader"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[TCP2HeaderHelp(Base)]
|
||||
[TCP2ColorNoAlpha] _HColor ("Highlight Color", Color) = (0.75,0.75,0.75,1)
|
||||
[TCP2ColorNoAlpha] _SColor ("Shadow Color", Color) = (0.2,0.2,0.2,1)
|
||||
[TCP2Separator]
|
||||
|
||||
[TCP2Header(Ramp Shading)]
|
||||
|
||||
_RampThreshold ("Threshold", Range(0.01,1)) = 0.5
|
||||
_RampSmoothing ("Smoothing", Range(0.001,1)) = 0.5
|
||||
[TCP2Separator]
|
||||
|
||||
[TCP2HeaderHelp(Rim Lighting)]
|
||||
[Toggle(TCP2_RIM_LIGHTING)] _UseRim ("Enable Rim Lighting", Float) = 0
|
||||
[TCP2ColorNoAlpha] _RimColor ("Rim Color", Color) = (0.8,0.8,0.8,0.5)
|
||||
_RimMin ("Rim Min", Range(0,2)) = 0.5
|
||||
_RimMax ("Rim Max", Range(0,2)) = 1
|
||||
//Rim Direction
|
||||
_RimDir ("Rim Direction", Vector) = (0,0,1,1)
|
||||
[TCP2Separator]
|
||||
|
||||
[TCP2HeaderHelp(Normal Mapping)]
|
||||
[Toggle(_NORMALMAP)] _UseNormalMap ("Enable Normal Mapping", Float) = 0
|
||||
[NoScaleOffset] _BumpMap ("Normal Map", 2D) = "bump" {}
|
||||
_BumpScale ("Scale", Float) = 1
|
||||
[NoScaleOffset] _ParallaxMap ("Height Map", 2D) = "black" {}
|
||||
_Parallax ("Height", Range(0.005,0.08)) = 0.02
|
||||
[TCP2Separator]
|
||||
[HideInInspector] __BeginGroup_ShadowHSV ("Shadow Line", Float) = 0
|
||||
_ShadowLineThreshold ("Threshold", Range(0,1)) = 0.5
|
||||
_ShadowLineSmoothing ("Smoothing", Range(0.001,0.1)) = 0.015
|
||||
_ShadowLineStrength ("Strength", Float) = 1
|
||||
_ShadowLineColor ("Color (RGB) Opacity (A)", Color) = (0,0,0,1)
|
||||
[HideInInspector] __EndGroup ("Shadow Line", Float) = 0
|
||||
|
||||
// Custom Material Properties
|
||||
[NoScaleOffset] _BaseColorMap ("Color Map", 2D) = "white" {}
|
||||
_BaseColor ("Color", Color) = (1,1,1,1)
|
||||
|
||||
[ToggleOff(_RECEIVE_SHADOWS_OFF)] _ReceiveShadowsOff ("Receive Shadows", Float) = 1
|
||||
|
||||
// Avoid compile error if the properties are ending with a drawer
|
||||
[HideInInspector] __dummy__ ("unused", Float) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"RenderPipeline" = "UniversalPipeline"
|
||||
"RenderType"="Opaque"
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
#define fixed half
|
||||
#define fixed2 half2
|
||||
#define fixed3 half3
|
||||
#define fixed4 half4
|
||||
|
||||
#if UNITY_VERSION >= 202020
|
||||
#define URP_10_OR_NEWER
|
||||
#endif
|
||||
#if UNITY_VERSION >= 202120
|
||||
#define URP_12_OR_NEWER
|
||||
#endif
|
||||
#if UNITY_VERSION >= 202220
|
||||
#define URP_14_OR_NEWER
|
||||
#endif
|
||||
|
||||
// Texture/Sampler abstraction
|
||||
#define TCP2_TEX2D_WITH_SAMPLER(tex) TEXTURE2D(tex); SAMPLER(sampler##tex)
|
||||
#define TCP2_TEX2D_NO_SAMPLER(tex) TEXTURE2D(tex)
|
||||
#define TCP2_TEX2D_SAMPLE(tex, samplertex, coord) SAMPLE_TEXTURE2D(tex, sampler##samplertex, coord)
|
||||
#define TCP2_TEX2D_SAMPLE_LOD(tex, samplertex, coord, lod) SAMPLE_TEXTURE2D_LOD(tex, sampler##samplertex, coord, lod)
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
// Uniforms
|
||||
|
||||
// Custom Material Properties
|
||||
TCP2_TEX2D_WITH_SAMPLER(_BaseColorMap);
|
||||
|
||||
// Shader Properties
|
||||
TCP2_TEX2D_WITH_SAMPLER(_ParallaxMap);
|
||||
TCP2_TEX2D_WITH_SAMPLER(_BumpMap);
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
|
||||
// Custom Material Properties
|
||||
|
||||
fixed4 _BaseColor;
|
||||
|
||||
// Shader Properties
|
||||
float _Parallax;
|
||||
float _BumpScale;
|
||||
float _RampThreshold;
|
||||
float _RampSmoothing;
|
||||
float _ShadowLineThreshold;
|
||||
float _ShadowLineStrength;
|
||||
float _ShadowLineSmoothing;
|
||||
fixed4 _ShadowLineColor;
|
||||
float4 _RimDir;
|
||||
float _RimMin;
|
||||
float _RimMax;
|
||||
fixed4 _RimColor;
|
||||
fixed4 _SColor;
|
||||
fixed4 _HColor;
|
||||
CBUFFER_END
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ParallaxMapping.hlsl"
|
||||
|
||||
// Calculates UV offset for parallax bump mapping
|
||||
inline float2 TCP2_ParallaxOffset( half h, half height, half3 viewDir )
|
||||
{
|
||||
h = h * height - height/2.0;
|
||||
float3 v = normalize(viewDir);
|
||||
v.z += 0.42;
|
||||
return h * (v.xy / v.z);
|
||||
}
|
||||
|
||||
// Cubic pulse function
|
||||
// Adapted from: http://www.iquilezles.org/www/articles/functions/functions.htm (c) 2017 - Inigo Quilez - MIT License
|
||||
float linearPulse(float c, float w, float x)
|
||||
{
|
||||
x = abs(x - c);
|
||||
if (x > w)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
x /= w;
|
||||
return 1 - x;
|
||||
}
|
||||
|
||||
// Built-in renderer (CG) to SRP (HLSL) bindings
|
||||
#define UnityObjectToClipPos TransformObjectToHClip
|
||||
#define _WorldSpaceLightPos0 _MainLightPosition
|
||||
|
||||
ENDHLSL
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Main"
|
||||
Tags
|
||||
{
|
||||
"LightMode"="UniversalForward"
|
||||
}
|
||||
|
||||
HLSLPROGRAM
|
||||
// Required to compile gles 2.0 with standard SRP library
|
||||
// All shaders must be compiled with HLSLcc and currently only gles is not using HLSLcc by default
|
||||
#pragma prefer_hlslcc gles
|
||||
#pragma exclude_renderers d3d11_9x
|
||||
#pragma target 3.0
|
||||
|
||||
// -------------------------------------
|
||||
// Material keywords
|
||||
#pragma shader_feature_local _ _RECEIVE_SHADOWS_OFF
|
||||
|
||||
// -------------------------------------
|
||||
// Universal Render Pipeline keywords
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
||||
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
||||
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
|
||||
|
||||
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
|
||||
#pragma multi_compile _ SHADOWS_SHADOWMASK
|
||||
#pragma multi_compile _ _CLUSTER_LIGHT_LOOP
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
|
||||
|
||||
// -------------------------------------
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
|
||||
#pragma vertex Vertex
|
||||
#pragma fragment Fragment
|
||||
|
||||
//--------------------------------------
|
||||
// Toony Colors Pro 2 keywords
|
||||
#pragma shader_feature_local_fragment TCP2_RIM_LIGHTING
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
|
||||
// vertex input
|
||||
struct Attributes
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float4 tangent : TANGENT;
|
||||
float4 texcoord0 : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
// vertex output / fragment input
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionCS : SV_POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float4 worldPosAndFog : TEXCOORD0;
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
float4 shadowCoord : TEXCOORD1; // compute shadow coord per-vertex for the main light
|
||||
#endif
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
half3 vertexLights : TEXCOORD2;
|
||||
#endif
|
||||
float3 pack0 : TEXCOORD3; /* pack0.xyz = tangent */
|
||||
float3 pack1 : TEXCOORD4; /* pack1.xyz = bitangent */
|
||||
float2 pack2 : TEXCOORD5; /* pack2.xy = texcoord0 */
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
#if USE_FORWARD_PLUS || USE_CLUSTER_LIGHT_LOOP
|
||||
// Fake InputData struct needed for Forward+ macro
|
||||
struct InputDataForwardPlusDummy
|
||||
{
|
||||
float3 positionWS;
|
||||
float2 normalizedScreenSpaceUV;
|
||||
};
|
||||
#endif
|
||||
|
||||
Varyings Vertex(Attributes input)
|
||||
{
|
||||
Varyings output = (Varyings)0;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
// Texture Coordinates
|
||||
output.pack2.xy = input.texcoord0.xy;
|
||||
|
||||
float3 worldPos = mul(UNITY_MATRIX_M, input.vertex).xyz;
|
||||
VertexPositionInputs vertexInput = GetVertexPositionInputs(input.vertex.xyz);
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
output.shadowCoord = GetShadowCoord(vertexInput);
|
||||
#endif
|
||||
|
||||
VertexNormalInputs vertexNormalInput = GetVertexNormalInputs(input.normal, input.tangent);
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
// Vertex lighting
|
||||
output.vertexLights = VertexLighting(vertexInput.positionWS, vertexNormalInput.normalWS);
|
||||
#endif
|
||||
|
||||
// world position
|
||||
output.worldPosAndFog = float4(vertexInput.positionWS.xyz, 0);
|
||||
|
||||
// normal
|
||||
output.normal = normalize(vertexNormalInput.normalWS);
|
||||
|
||||
// tangent
|
||||
output.pack0.xyz = vertexNormalInput.tangentWS;
|
||||
output.pack1.xyz = vertexNormalInput.bitangentWS;
|
||||
|
||||
// clip position
|
||||
output.positionCS = vertexInput.positionCS;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 Fragment(Varyings input
|
||||
) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
float3 positionWS = input.worldPosAndFog.xyz;
|
||||
float3 normalWS = normalize(input.normal);
|
||||
half3 viewDirWS = GetWorldSpaceNormalizeViewDir(positionWS);
|
||||
half3 tangentWS = input.pack0.xyz;
|
||||
half3 bitangentWS = input.pack1.xyz;
|
||||
#if defined(_NORMALMAP)
|
||||
half3x3 tangentToWorldMatrix = half3x3(tangentWS.xyz, bitangentWS.xyz, normalWS.xyz);
|
||||
//Parallax Offset
|
||||
float __parallaxHeightMap = ( TCP2_TEX2D_SAMPLE(_ParallaxMap, _ParallaxMap, input.pack2.xy).a );
|
||||
float __parallaxHeight = ( _Parallax );
|
||||
half height = __parallaxHeightMap;
|
||||
half3 viewDirTS = GetViewDirectionTangentSpace(half4(tangentWS, 0), normalWS, viewDirWS);
|
||||
float2 offset = TCP2_ParallaxOffset(height, __parallaxHeight, viewDirTS);
|
||||
input.pack2.xy += offset;
|
||||
#endif
|
||||
|
||||
// Custom Material Properties Sampling
|
||||
half4 value__BaseColorMap = TCP2_TEX2D_SAMPLE(_BaseColorMap, _BaseColorMap, input.pack2.xy).rgba;
|
||||
|
||||
// Shader Properties Sampling
|
||||
float4 __normalMap = ( TCP2_TEX2D_SAMPLE(_BumpMap, _BumpMap, input.pack2.xy).rgba );
|
||||
float __bumpScale = ( _BumpScale );
|
||||
float4 __albedo = ( value__BaseColorMap.rgba );
|
||||
float4 __mainColor = ( _BaseColor.rgba );
|
||||
float __alpha = ( __albedo.a * __mainColor.a );
|
||||
float __ambientIntensity = ( 1.0 );
|
||||
float __rampThreshold = ( _RampThreshold );
|
||||
float __rampSmoothing = ( _RampSmoothing );
|
||||
float __shadowLineThreshold = ( _ShadowLineThreshold );
|
||||
float __shadowLineStrength = ( _ShadowLineStrength );
|
||||
float __shadowLineSmoothing = ( _ShadowLineSmoothing );
|
||||
float4 __shadowLineColor = ( _ShadowLineColor.rgba );
|
||||
float3 __rimDir = ( _RimDir.xyz );
|
||||
float __rimMin = ( _RimMin );
|
||||
float __rimMax = ( _RimMax );
|
||||
float3 __rimColor = ( _RimColor.rgb );
|
||||
float __rimStrength = ( 1.0 );
|
||||
float3 __shadowColor = ( _SColor.rgb );
|
||||
float3 __highlightColor = ( _HColor.rgb );
|
||||
|
||||
#if defined(_NORMALMAP)
|
||||
half4 normalMap = __normalMap;
|
||||
half3 normalTS = UnpackNormalScale(normalMap, __bumpScale);
|
||||
#if defined(_NORMALMAP)
|
||||
normalWS = normalize( mul(normalTS, tangentToWorldMatrix) );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// main texture
|
||||
half3 albedo = __albedo.rgb;
|
||||
half alpha = __alpha;
|
||||
|
||||
half3 emission = half3(0,0,0);
|
||||
|
||||
albedo *= __mainColor.rgb;
|
||||
|
||||
// main light: direction, color, distanceAttenuation, shadowAttenuation
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
float4 shadowCoord = input.shadowCoord;
|
||||
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS)
|
||||
float4 shadowCoord = TransformWorldToShadowCoord(positionWS);
|
||||
#else
|
||||
float4 shadowCoord = float4(0, 0, 0, 0);
|
||||
#endif
|
||||
|
||||
#if defined(URP_10_OR_NEWER)
|
||||
#if defined(SHADOWS_SHADOWMASK) && defined(LIGHTMAP_ON)
|
||||
half4 shadowMask = SAMPLE_SHADOWMASK(input.staticLightmapUV);
|
||||
#elif !defined (LIGHTMAP_ON)
|
||||
half4 shadowMask = unity_ProbesOcclusion;
|
||||
#else
|
||||
half4 shadowMask = half4(1, 1, 1, 1);
|
||||
#endif
|
||||
|
||||
Light mainLight = GetMainLight(shadowCoord, positionWS, shadowMask);
|
||||
#else
|
||||
Light mainLight = GetMainLight(shadowCoord);
|
||||
#endif
|
||||
|
||||
#if defined(_SCREEN_SPACE_OCCLUSION) || defined(USE_FORWARD_PLUS) || defined(USE_CLUSTER_LIGHT_LOOP)
|
||||
float2 normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(input.positionCS);
|
||||
#endif
|
||||
|
||||
// ambient or lightmap
|
||||
// Samples SH fully per-pixel. SampleSHVertex and SampleSHPixel functions
|
||||
// are also defined in case you want to sample some terms per-vertex.
|
||||
half3 bakedGI = SampleSH(normalWS);
|
||||
half occlusion = 1;
|
||||
|
||||
half3 indirectDiffuse = bakedGI;
|
||||
indirectDiffuse *= occlusion * albedo * __ambientIntensity;
|
||||
|
||||
half3 lightDir = mainLight.direction;
|
||||
half3 lightColor = mainLight.color.rgb;
|
||||
|
||||
half atten = mainLight.shadowAttenuation * mainLight.distanceAttenuation;
|
||||
|
||||
half ndl = dot(normalWS, lightDir);
|
||||
half3 ramp;
|
||||
|
||||
half rampThreshold = __rampThreshold;
|
||||
half rampSmooth = __rampSmoothing * 0.5;
|
||||
ndl = saturate(ndl);
|
||||
ramp = smoothstep(rampThreshold - rampSmooth, rampThreshold + rampSmooth, ndl);
|
||||
|
||||
// apply attenuation
|
||||
ramp *= atten;
|
||||
|
||||
//Shadow Line
|
||||
float ndlAtten = ndl * atten;
|
||||
float shadowLineThreshold = __shadowLineThreshold;
|
||||
float shadowLineStrength = __shadowLineStrength;
|
||||
float shadowLineSmoothing = __shadowLineSmoothing;
|
||||
float shadowLine = min(linearPulse(ndlAtten, shadowLineSmoothing, shadowLineThreshold) * shadowLineStrength, 1.0);
|
||||
half4 shadowLineColor = __shadowLineColor;
|
||||
ramp = lerp(ramp.rgb, shadowLineColor.rgb, shadowLine * shadowLineColor.a);
|
||||
half3 color = half3(0,0,0);
|
||||
// Rim Lighting
|
||||
#if defined(TCP2_RIM_LIGHTING)
|
||||
half3 rViewDir = viewDirWS;
|
||||
half3 rimDir = __rimDir;
|
||||
rViewDir = normalize(UNITY_MATRIX_V[0].xyz * rimDir.x + UNITY_MATRIX_V[1].xyz * rimDir.y + UNITY_MATRIX_V[2].xyz * rimDir.z);
|
||||
half rim = 1.0f - saturate(dot(rViewDir, normalWS));
|
||||
rim = ( rim );
|
||||
half rimMin = __rimMin;
|
||||
half rimMax = __rimMax;
|
||||
rim = smoothstep(rimMin, rimMax, rim);
|
||||
half3 rimColor = __rimColor;
|
||||
half rimStrength = __rimStrength;
|
||||
//Rim light mask
|
||||
emission.rgb += ndl * atten * rim * rimColor * rimStrength;
|
||||
#endif
|
||||
half3 accumulatedRamp = ramp * max(lightColor.r, max(lightColor.g, lightColor.b));
|
||||
half3 accumulatedColors = ramp * lightColor.rgb;
|
||||
|
||||
// Additional lights loop
|
||||
#ifdef _ADDITIONAL_LIGHTS
|
||||
uint pixelLightCount = GetAdditionalLightsCount();
|
||||
|
||||
#if USE_FORWARD_PLUS || USE_CLUSTER_LIGHT_LOOP
|
||||
// Additional directional lights in Forward+
|
||||
for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++)
|
||||
{
|
||||
CLUSTER_LIGHT_LOOP_SUBTRACTIVE_LIGHT_CHECK
|
||||
|
||||
Light light = GetAdditionalLight(lightIndex, positionWS, shadowMask);
|
||||
|
||||
#if defined(_LIGHT_LAYERS)
|
||||
if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
|
||||
#endif
|
||||
{
|
||||
half atten = light.shadowAttenuation * light.distanceAttenuation;
|
||||
|
||||
#if defined(_LIGHT_LAYERS)
|
||||
half3 lightDir = half3(0, 1, 0);
|
||||
half3 lightColor = half3(0, 0, 0);
|
||||
if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
|
||||
{
|
||||
lightColor = light.color.rgb;
|
||||
lightDir = light.direction;
|
||||
}
|
||||
#else
|
||||
half3 lightColor = light.color.rgb;
|
||||
half3 lightDir = light.direction;
|
||||
#endif
|
||||
|
||||
half ndl = dot(normalWS, lightDir);
|
||||
half3 ramp;
|
||||
|
||||
ndl = saturate(ndl);
|
||||
ramp = smoothstep(rampThreshold - rampSmooth, rampThreshold + rampSmooth, ndl);
|
||||
|
||||
// apply attenuation (shadowmaps & point/spot lights attenuation)
|
||||
ramp *= atten;
|
||||
|
||||
//Shadow Line
|
||||
float ndlAtten = ndl * atten;
|
||||
float shadowLineThreshold = __shadowLineThreshold;
|
||||
float shadowLineStrength = __shadowLineStrength;
|
||||
float shadowLineSmoothing = __shadowLineSmoothing;
|
||||
float shadowLine = min(linearPulse(ndlAtten, shadowLineSmoothing, shadowLineThreshold) * shadowLineStrength, 1.0);
|
||||
half4 shadowLineColor = __shadowLineColor;
|
||||
ramp = lerp(ramp.rgb, shadowLineColor.rgb, shadowLine * shadowLineColor.a);
|
||||
accumulatedRamp += ramp * max(lightColor.r, max(lightColor.g, lightColor.b));
|
||||
accumulatedColors += ramp * lightColor.rgb;
|
||||
|
||||
#if defined(TCP2_RIM_LIGHTING)
|
||||
// Rim light mask
|
||||
half3 rimColor = __rimColor;
|
||||
half rimStrength = __rimStrength;
|
||||
emission.rgb += ndl * atten * rim * rimColor * rimStrength;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Data with dummy struct used in Forward+ macro (LIGHT_LOOP_BEGIN)
|
||||
InputDataForwardPlusDummy inputData;
|
||||
inputData.normalizedScreenSpaceUV = normalizedScreenSpaceUV;
|
||||
inputData.positionWS = positionWS;
|
||||
#endif
|
||||
|
||||
LIGHT_LOOP_BEGIN(pixelLightCount)
|
||||
{
|
||||
#if defined(URP_10_OR_NEWER)
|
||||
Light light = GetAdditionalLight(lightIndex, positionWS, shadowMask);
|
||||
#else
|
||||
Light light = GetAdditionalLight(lightIndex, positionWS);
|
||||
#endif
|
||||
half atten = light.shadowAttenuation * light.distanceAttenuation;
|
||||
|
||||
#if defined(_LIGHT_LAYERS)
|
||||
half3 lightDir = half3(0, 1, 0);
|
||||
half3 lightColor = half3(0, 0, 0);
|
||||
if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
|
||||
{
|
||||
lightColor = light.color.rgb;
|
||||
lightDir = light.direction;
|
||||
}
|
||||
#else
|
||||
half3 lightColor = light.color.rgb;
|
||||
half3 lightDir = light.direction;
|
||||
#endif
|
||||
|
||||
half ndl = dot(normalWS, lightDir);
|
||||
half3 ramp;
|
||||
|
||||
ndl = saturate(ndl);
|
||||
ramp = smoothstep(rampThreshold - rampSmooth, rampThreshold + rampSmooth, ndl);
|
||||
|
||||
// apply attenuation (shadowmaps & point/spot lights attenuation)
|
||||
ramp *= atten;
|
||||
|
||||
//Shadow Line
|
||||
float ndlAtten = ndl * atten;
|
||||
float shadowLineThreshold = __shadowLineThreshold;
|
||||
float shadowLineStrength = __shadowLineStrength;
|
||||
float shadowLineSmoothing = __shadowLineSmoothing;
|
||||
float shadowLine = min(linearPulse(ndlAtten, shadowLineSmoothing, shadowLineThreshold) * shadowLineStrength, 1.0);
|
||||
half4 shadowLineColor = __shadowLineColor;
|
||||
ramp = lerp(ramp.rgb, shadowLineColor.rgb, shadowLine * shadowLineColor.a);
|
||||
accumulatedRamp += ramp * max(lightColor.r, max(lightColor.g, lightColor.b));
|
||||
accumulatedColors += ramp * lightColor.rgb;
|
||||
|
||||
#if defined(TCP2_RIM_LIGHTING)
|
||||
// Rim light mask
|
||||
half3 rimColor = __rimColor;
|
||||
half rimStrength = __rimStrength;
|
||||
emission.rgb += ndl * atten * rim * rimColor * rimStrength;
|
||||
#endif
|
||||
}
|
||||
LIGHT_LOOP_END
|
||||
#endif
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
color += input.vertexLights * albedo;
|
||||
#endif
|
||||
|
||||
accumulatedRamp = saturate(accumulatedRamp);
|
||||
half3 shadowColor = (1 - accumulatedRamp.rgb) * __shadowColor;
|
||||
accumulatedRamp = accumulatedColors.rgb * __highlightColor + shadowColor;
|
||||
color += albedo * accumulatedRamp;
|
||||
|
||||
// apply ambient
|
||||
color += indirectDiffuse;
|
||||
|
||||
color += emission;
|
||||
|
||||
return half4(color, alpha);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// Depth & Shadow Caster Passes
|
||||
HLSLINCLUDE
|
||||
|
||||
#if defined(SHADOW_CASTER_PASS) || defined(DEPTH_ONLY_PASS)
|
||||
|
||||
#define fixed half
|
||||
#define fixed2 half2
|
||||
#define fixed3 half3
|
||||
#define fixed4 half4
|
||||
|
||||
float3 _LightDirection;
|
||||
float3 _LightPosition;
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float4 texcoord0 : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionCS : SV_POSITION;
|
||||
#if defined(DEPTH_NORMALS_PASS)
|
||||
float3 normalWS : TEXCOORD0;
|
||||
#endif
|
||||
float3 pack0 : TEXCOORD1; /* pack0.xyz = positionWS */
|
||||
float2 pack1 : TEXCOORD2; /* pack1.xy = texcoord0 */
|
||||
#if defined(DEPTH_ONLY_PASS)
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
#endif
|
||||
};
|
||||
|
||||
float4 GetShadowPositionHClip(Attributes input)
|
||||
{
|
||||
float3 positionWS = TransformObjectToWorld(input.vertex.xyz);
|
||||
float3 normalWS = TransformObjectToWorldNormal(input.normal);
|
||||
|
||||
#if _CASTING_PUNCTUAL_LIGHT_SHADOW
|
||||
float3 lightDirectionWS = normalize(_LightPosition - positionWS);
|
||||
#else
|
||||
float3 lightDirectionWS = _LightDirection;
|
||||
#endif
|
||||
float4 positionCS = TransformWorldToHClip(ApplyShadowBias(positionWS, normalWS, lightDirectionWS));
|
||||
|
||||
#if UNITY_REVERSED_Z
|
||||
positionCS.z = min(positionCS.z, UNITY_NEAR_CLIP_VALUE);
|
||||
#else
|
||||
positionCS.z = max(positionCS.z, UNITY_NEAR_CLIP_VALUE);
|
||||
#endif
|
||||
|
||||
return positionCS;
|
||||
}
|
||||
|
||||
Varyings ShadowDepthPassVertex(Attributes input)
|
||||
{
|
||||
Varyings output = (Varyings)0;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
#if defined(DEPTH_ONLY_PASS)
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
#endif
|
||||
|
||||
// Texture Coordinates
|
||||
output.pack1.xy = input.texcoord0.xy;
|
||||
|
||||
float3 worldPos = mul(UNITY_MATRIX_M, input.vertex).xyz;
|
||||
VertexPositionInputs vertexInput = GetVertexPositionInputs(input.vertex.xyz);
|
||||
output.pack0.xyz = vertexInput.positionWS;
|
||||
|
||||
#if defined(DEPTH_ONLY_PASS)
|
||||
output.positionCS = TransformObjectToHClip(input.vertex.xyz);
|
||||
#if defined(DEPTH_NORMALS_PASS)
|
||||
float3 normalWS = TransformObjectToWorldNormal(input.normal);
|
||||
output.normalWS = normalWS; // already normalized in TransformObjectToWorldNormal
|
||||
#endif
|
||||
#elif defined(SHADOW_CASTER_PASS)
|
||||
output.positionCS = GetShadowPositionHClip(input);
|
||||
#else
|
||||
output.positionCS = float4(0,0,0,0);
|
||||
#endif
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 ShadowDepthPassFragment(
|
||||
Varyings input
|
||||
#if defined(DEPTH_NORMALS_PASS) && defined(_WRITE_RENDERING_LAYERS)
|
||||
#if UNITY_VERSION >= 60020000
|
||||
, out uint outRenderingLayers : SV_Target1
|
||||
#else
|
||||
, out float4 outRenderingLayers : SV_Target1
|
||||
#endif
|
||||
#endif
|
||||
) : SV_TARGET
|
||||
{
|
||||
#if defined(DEPTH_ONLY_PASS)
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
#endif
|
||||
|
||||
float3 positionWS = input.pack0.xyz;
|
||||
|
||||
// Custom Material Properties Sampling
|
||||
half4 value__BaseColorMap = TCP2_TEX2D_SAMPLE(_BaseColorMap, _BaseColorMap, input.pack1.xy).rgba;
|
||||
|
||||
// Shader Properties Sampling
|
||||
float4 __albedo = ( value__BaseColorMap.rgba );
|
||||
float4 __mainColor = ( _BaseColor.rgba );
|
||||
float __alpha = ( __albedo.a * __mainColor.a );
|
||||
|
||||
half3 viewDirWS = GetWorldSpaceNormalizeViewDir(positionWS);
|
||||
half3 albedo = half3(1,1,1);
|
||||
half alpha = __alpha;
|
||||
half3 emission = half3(0,0,0);
|
||||
|
||||
#if defined(DEPTH_NORMALS_PASS)
|
||||
#if defined(_WRITE_RENDERING_LAYERS)
|
||||
#if UNITY_VERSION >= 60020000
|
||||
outRenderingLayers = EncodeMeshRenderingLayer();
|
||||
#else
|
||||
outRenderingLayers = float4(EncodeMeshRenderingLayer(GetMeshRenderingLayer()), 0, 0, 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(URP_12_OR_NEWER)
|
||||
return float4(input.normalWS.xyz, 0.0);
|
||||
#else
|
||||
return float4(PackNormalOctRectEncode(TransformWorldToViewDir(input.normalWS, true)), 0.0, 0.0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
ENDHLSL
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "ShadowCaster"
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "ShadowCaster"
|
||||
}
|
||||
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
|
||||
HLSLPROGRAM
|
||||
// Required to compile gles 2.0 with standard srp library
|
||||
#pragma prefer_hlslcc gles
|
||||
#pragma exclude_renderers d3d11_9x
|
||||
#pragma target 2.0
|
||||
|
||||
// using simple #define doesn't work, we have to use this instead
|
||||
#pragma multi_compile SHADOW_CASTER_PASS
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
#pragma multi_compile_vertex _ _CASTING_PUNCTUAL_LIGHT_SHADOW
|
||||
|
||||
#pragma vertex ShadowDepthPassVertex
|
||||
#pragma fragment ShadowDepthPassFragment
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "DepthOnly"
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "DepthOnly"
|
||||
}
|
||||
|
||||
ZWrite On
|
||||
ColorMask 0
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
// Required to compile gles 2.0 with standard srp library
|
||||
#pragma prefer_hlslcc gles
|
||||
#pragma exclude_renderers d3d11_9x
|
||||
#pragma target 2.0
|
||||
|
||||
//--------------------------------------
|
||||
// GPU Instancing
|
||||
#pragma multi_compile_instancing
|
||||
|
||||
// using simple #define doesn't work, we have to use this instead
|
||||
#pragma multi_compile DEPTH_ONLY_PASS
|
||||
|
||||
#pragma vertex ShadowDepthPassVertex
|
||||
#pragma fragment ShadowDepthPassFragment
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "DepthNormals"
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "DepthNormals"
|
||||
}
|
||||
|
||||
ZWrite On
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma exclude_renderers gles gles3 glcore
|
||||
#pragma target 2.0
|
||||
|
||||
#pragma multi_compile_instancing
|
||||
|
||||
// using simple #define doesn't work, we have to use this instead
|
||||
#pragma multi_compile DEPTH_ONLY_PASS
|
||||
#pragma multi_compile DEPTH_NORMALS_PASS
|
||||
|
||||
#pragma vertex ShadowDepthPassVertex
|
||||
#pragma fragment ShadowDepthPassFragment
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FallBack "Hidden/InternalErrorShader"
|
||||
CustomEditor "ToonyColorsPro.ShaderGenerator.MaterialInspector_SG2"
|
||||
}
|
||||
|
||||
/* TCP_DATA u config(ver:"2.9.20";unity:"6000.2.1f1";tmplt:"SG2_Template_URP";features:list["UNITY_5_4","UNITY_5_5","UNITY_5_6","UNITY_2017_1","UNITY_2018_1","UNITY_2018_2","UNITY_2018_3","UNITY_2019_1","UNITY_2019_2","UNITY_2019_3","UNITY_2019_4","UNITY_2020_1","UNITY_2021_1","UNITY_2021_2","UNITY_2022_2","UNITY_6000_2","UNITY_6000_1","UNITY_6000_0","ENABLE_DEPTH_NORMALS_PASS","ENABLE_FORWARD_PLUS","BUMP","BUMP_SCALE","BUMP_SHADER_FEATURE","PARALLAX","RIM","SHADOW_LINE","RIM_DIR","RIM_SHADER_FEATURE","RIM_LIGHTMASK","TEMPLATE_LWRP"];flags:list[];flags_extra:dict[];keywords:dict[RENDER_TYPE="Opaque",RampTextureDrawer="[TCP2Gradient]",RampTextureLabel="Ramp Texture",SHADER_TARGET="3.0",RIM_LABEL="Rim Lighting"];shaderProperties:list[sp(name:"Albedo";imps:list[imp_ct(lct:"_BaseColorMap";cc:4;chan:"RGBA";avchan:"RGBA";guid:"7adb1559-a191-4787-9768-9c022f88519e";op:Multiply;lbl:"Albedo";gpu_inst:False;dots_inst:False;locked:False;impl_index:-1)];layers:list[];unlocked:list[];layer_blend:dict[];custom_blend:dict[];clones:dict[];isClone:False),sp(name:"Main Color";imps:list[imp_ct(lct:"_BaseColor";cc:4;chan:"RGBA";avchan:"RGBA";guid:"a7712ece-26cf-4377-b4d5-29f48159f433";op:Multiply;lbl:"Color";gpu_inst:False;dots_inst:False;locked:False;impl_index:-1)];layers:list[];unlocked:list[];layer_blend:dict[];custom_blend:dict[];clones:dict[];isClone:False)];customTextures:list[ct(cimp:imp_mp_color(def:RGBA(1, 1, 1, 1);hdr:False;cc:4;chan:"RGBA";prop:"_BaseColor";md:"";gbv:False;custom:True;refs:"Albedo, Main Color";pnlock:False;guid:"46121171-6ffb-47b2-b644-6bdfe05fb06d";op:Multiply;lbl:"Color";gpu_inst:False;dots_inst:False;locked:False;impl_index:-1);exp:True;uv_exp:False;imp_lbl:"Color"),ct(cimp:imp_mp_vector(def:(0, 0, 0, 0);fp:float;cc:4;chan:"XYZW";prop:"_UVBase";md:"";gbv:False;custom:True;refs:"";pnlock:False;guid:"c1ec6c1b-f616-4e53-9d91-920a72964238";op:Multiply;lbl:"UVBase";gpu_inst:False;dots_inst:False;locked:False;impl_index:-1);exp:True;uv_exp:False;imp_lbl:"Vector"),ct(cimp:imp_mp_texture(uto:False;tov:"";tov_lbl:"";gto:False;sbt:False;scr:False;scv:"";scv_lbl:"";gsc:False;roff:False;goff:False;sin_anm:False;sin_anmv:"";sin_anmv_lbl:"";gsin:False;notile:False;triplanar_local:False;def:"white";locked_uv:False;uv:0;cc:4;chan:"RGBA";mip:0;mipprop:False;ssuv_vert:False;ssuv_obj:False;uv_type:Texcoord;uv_chan:"XZ";tpln_scale:1;uv_shaderproperty:__NULL__;uv_cmp:"_UVBase";sep_sampler:__NULL__;prop:"_BaseColorMap";md:"";gbv:False;custom:True;refs:"";pnlock:False;guid:"29456f6e-55ad-40aa-8fbe-5b16931b2740";op:Multiply;lbl:"Color Map";gpu_inst:False;dots_inst:False;locked:False;impl_index:-1);exp:True;uv_exp:False;imp_lbl:"Texture")];codeInjection:codeInjection(injectedFiles:list[];mark:False);matLayers:list[ml(uid:"ce3cca";name:"Material Layer";src:sp(name:"layer_ce3cca";imps:list[imp_mp_texture(uto:False;tov:"";tov_lbl:"";gto:False;sbt:False;scr:False;scv:"";scv_lbl:"";gsc:False;roff:False;goff:False;sin_anm:False;sin_anmv:"";sin_anmv_lbl:"";gsin:False;notile:False;triplanar_local:False;def:"white";locked_uv:False;uv:0;cc:1;chan:"R";mip:-1;mipprop:False;ssuv_vert:False;ssuv_obj:False;uv_type:Texcoord;uv_chan:"XZ";tpln_scale:1;uv_shaderproperty:__NULL__;uv_cmp:__NULL__;sep_sampler:__NULL__;prop:"_layer_ce3cca";md:"";gbv:False;custom:False;refs:"";pnlock:False;guid:"056fa07b-c18b-4168-afa1-fcb01cd96625";op:Multiply;lbl:"Source Texture";gpu_inst:False;dots_inst:False;locked:False;impl_index:-1)];layers:list[];unlocked:list[];layer_blend:dict[];custom_blend:dict[];clones:dict[];isClone:False);use_contrast:False;ctrst:__NULL__;use_noise:False;noise:__NULL__)]) */
|
||||
/* TCP_HASH 213f2ac28bf85b513dd146815a1b9c4a */
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0327dc75d6819d949942e18f52b16935
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures:
|
||||
- _NoTileNoiseTex: {fileID: 2800000, guid: af5515bfe14f1af4a9b8b3bf306b9261, type: 3}
|
||||
- _Ramp: {fileID: 2800000, guid: ccad9b0732473ee4e95de81e50e9050f, type: 3}
|
||||
- _DitherTex: {fileID: 2800000, guid: f059f76a52d0b374c85c681ed571185e, type: 3}
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -119,7 +119,7 @@ Material:
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 1.1290407, g: 1.0093257, b: 0.82547784, a: 1}
|
||||
- _EmissionColor: {r: 5.376503, g: 1.3900176, b: 0.68474334, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
|
||||
8
Assets/Plugins/HTraceSSGI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 772a801e4d7875842bc2f6e62abe5777
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Plugins/HTraceSSGI/HTraceSSGI Quick-Start Manual.pdf
Normal file
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dbec97f308251d742b13d987ef881cbc
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/HTraceSSGI Quick-Start Manual.pdf
|
||||
uploadId: 840002
|
||||
24
Assets/Plugins/HTraceSSGI/HTraceSSGI.asmdef
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "HTraceSSGI",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:3eae0364be2026648bf74846acb8a731",
|
||||
"GUID:78bd2ddd6e276394a9615c203e574844",
|
||||
"GUID:c579267770062bf448e75eb160330b7f",
|
||||
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
|
||||
"GUID:457756d89b35d2941b3e7b37b4ece6f1",
|
||||
"GUID:15fc0a57446b3144c949da3e2b9737a9",
|
||||
"GUID:b4517ec124862cb4bb3b8b27d72843a6",
|
||||
"GUID:ab67fb10353d84448ac887a7367cbda8",
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
10
Assets/Plugins/HTraceSSGI/HTraceSSGI.asmdef.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c83bdcd2d30ce80428fffd5ed2cb670f
|
||||
timeCreated: 1674796741
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/HTraceSSGI.asmdef
|
||||
uploadId: 840002
|
||||
8
Assets/Plugins/HTraceSSGI/Icons.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e68f1575a717afb4f9f5b0a24029a1ae
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Plugins/HTraceSSGI/Icons/HTrace SSGI Icon.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
124
Assets/Plugins/HTraceSSGI/Icons/HTrace SSGI Icon.png.meta
Normal file
@@ -0,0 +1,124 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72a9ca4a910cb6e478e3b0b89afa0b3c
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 2
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
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: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 128
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Icons/HTrace SSGI Icon.png
|
||||
uploadId: 840002
|
||||
8
Assets/Plugins/HTraceSSGI/Icons/Resources.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 079947b8551f06a49aefeee0ac313b52
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Plugins/HTraceSSGI/Icons/Resources/SSGI UI Card.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
124
Assets/Plugins/HTraceSSGI/Icons/Resources/SSGI UI Card.png.meta
Normal file
@@ -0,0 +1,124 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 794f3cf37bffa5b489c41a10a9f65492
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 1
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 2
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
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: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Icons/Resources/SSGI UI Card.png
|
||||
uploadId: 840002
|
||||
8
Assets/Plugins/HTraceSSGI/Resources.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd0d146c752f0f7489f7995e5e5499c9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Plugins/HTraceSSGI/Resources/HTraceSSGI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 263aa0d227a83dc4ca6c2fc4192f02d2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ee20b6f611369444acf19533acf34bb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 64 KiB |
@@ -0,0 +1,137 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d136d460c5b2faa48b1da6098c1362ca
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
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: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/BlueNoise/OwenScrambledNoise256.png
|
||||
uploadId: 840002
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,137 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7708504b58552e441af54534c7810c94
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
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: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/BlueNoise/OwenScrambledNoise4.png
|
||||
uploadId: 840002
|
||||
|
After Width: | Height: | Size: 96 B |
@@ -0,0 +1,137 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93b82a938a7bec34687ba2936e9c867c
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
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: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/BlueNoise/RankingTile1SPP.png
|
||||
uploadId: 840002
|
||||
|
After Width: | Height: | Size: 84 KiB |
@@ -0,0 +1,137 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d193765922195249804503e5bf21bde
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
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: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/BlueNoise/RankingTile256SPP.png
|
||||
uploadId: 840002
|
||||
|
After Width: | Height: | Size: 29 KiB |
@@ -0,0 +1,137 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cf78bccf8ab83042806476d7947fd9a
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
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: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/BlueNoise/RankingTile8SPP.png
|
||||
uploadId: 840002
|
||||
|
After Width: | Height: | Size: 151 KiB |
@@ -0,0 +1,137 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95d6a0e569139f84fbe6573d9a4909f7
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
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: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/BlueNoise/ScrambleNoise.png
|
||||
uploadId: 840002
|
||||
|
After Width: | Height: | Size: 129 KiB |
@@ -0,0 +1,137 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e89ef6da80edf7408080313796a85df
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
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: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/BlueNoise/ScramblingTile1SPP.png
|
||||
uploadId: 840002
|
||||
|
After Width: | Height: | Size: 129 KiB |
@@ -0,0 +1,137 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21a227d96560f5e4eba8df75749c0d41
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
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: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/BlueNoise/ScramblingTile256SPP.png
|
||||
uploadId: 840002
|
||||
|
After Width: | Height: | Size: 129 KiB |
@@ -0,0 +1,137 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 447e554854bca1d4e822e506707c9f40
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
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
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
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: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/BlueNoise/ScramblingTile8SPP.png
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41620bce39125404eae8bf1b7d1dd7d9
|
||||
timeCreated: 1724756783
|
||||
@@ -0,0 +1,85 @@
|
||||
#pragma kernel CheckerboardClassification
|
||||
#pragma kernel IndirectArguments
|
||||
|
||||
#include "../Includes/HCommonSSGI.hlsl"
|
||||
#pragma multi_compile _ _GBUFFER_NORMALS_OCT
|
||||
|
||||
H_TEXTURE(_SampleCount);
|
||||
|
||||
RWStructuredBuffer<uint> _RayCounter;
|
||||
RWStructuredBuffer<uint> _RayCounter_Output;
|
||||
RWStructuredBuffer<uint2> _IndirectCoords_Output;
|
||||
RWStructuredBuffer<uint> _IndirectArguments_Output;
|
||||
|
||||
uint _RayTracedCounter;
|
||||
|
||||
groupshared uint SharedRayAllocator;
|
||||
groupshared uint SharedAllocationStartOffset;
|
||||
groupshared uint2 SharedAllocatedRays[8 * 8];
|
||||
|
||||
|
||||
// ------------------------ CHECKERBOARD CLASSIFICATION -------------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void CheckerboardClassification(uint3 pixCoord : SV_DispatchThreadID, uint2 groupThreadID : SV_GroupThreadID, uint groupIndex : SV_GroupIndex, uint2 groupID : SV_GroupID)
|
||||
{
|
||||
|
||||
if (groupIndex == 0) SharedRayAllocator = 0;
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
uint IndirectCoordOffsetVR = _ScreenSize.x * _ScreenSize.y * pixCoord.z / _HScaleFactorSSGI;
|
||||
uint RayCounterOffsetVR = 2 * pixCoord.z;
|
||||
|
||||
float Samplecount = H_LOAD(_SampleCount, pixCoord.xy).x;
|
||||
|
||||
bool CullCheckerboard = false;
|
||||
if (((pixCoord.x + pixCoord.y) % 2 == 0 && uint(_FrameCount) % 2 == 0) || Samplecount <= 1)
|
||||
CullCheckerboard = true;
|
||||
if (((pixCoord.x + pixCoord.y) % 2 != 0 && uint(_FrameCount) % 2 != 0) || Samplecount <= 1)
|
||||
CullCheckerboard = true;
|
||||
|
||||
if (CullCheckerboard)
|
||||
{
|
||||
// uint Index = 0;
|
||||
// InterlockedAdd(_RayCounter_Output[0 + RayCounterOffsetVR], 1, Index);
|
||||
// _IndirectCoords_Output[Index + IndirectCoordOffsetVR] = pixCoord.xy;
|
||||
|
||||
uint SharedTexelOffset;
|
||||
InterlockedAdd(SharedRayAllocator, 1, SharedTexelOffset);
|
||||
SharedAllocatedRays[SharedTexelOffset] = pixCoord.xy;
|
||||
}
|
||||
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
uint ThreadIndex = groupThreadID.y * 8 + groupThreadID.x;
|
||||
|
||||
if (ThreadIndex == 0)
|
||||
{
|
||||
InterlockedAdd(_RayCounter_Output[0 + RayCounterOffsetVR], SharedRayAllocator, SharedAllocationStartOffset);
|
||||
}
|
||||
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
if (ThreadIndex < SharedRayAllocator)
|
||||
{
|
||||
_IndirectCoords_Output[SharedAllocationStartOffset + ThreadIndex + IndirectCoordOffsetVR] = SharedAllocatedRays[ThreadIndex];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ INDIRECT ARGUMENTS GENERATION -------------------------
|
||||
[numthreads(1, 1, 1)]
|
||||
void IndirectArguments(uint3 pixCoord : SV_DispatchThreadID, uint2 groupThreadID : SV_GroupThreadID, uint2 groupID : SV_GroupID)
|
||||
{
|
||||
|
||||
uint IndirectArgumentsOffsetVR = 3 * pixCoord.z;
|
||||
uint RayCounterOffsetVR = 2 * pixCoord.z;
|
||||
|
||||
uint RayCounterBuffer = _RayCounter[0 + RayCounterOffsetVR];
|
||||
|
||||
_IndirectArguments_Output[0 + IndirectArgumentsOffsetVR] = (RayCounterBuffer + 63) / 64;
|
||||
_IndirectArguments_Output[1 + IndirectArgumentsOffsetVR] = 1;
|
||||
_IndirectArguments_Output[2 + IndirectArgumentsOffsetVR] = 1;
|
||||
|
||||
_RayCounter[0 + RayCounterOffsetVR] = 0;
|
||||
_RayCounter[1 + RayCounterOffsetVR] = RayCounterBuffer;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 412aeb9af3abb33439c8084a878f56c2
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Computes/HCheckerboardingSSGI.compute
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,116 @@
|
||||
#pragma kernel Debug
|
||||
|
||||
#include "../Includes/HCommonSSGI.hlsl"
|
||||
#include "../Includes/HFallbackSSGI.hlsl"
|
||||
#pragma multi_compile _ _GBUFFER_NORMALS_OCT
|
||||
|
||||
H_TEXTURE(_SampleCountSSGI);
|
||||
H_TEXTURE(_HTraceBufferGI);
|
||||
|
||||
H_RW_TEXTURE(float4, _Debug_Output);
|
||||
|
||||
uint _DebugSwitch;
|
||||
uint _BuffersSwitch;
|
||||
float _IndirectLightingIntensity;
|
||||
|
||||
void DebugFinal(uint3 pixCoord)
|
||||
{
|
||||
if (_DebugSwitch == 1)
|
||||
{
|
||||
if (_BuffersSwitch == 0) // Multi
|
||||
{
|
||||
uint2 AuadSize = _ScreenSize.xy / 2;
|
||||
uint2 AuadIndex = pixCoord.xy / AuadSize; // (0,0), (1,0), (0,1), (1,1)
|
||||
uint2 LocalCoord = pixCoord.xy % AuadSize;
|
||||
uint2 SampleCoord = LocalCoord * 2;
|
||||
|
||||
float4 Output = float4(0, 0, 0, 1);
|
||||
|
||||
if (HBUFFER_DEPTH(SampleCoord.xy) <= UNITY_RAW_FAR_CLIP_VALUE)
|
||||
{
|
||||
_Debug_Output[H_COORD(pixCoord.xy)] = Output;
|
||||
return;
|
||||
}
|
||||
|
||||
if (AuadIndex.x == 0 && AuadIndex.y == 0) // Bottom Left
|
||||
{
|
||||
Output = float4(HBUFFER_NORMAL_WS(SampleCoord).xyz, 1);
|
||||
}
|
||||
else if (AuadIndex.x == 1 && AuadIndex.y == 0) // Bottom Right
|
||||
{
|
||||
float2 motionVector = HBUFFER_MOTION_VECTOR(SampleCoord).xy;
|
||||
float motionMask = HBUFFER_MOTION_MASK(SampleCoord).x;
|
||||
Output = float4(motionVector * 5, motionMask * 0.05, 1);
|
||||
}
|
||||
else if (AuadIndex.x == 0 && AuadIndex.y == 1) // Top Left
|
||||
{
|
||||
Output = float4(H_LINEAR_EYE_DEPTH(H_LOAD(g_HTraceDepthPyramidSSGI, SampleCoord).x).xxx / 20.0f, 1);
|
||||
}
|
||||
else if (AuadIndex.x == 1 && AuadIndex.y == 1) // Top Right
|
||||
{
|
||||
Output = float4(HBUFFER_DIFFUSE(SampleCoord).xyz, 1);
|
||||
}
|
||||
|
||||
_Debug_Output[H_COORD(pixCoord.xy)] = Output;
|
||||
return;
|
||||
}
|
||||
|
||||
if (HBUFFER_DEPTH(pixCoord.xy) <= UNITY_RAW_FAR_CLIP_VALUE)
|
||||
{
|
||||
_Debug_Output[H_COORD(pixCoord.xy)] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_BuffersSwitch == 1) // Depth
|
||||
{
|
||||
_Debug_Output[H_COORD(pixCoord.xy)] = float4(H_LINEAR_EYE_DEPTH(H_LOAD(g_HTraceDepthPyramidSSGI, pixCoord.xy).x).xxx / 20.0f, 1);
|
||||
}
|
||||
if (_BuffersSwitch == 2) // Diffuse
|
||||
{
|
||||
_Debug_Output[H_COORD(pixCoord.xy)] = float4(HBUFFER_DIFFUSE(pixCoord.xy).xyz, 1);
|
||||
}
|
||||
if (_BuffersSwitch == 3) // Normal
|
||||
{
|
||||
_Debug_Output[H_COORD(pixCoord.xy)] = float4(HBUFFER_NORMAL_WS(pixCoord.xy).xyz, 1);
|
||||
}
|
||||
if (_BuffersSwitch == 4) // Motion Mask
|
||||
{
|
||||
_Debug_Output[H_COORD(pixCoord.xy)] = float4(HBUFFER_MOTION_MASK(pixCoord.xy).xxx, 1);
|
||||
}
|
||||
if (_BuffersSwitch == 5) // Motion Vectors
|
||||
{
|
||||
_Debug_Output[H_COORD(pixCoord.xy)] = float4(HBUFFER_MOTION_VECTOR(pixCoord.xy).xy * 5, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (HBUFFER_DEPTH(pixCoord.xy) <= UNITY_RAW_FAR_CLIP_VALUE)
|
||||
{
|
||||
float3 Sky = 0;
|
||||
if (_DebugSwitch == 2)
|
||||
Sky = EvaluateFallbackSky(H_GET_VIEW_VECTOR_WS((pixCoord.xy + 0.5f) * _ScreenSize.zw));
|
||||
|
||||
_Debug_Output[H_COORD(pixCoord.xy)] = float4(Sky, 1);
|
||||
return;
|
||||
}
|
||||
if (_DebugSwitch == 2)
|
||||
{
|
||||
_Debug_Output[H_COORD(pixCoord.xy)] = HBUFFER_COLOR(pixCoord.xy);
|
||||
}
|
||||
if (_DebugSwitch == 3)
|
||||
{
|
||||
_Debug_Output[H_COORD(pixCoord.xy)] = H_LOAD(_HTraceBufferGI, pixCoord.xy) * _IndirectLightingIntensity;
|
||||
}
|
||||
if (_DebugSwitch == 4)
|
||||
{
|
||||
float Samplecount = H_LOAD(_SampleCountSSGI, pixCoord.xy / _HScaleFactorSSGI).x;
|
||||
float3 Output = Samplecount < 1 ? float3(1,0,0) : Samplecount.xxx / 16.0f;
|
||||
_Debug_Output[H_COORD(pixCoord.xy)] = float4(Output, 1);
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(8, 8, 1)]
|
||||
void Debug(uint3 pixCoord : SV_DispatchThreadID)
|
||||
{
|
||||
|
||||
DebugFinal(pixCoord);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 163108b35413d864fa7afffcb87d9861
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Computes/HDebugSSGI.compute
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,343 @@
|
||||
#pragma kernel TemporalAccumulation
|
||||
#pragma kernel TemporalStabilization
|
||||
#pragma kernel PointDistributionFill
|
||||
#pragma kernel SpatialFilter
|
||||
|
||||
#pragma kernel SpatialFilter1 SpatialFilter = SpatialFilter1
|
||||
#pragma kernel SpatialFilter2 SpatialFilter = SpatialFilter2 SECOND_PASS
|
||||
|
||||
#include "../Includes/HReservoirSSGI.hlsl"
|
||||
#pragma multi_compile _ _GBUFFER_NORMALS_OCT
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl"
|
||||
|
||||
#pragma multi_compile _ USE_SPATIAL_OCCLUSION
|
||||
#pragma multi_compile _ USE_TEMPORAL_INVALIDITY
|
||||
#pragma multi_compile _ INTERPOLATION_OUTPUT
|
||||
|
||||
#define TEMPORAL_DENOISING_SAMPLECOUNT 16
|
||||
#define TEMPORAL_STABILIZATION_SAMPLECOUNT 16
|
||||
|
||||
H_TEXTURE(_Radiance);
|
||||
H_TEXTURE(_NormalDepth);
|
||||
H_TEXTURE(_AmbientOcclusion);
|
||||
H_TEXTURE(_SpatialGuidance);
|
||||
H_TEXTURE(_RadianceReprojected);
|
||||
H_TEXTURE(_TemporalInvalidity);
|
||||
H_TEXTURE(_SamplecountReprojected);
|
||||
H_TEXTURE(_SpatialOcclusion);
|
||||
|
||||
H_RW_TEXTURE(float4, _Radiance_TemporalOutput);
|
||||
H_RW_TEXTURE(float3, _Radiance_SpatialOutput);
|
||||
H_RW_TEXTURE(float3, _Radiance_Output);
|
||||
H_RW_TEXTURE(float, _Samplecount_Output);
|
||||
H_RW_TEXTURE(uint2, _RadianceNormalDepth_Output);
|
||||
|
||||
StructuredBuffer<float3> _PointDistribution;
|
||||
RWStructuredBuffer<float3> _PointDistribution_Output;
|
||||
|
||||
float _FilterRadius;
|
||||
float _FilterAdaptivity;
|
||||
|
||||
|
||||
// ------------------------ TEMPORAL FUNCTIONS -------------------------
|
||||
float3 DirectClipToAABB(float3 History, float3 Min, float3 Max)
|
||||
{
|
||||
float3 Center = 0.5 * (Max + Min);
|
||||
float3 Extents = 0.5 * (Max - Min);
|
||||
|
||||
float3 Offset = History - Center;
|
||||
float3 Vunit = Offset.xyz / Extents.xyz;
|
||||
float3 AbsUnit = abs(Vunit);
|
||||
float MaxUnit = max(max(AbsUnit.x, AbsUnit.y), AbsUnit.z);
|
||||
|
||||
if (MaxUnit > 1.0) return Center + (Offset / MaxUnit);
|
||||
else return History;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ POINT DISTRIBUTION BUFFER --------------------
|
||||
[numthreads(128, 1, 1)]
|
||||
void PointDistributionFill(uint pixCoord : SV_DispatchThreadID)
|
||||
{
|
||||
// _PointDistribution_Output[pixCoord.x] = HSampleDiskCubic(GetLDSequenceSampleFloat(pixCoord.x, 0), GetLDSequenceSampleFloat(pixCoord.x, 1));
|
||||
|
||||
static const float3 k_PoissonDiskSamples[8] =
|
||||
{
|
||||
// https://www.desmos.com/calculator/abaqyvswem
|
||||
float3( -1.00 , 0.00 , 1.0 ),
|
||||
float3( 0.00 , 1.00 , 1.0 ),
|
||||
float3( 1.00 , 0.00 , 1.0 ),
|
||||
float3( 0.00 , -1.00 , 1.0 ),
|
||||
float3( -0.25 * sqrt(2.0) , 0.25 * sqrt(2.0) , 0.5 ),
|
||||
float3( 0.25 * sqrt(2.0) , 0.25 * sqrt(2.0) , 0.5 ),
|
||||
float3( 0.25 * sqrt(2.0) , -0.25 * sqrt(2.0) , 0.5 ),
|
||||
float3( -0.25 * sqrt(2.0) , -0.25 * sqrt(2.0) , 0.5 )
|
||||
};
|
||||
|
||||
int i = pixCoord;
|
||||
uint JitterIndex = (uint(_FrameCount) % 8) + i;
|
||||
float2 SampleJitter = SampleUnitDisk(JitterIndex) * 0.15;
|
||||
|
||||
// 8 offsets with jitter
|
||||
if (pixCoord.x < 8)
|
||||
{
|
||||
float3 Sample = k_PoissonDiskSamples[i];
|
||||
Sample.xy += SampleJitter;
|
||||
|
||||
_PointDistribution_Output[i] = Sample;
|
||||
}
|
||||
|
||||
// 8 offsets without jitter
|
||||
if (pixCoord.x >= 8 && pixCoord.x < 16)
|
||||
{
|
||||
_PointDistribution_Output[i] = k_PoissonDiskSamples[i - 8];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ TEMPORAL ACCUMULATION ------------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void TemporalAccumulation(uint3 pixCoord : SV_DispatchThreadID)
|
||||
{
|
||||
|
||||
float3 Radiance = H_LOAD(_Radiance, pixCoord.xy).xyz;
|
||||
float3 RadianceHistory = H_LOAD(_RadianceReprojected, pixCoord.xy).xyz;
|
||||
|
||||
float3 Moment1 = Radiance;
|
||||
float3 Moment2 = Radiance * Radiance;
|
||||
float WeightTotal = 1.0;
|
||||
|
||||
float CenterLuminance = Luminance(Radiance);
|
||||
float MaxLuma = -9999; float MinLuma = 9999;
|
||||
float3 MaxLumaSample, MinLumaSample;
|
||||
|
||||
const static int2 SampleOffsets[8] = {int2(1, 0), int2(0, 1), int2(-1, 0), int2(0, -1), int2(1, -1), int2(-1, 1), int2(-1, -1), int2(1, 1)};
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
int2 Offset = SampleOffsets[i];
|
||||
|
||||
float Weight = exp(-3.0 * float(Offset.x * Offset.x + Offset.y * Offset.y) / 4.0f);
|
||||
float3 Sample = H_LOAD(_Radiance, pixCoord.xy + Offset * 1).xyz;
|
||||
Moment1 += Sample * Weight;
|
||||
Moment2 += Sample * Sample * Weight;
|
||||
WeightTotal += Weight;
|
||||
|
||||
float SampleLuma = Luminance(Sample);
|
||||
if (MaxLuma < SampleLuma) { MaxLuma = SampleLuma; MaxLumaSample = Sample; }
|
||||
if (MinLuma > SampleLuma) { MinLuma = SampleLuma; MinLumaSample = Sample; }
|
||||
}
|
||||
|
||||
Moment1 /= WeightTotal;
|
||||
Moment2 /= WeightTotal;
|
||||
float3 StdDev = sqrt(max(0.0, Moment2 - Moment1 * Moment1));
|
||||
|
||||
float2 TemporalInvalidity = 1;
|
||||
if (USE_TEMPORAL_INVALIDITY)
|
||||
{
|
||||
TemporalInvalidity = H_LOAD(_TemporalInvalidity, pixCoord.xy).xy;
|
||||
TemporalInvalidity.x = pow(TemporalInvalidity.x, 5);
|
||||
TemporalInvalidity.y = TemporalInvalidity.y < 0.95f ? 0 : TemporalInvalidity.y;
|
||||
}
|
||||
|
||||
float ClampBoxSize = 0.5;
|
||||
float ClampBoxMultiplier = lerp(1, 5, TemporalInvalidity.x);
|
||||
float3 Min = lerp(Radiance, Moment1, ClampBoxSize * ClampBoxSize) - StdDev * ClampBoxSize * ClampBoxMultiplier;
|
||||
float3 Max = lerp(Radiance, Moment1, ClampBoxSize * ClampBoxSize) + StdDev * ClampBoxSize * ClampBoxMultiplier;
|
||||
|
||||
RadianceHistory = DirectClipToAABB(RadianceHistory, Min, Max);
|
||||
|
||||
float SamplecountReprojected = H_LOAD(_SamplecountReprojected, pixCoord.xy).x;
|
||||
float Samplecount = min(TEMPORAL_DENOISING_SAMPLECOUNT, SamplecountReprojected + 1);
|
||||
float TemporalWeight = 1.0f - (1.0f / float(Samplecount));
|
||||
|
||||
if (ENABLE_RCRS_FILTER)
|
||||
{
|
||||
if (CenterLuminance >= MinLuma && CenterLuminance <= MaxLuma) { Radiance = Radiance;}
|
||||
else if (CenterLuminance > MaxLuma) { Radiance = MaxLumaSample; }
|
||||
else { Radiance = MinLumaSample; }
|
||||
}
|
||||
|
||||
if (ENABLE_EXPOSURE_CONTROL)
|
||||
{
|
||||
float ExposurePrevious = HGetPreviousExposureMultiplier;
|
||||
float ExposureCurrent = HGetCurrentExposureMultiplier;
|
||||
|
||||
float ExposureRatio = (ExposurePrevious * ExposureCurrent) != 0.0 ? ExposureCurrent / ExposurePrevious : 100.0;
|
||||
|
||||
if (max(ExposureRatio, 1.0 / ExposureRatio) > 2.0)
|
||||
TemporalWeight = 0;
|
||||
}
|
||||
|
||||
Radiance = lerp(Radiance, RadianceHistory, TemporalWeight * TemporalInvalidity.y * ENABLE_TEMPORAL_DENOISING);
|
||||
|
||||
_Radiance_TemporalOutput[H_COORD(pixCoord.xy)] = float4(Radiance, 0);
|
||||
_Radiance_SpatialOutput[H_COORD(pixCoord.xy)] = Radiance;
|
||||
_Samplecount_Output[H_COORD(pixCoord.xy)] = Samplecount;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ TEMPORAL STABILIZATION ------------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void TemporalStabilization(uint3 pixCoord : SV_DispatchThreadID)
|
||||
{
|
||||
|
||||
float3 Radiance = H_LOAD(_Radiance, pixCoord.xy).xyz;
|
||||
float4 RadianceSamplecountHistory = H_LOAD(_RadianceReprojected, pixCoord.xy);
|
||||
|
||||
float3 Moment1 = Radiance;
|
||||
float3 Moment2 = Radiance * Radiance;
|
||||
float WeightTotal = 1.0;
|
||||
|
||||
const static int2 SampleOffsets[8] = {int2(1, 0), int2(0, 1), int2(-1, 0), int2(0, -1), int2(1, -1), int2(-1, 1), int2(-1, -1), int2(1, 1)};
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
int2 Offset = SampleOffsets[i];
|
||||
|
||||
float Weight = exp(-3.0 * float(Offset.x * Offset.x + Offset.y * Offset.y) / 4.0f);
|
||||
float3 Sample = H_LOAD(_Radiance, pixCoord.xy + Offset * 1).xyz;
|
||||
Moment1 += Sample * Weight;
|
||||
Moment2 += Sample * Sample * Weight;
|
||||
WeightTotal += Weight;
|
||||
}
|
||||
|
||||
Moment1 /= WeightTotal;
|
||||
Moment2 /= WeightTotal;
|
||||
float3 StdDev = sqrt(max(0.0, Moment2 - Moment1 * Moment1));
|
||||
|
||||
float2 TemporalInvalidity = 1;
|
||||
if (USE_TEMPORAL_INVALIDITY)
|
||||
{
|
||||
TemporalInvalidity = H_LOAD(_TemporalInvalidity, pixCoord.xy / _HScaleFactorSSGI).xy;
|
||||
TemporalInvalidity.x = pow(TemporalInvalidity.x, 5);
|
||||
TemporalInvalidity.y = TemporalInvalidity.y < 0.95f ? 0 : TemporalInvalidity.y;
|
||||
}
|
||||
|
||||
float ClampBoxSize = 0.5;
|
||||
float ClampBoxMultiplier = lerp(3, 6, TemporalInvalidity.x * 2);
|
||||
float3 Min = lerp(Radiance, Moment1, ClampBoxSize * ClampBoxSize) - StdDev * ClampBoxSize * ClampBoxMultiplier;
|
||||
float3 Max = lerp(Radiance, Moment1, ClampBoxSize * ClampBoxSize) + StdDev * ClampBoxSize * ClampBoxMultiplier;
|
||||
|
||||
RadianceSamplecountHistory.xyz = DirectClipToAABB(RadianceSamplecountHistory.xyz, Min, Max);
|
||||
|
||||
float Samplecount = min(TEMPORAL_STABILIZATION_SAMPLECOUNT, RadianceSamplecountHistory.w + 1);
|
||||
float TemporalWeight = 1.0f - (1.0f / float(Samplecount));
|
||||
|
||||
if (ENABLE_EXPOSURE_CONTROL)
|
||||
{
|
||||
float ExposurePrevious = HGetPreviousExposureMultiplier;
|
||||
float ExposureCurrent = HGetCurrentExposureMultiplier;
|
||||
|
||||
float ExposureRatio = (ExposurePrevious * ExposureCurrent) != 0.0 ? ExposureCurrent / ExposurePrevious : 100.0;
|
||||
|
||||
if (max(ExposureRatio, 1.0 / ExposureRatio) > 2.0)
|
||||
TemporalWeight = 0;
|
||||
}
|
||||
|
||||
Radiance = lerp(Radiance, RadianceSamplecountHistory.xyz, TemporalWeight * TemporalInvalidity.y * ENABLE_TEMPORAL_STABILIZATION);
|
||||
|
||||
_Radiance_TemporalOutput[H_COORD(pixCoord.xy)] = float4(Radiance.xyz, Samplecount.x);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ SPATIAL FILTER ------------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void SpatialFilter(uint3 pixCoord : SV_DispatchThreadID)
|
||||
{
|
||||
|
||||
uint2 pixCoordUnscaled = GetUnscaledCoords(pixCoord.xy);
|
||||
int2 pixCoordMax = _ScreenSize.xy / _HScaleFactorSSGI.xx - 1;
|
||||
float2 pixCoordNDC = (float2(pixCoordUnscaled) + 0.5f) * _ScreenSize.zw;
|
||||
|
||||
uint NormalDepthPacked = asuint(H_LOAD(_NormalDepth, pixCoord.xy).x);
|
||||
float4 NormalDepth = UnpackNormalDepth(NormalDepthPacked);
|
||||
|
||||
if (NormalDepth.w <= UNITY_RAW_FAR_CLIP_VALUE) { return; }
|
||||
|
||||
float3 Radiance = H_LOAD(_Radiance, pixCoord.xy).xyz;
|
||||
Radiance = SpatialDenoisingTonemap(Radiance);
|
||||
|
||||
float DepthCetnerLinear = H_LINEAR_EYE_DEPTH(NormalDepth.w);
|
||||
float3 NormalCenterVS = H_TRANSFORM_WORLD_TO_VIEW_NORMAL(NormalDepth.xyz);
|
||||
float3 PositionCenterWS = H_COMPUTE_POSITION_WS(pixCoordNDC, NormalDepth.w, H_MATRIX_I_VP);
|
||||
float3 PositionCenterVS = ComputeFastViewSpacePosition(pixCoordNDC, NormalDepth.w, DepthCetnerLinear);
|
||||
float4 NormalPlaneVS = float4(NormalCenterVS.xyz, dot(PositionCenterVS, NormalCenterVS.xyz));
|
||||
float SpatialOcclusionCenter = H_LOAD(_SpatialOcclusion, pixCoord.xy).x;
|
||||
|
||||
uint2 SpatialGuidancePacked = asuint(H_LOAD(_SpatialGuidance, pixCoord.xy).xy);
|
||||
float AdaptiveFilterScale = UnpackAmbientOcclusion(SpatialGuidancePacked.y);
|
||||
float AdaptivePlaneWeight = lerp(500.0f, 100.0f, AdaptiveFilterScale);
|
||||
uint SpatialGuidance = SpatialGuidancePacked.x;
|
||||
|
||||
float FilterRadius = _FilterRadius / 2.0f;
|
||||
#ifdef SECOND_PASS
|
||||
FilterRadius = _FilterRadius;
|
||||
#endif
|
||||
|
||||
float MinFilterRadius = lerp(0.01f, 0.1f, H_LOAD(_AmbientOcclusion, pixCoord.xy).x);
|
||||
FilterRadius = max(MinFilterRadius, lerp(FilterRadius, FilterRadius * AdaptiveFilterScale, _FilterAdaptivity));
|
||||
|
||||
float DistanceToPoint = length(H_GET_ABSOLUTE_POSITION_WS(PositionCenterWS) - H_GET_CAMERA_POSITION_WS());
|
||||
float3x3 OrthoBasis = HGetLocalFrame(NormalDepth.xyz);
|
||||
float RadiusScale = lerp(5.0f, 50.0f, saturate(DistanceToPoint / 500.0f));
|
||||
float Radius = DistanceToPoint * FilterRadius / RadiusScale;
|
||||
float Sigma = 0.9f * Radius;
|
||||
|
||||
float WeightAccumulated = 1;
|
||||
|
||||
float2 PerPixelJitter;
|
||||
PerPixelJitter.x = HInterleavedGradientNoise(pixCoord.xy, 0);
|
||||
PerPixelJitter.y = HInterleavedGradientNoise(pixCoord.yx, 1);
|
||||
PerPixelJitter = (PerPixelJitter * 2 - 1) * 0.15;
|
||||
|
||||
UNITY_UNROLL
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
float GuidanceAdaptivity = 1 - (0.75 * ((SpatialGuidance >> i) & 0x1));
|
||||
float2 Point = (_PointDistribution[i + 8].xy + PerPixelJitter) * Radius * GuidanceAdaptivity;
|
||||
|
||||
float3 PositionPointWS = PositionCenterWS + OrthoBasis[0] * Point.x + OrthoBasis[1] * Point.y;
|
||||
float2 SampleCoordNDC = H_COMPUTE_NDC_Z(PositionPointWS, H_MATRIX_VP).xy;
|
||||
int2 SampleCoord = SampleCoordNDC * _ScreenSize.xy / _HScaleFactorSSGI;
|
||||
|
||||
int2 Overshoot = max(SampleCoord - pixCoordMax, 0);
|
||||
SampleCoord -= 2 * Overshoot;
|
||||
|
||||
uint NormalDepthPacked = asuint(H_LOAD(_NormalDepth, SampleCoord).x);
|
||||
float4 NormalDepthSample = UnpackNormalDepth(NormalDepthPacked);
|
||||
float SpatialOcclusionSample = H_LOAD(_SpatialOcclusion, SampleCoord).x;
|
||||
|
||||
float3 PositionSampleVS = ComputeFastViewSpacePosition(SampleCoordNDC, NormalDepthSample.w, H_LINEAR_EYE_DEPTH(NormalDepthSample.w));
|
||||
float PlaneWeight = ProbePlaneWeighting(NormalPlaneVS, PositionSampleVS, DepthCetnerLinear, AdaptivePlaneWeight);
|
||||
|
||||
float NormalWeight = saturate(dot(NormalDepth.xyz, NormalDepthSample.xyz));
|
||||
float GaussianWeight = GaussianWeighting(length(Point), Sigma);
|
||||
float OcclusionWeight = 1.0f;
|
||||
|
||||
if (USE_SPATIAL_OCCLUSION)
|
||||
{ OcclusionWeight = exp2(-max(5, 10 * (1 - SpatialOcclusionCenter)) * abs(SpatialOcclusionCenter - SpatialOcclusionSample)); }
|
||||
|
||||
float SampleWeight = NormalWeight * PlaneWeight * OcclusionWeight * GaussianWeight * ENABLE_SPATIAL_DENOISING;
|
||||
WeightAccumulated += SampleWeight;
|
||||
|
||||
float3 RadianceSample = H_LOAD(_Radiance, SampleCoord).xyz;
|
||||
RadianceSample = SpatialDenoisingTonemap(RadianceSample);
|
||||
Radiance += RadianceSample * SampleWeight;
|
||||
}
|
||||
|
||||
Radiance /= WeightAccumulated;
|
||||
Radiance = SpatialDenoisingTonemapInverse(Radiance);
|
||||
|
||||
if (AnyIsNaN(Radiance) || AnyIsInf(Radiance))
|
||||
Radiance = 0;
|
||||
|
||||
// Radiance = AdaptiveFilterScale;
|
||||
|
||||
#if SECOND_PASS
|
||||
if (INTERPOLATION_OUTPUT) _RadianceNormalDepth_Output[H_COORD(pixCoord.xy)] = uint2(PackToR11G11B10f(Radiance), PackNormalDepth(NormalDepth.xyz, NormalDepth.w));
|
||||
else _Radiance_Output[H_COORD(pixCoord.xy)] = Radiance;
|
||||
#else
|
||||
_Radiance_Output[H_COORD(pixCoord.xy)] = Radiance;
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e9dcd36d21eeca4a93de42f47c188ce
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Computes/HDenoiserSSGI.compute
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,115 @@
|
||||
#pragma kernel GenerateDepthPyramid
|
||||
|
||||
#include "../Includes/HCommonSSGI.hlsl"
|
||||
|
||||
H_RW_TEXTURE(float, _DepthPyramid_OutputMIP0);
|
||||
H_RW_TEXTURE(float, _DepthPyramid_OutputMIP1);
|
||||
H_RW_TEXTURE(float, _DepthPyramid_OutputMIP2);
|
||||
H_RW_TEXTURE(float, _DepthPyramid_OutputMIP3);
|
||||
H_RW_TEXTURE(float, _DepthPyramid_OutputMIP4);
|
||||
|
||||
groupshared float MipDepthLDS[8][8];
|
||||
|
||||
float DepthFilter(float4 DepthSamples)
|
||||
{
|
||||
float DepthFiltered = 0;
|
||||
|
||||
// Change filtering to max near sky pixels, to grab more skylight
|
||||
if (any(DepthSamples <= 0))
|
||||
DepthFiltered = max(max(DepthSamples.x, DepthSamples.y), max(DepthSamples.z, DepthSamples.w));
|
||||
|
||||
DepthFiltered = min(min(DepthSamples.x, DepthSamples.y), min(DepthSamples.z, DepthSamples.w));
|
||||
|
||||
return DepthFiltered;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ MIP LEVEL 0-4 GENERATIONS ------------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void GenerateDepthPyramid(uint3 pixCoord : SV_DispatchThreadID, uint2 groupThreadID : SV_GroupThreadID)
|
||||
{
|
||||
|
||||
const uint2 originalCoord = pixCoord.xy;
|
||||
pixCoord *= 2;
|
||||
|
||||
float4 Depth;
|
||||
Depth.x = any(pixCoord.xy + uint2(0,0) >= uint2(_ScreenSize.xy)) ? 0 : HBUFFER_DEPTH(pixCoord.xy + uint2(0,0)).x;
|
||||
Depth.y = any(pixCoord.xy + uint2(1,0) >= uint2(_ScreenSize.xy)) ? 0 : HBUFFER_DEPTH(pixCoord.xy + uint2(1,0)).x;
|
||||
Depth.z = any(pixCoord.xy + uint2(0,1) >= uint2(_ScreenSize.xy)) ? 0 : HBUFFER_DEPTH(pixCoord.xy + uint2(0,1)).x;
|
||||
Depth.w = any(pixCoord.xy + uint2(1,1) >= uint2(_ScreenSize.xy)) ? 0 : HBUFFER_DEPTH(pixCoord.xy + uint2(1,1)).x;
|
||||
|
||||
Depth.x = Depth.x >= 0.9999f ? 0 : Depth.x;
|
||||
Depth.y = Depth.y >= 0.9999f ? 0 : Depth.y;
|
||||
Depth.z = Depth.z >= 0.9999f ? 0 : Depth.z;
|
||||
Depth.w = Depth.w >= 0.9999f ? 0 : Depth.w;
|
||||
|
||||
if (HBUFFER_RENDER_LAYER_MASK(pixCoord.xy + uint2(0,0)) & _ExcludeCastingLayerMaskSSGI) Depth.x = -1;
|
||||
if (HBUFFER_RENDER_LAYER_MASK(pixCoord.xy + uint2(1,0)) & _ExcludeCastingLayerMaskSSGI) Depth.y = -1;
|
||||
if (HBUFFER_RENDER_LAYER_MASK(pixCoord.xy + uint2(0,1)) & _ExcludeCastingLayerMaskSSGI) Depth.z = -1;
|
||||
if (HBUFFER_RENDER_LAYER_MASK(pixCoord.xy + uint2(1,1)) & _ExcludeCastingLayerMaskSSGI) Depth.w = -1;
|
||||
|
||||
// Write to MIP0
|
||||
_DepthPyramid_OutputMIP0[H_COORD(pixCoord.xy + uint2(0, 0))] = Depth.x;
|
||||
_DepthPyramid_OutputMIP0[H_COORD(pixCoord.xy + uint2(1, 0))] = Depth.y;
|
||||
_DepthPyramid_OutputMIP0[H_COORD(pixCoord.xy + uint2(0, 1))] = Depth.z;
|
||||
_DepthPyramid_OutputMIP0[H_COORD(pixCoord.xy + uint2(1, 1))] = Depth.w;
|
||||
|
||||
float DepthMIP1 = DepthFilter(Depth.xyzw);
|
||||
|
||||
// Write to MIP1
|
||||
_DepthPyramid_OutputMIP1[H_COORD(originalCoord)] = DepthMIP1;
|
||||
|
||||
MipDepthLDS[groupThreadID.x][groupThreadID.y] = DepthMIP1;
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
// Write to MIP2
|
||||
[branch]
|
||||
if (all((groupThreadID.xy % int2(2, 2)) == 0))
|
||||
{
|
||||
float4 Depth;
|
||||
Depth.x = MipDepthLDS[groupThreadID.x + 0][groupThreadID.y + 0];
|
||||
Depth.y = MipDepthLDS[groupThreadID.x + 1][groupThreadID.y + 0];
|
||||
Depth.z = MipDepthLDS[groupThreadID.x + 0][groupThreadID.y + 1];
|
||||
Depth.w = MipDepthLDS[groupThreadID.x + 1][groupThreadID.y + 1];
|
||||
|
||||
float DepthMIP2 = DepthFilter(Depth.xyzw);
|
||||
|
||||
_DepthPyramid_OutputMIP2[H_COORD(originalCoord / 2)] = DepthMIP2;
|
||||
MipDepthLDS[groupThreadID.x][groupThreadID.y] = DepthMIP2;
|
||||
}
|
||||
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
// Write to MIP3
|
||||
[branch]
|
||||
if (all((groupThreadID.xy % int2(4, 4)) == 0))
|
||||
{
|
||||
float4 Depth;
|
||||
Depth.x = MipDepthLDS[groupThreadID.x + 0][groupThreadID.y + 0];
|
||||
Depth.y = MipDepthLDS[groupThreadID.x + 2][groupThreadID.y + 0];
|
||||
Depth.z = MipDepthLDS[groupThreadID.x + 0][groupThreadID.y + 2];
|
||||
Depth.w = MipDepthLDS[groupThreadID.x + 2][groupThreadID.y + 2];
|
||||
|
||||
float DepthMIP3 = DepthFilter(Depth.xyzw);
|
||||
|
||||
_DepthPyramid_OutputMIP3[H_COORD(originalCoord / 4)] = DepthMIP3;
|
||||
MipDepthLDS[groupThreadID.x][groupThreadID.y] = DepthMIP3;
|
||||
}
|
||||
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
// Write to MIP4
|
||||
[branch]
|
||||
if (all((groupThreadID.xy % int2(8, 8)) == 0))
|
||||
{
|
||||
float4 Depth;
|
||||
Depth.x = MipDepthLDS[groupThreadID.x + 0][groupThreadID.y + 0];
|
||||
Depth.y = MipDepthLDS[groupThreadID.x + 4][groupThreadID.y + 0];
|
||||
Depth.z = MipDepthLDS[groupThreadID.x + 0][groupThreadID.y + 4];
|
||||
Depth.w = MipDepthLDS[groupThreadID.x + 4][groupThreadID.y + 4];
|
||||
|
||||
float DepthMIP4 = DepthFilter(Depth.xyzw);
|
||||
|
||||
_DepthPyramid_OutputMIP4[H_COORD(originalCoord / 8)] = DepthMIP4;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 902b874ab8f513d4cbe65d1bfb2e9d24
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Computes/HDepthPyramid.compute
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,215 @@
|
||||
#pragma kernel Interpolation
|
||||
|
||||
#include "../Includes/HReservoirSSGI.hlsl"
|
||||
#pragma multi_compile _ _GBUFFER_NORMALS_OCT
|
||||
|
||||
#define INTERPOLATION_LANCZOS 0
|
||||
#define INTERPOLATION_SAMPLECOUNT 5
|
||||
#define NORMAL_REJECTION 1
|
||||
|
||||
H_TEXTURE(_RadianceNormalDepth);
|
||||
|
||||
H_RW_TEXTURE(float3, _Radiance_Output);
|
||||
H_RW_TEXTURE(uint, _NormalDepth_HistoryOutput);
|
||||
|
||||
|
||||
// ------------------------ INTERPOLATION STRUCTS -----------------------
|
||||
struct CenterPixelData
|
||||
{
|
||||
float4 Plane;
|
||||
float3 Normal;
|
||||
float DepthLinear;
|
||||
};
|
||||
|
||||
|
||||
// ------------------------ LANCZOS-SPECIFIC FUNCTIONS -------------------------
|
||||
float4 ProcessSample(float2 Offset, float4 DirectionLength, float2 LobeClip, float4 RadianceSample)
|
||||
{
|
||||
float2 RotatedOffset = float2(dot(Offset, DirectionLength.xy), dot(Offset, float2(-DirectionLength.y, DirectionLength.x))) * DirectionLength.zw;
|
||||
float DistanceDouble = min(dot(RotatedOffset, RotatedOffset), LobeClip.y);
|
||||
|
||||
float Window = 0.4 * DistanceDouble - 1.0;
|
||||
float Base = LobeClip.x * DistanceDouble - 1.0;
|
||||
Window *= Window;
|
||||
Base *= Base;
|
||||
Window = 1.5625 * Window - 0.5625;
|
||||
float Weight = Window * Base * RadianceSample.w;
|
||||
|
||||
float4 AccumulatedData;
|
||||
AccumulatedData.xyz = RadianceSample.xyz * Weight;
|
||||
AccumulatedData.w = Weight;
|
||||
|
||||
return AccumulatedData;
|
||||
}
|
||||
|
||||
|
||||
void GatherData(inout float2 Direction, inout float Length, float Weight, float SampleA, float SampleB, float SampleC, float SampleD, float SampleE)
|
||||
{
|
||||
float LengthX = max(abs(SampleD.x - SampleC.x), abs(SampleC.x - SampleB.x));
|
||||
float DirectionX = SampleD.x - SampleB.x;
|
||||
Direction.x += DirectionX * Weight;
|
||||
LengthX = clamp(abs(DirectionX)/ LengthX, 0.0, 1.0);
|
||||
LengthX *= LengthX;
|
||||
Length += LengthX * Weight;
|
||||
|
||||
float LengthY = max(abs(SampleE.x - SampleC.x), abs(SampleC.x - SampleA.x));
|
||||
float DirectionY = SampleE.x - SampleA.x;
|
||||
Direction.y += DirectionY * Weight;
|
||||
LengthY = clamp(abs(DirectionY) / LengthY, 0.0, 1.0);
|
||||
LengthY *= LengthY;
|
||||
Length += LengthY * Weight;
|
||||
}
|
||||
|
||||
|
||||
void AdaptiveLanczosData(float Samples[12], float2 PixelCoord, inout float4 DirLength, inout float2 LobeClip)
|
||||
{
|
||||
float Length = 0;
|
||||
float2 Direction = 0;
|
||||
GatherData(Direction, Length, (1.0 -PixelCoord.x) * (1.0 -PixelCoord.y), Samples[0], Samples[5], Samples[4], Samples[9], Samples[3]);
|
||||
GatherData(Direction, Length, PixelCoord.x * (1.0 -PixelCoord.y), Samples[1], Samples[4], Samples[9], Samples[8], Samples[6]);
|
||||
GatherData(Direction, Length, (1.0 -PixelCoord.x) * PixelCoord.y, Samples[4], Samples[2], Samples[3], Samples[6], Samples[11]);
|
||||
GatherData(Direction, Length, PixelCoord.x * PixelCoord.y, Samples[9], Samples[3], Samples[6], Samples[7], Samples[10]);
|
||||
|
||||
float2 DirectionDouble = Direction * Direction;
|
||||
float DirectionRadial = DirectionDouble.x + DirectionDouble.y;
|
||||
bool IsNearZero = DirectionRadial < (1.0 / 32768.0);
|
||||
DirectionRadial = rsqrt(DirectionRadial);
|
||||
DirectionRadial = IsNearZero ? 1.0 : DirectionRadial;
|
||||
Direction.x = IsNearZero ? 1.0 : Direction.x;
|
||||
Direction *= float2(DirectionRadial, DirectionRadial);
|
||||
Length = Length * 0.5;
|
||||
Length *= Length;
|
||||
|
||||
float Stretch = dot(Direction,Direction) / (max(abs(Direction.x), abs(Direction.y)));
|
||||
float2 LengthDouble = float2(1.0 + (Stretch -1.0) * Length, 1.0 - 0.5 * Length);
|
||||
float NegativeLobe = 0.5 - 0.29 * Length;
|
||||
float Clip = 1.0 / NegativeLobe;
|
||||
|
||||
DirLength = float4(Direction.xy, LengthDouble.xy);
|
||||
LobeClip = float2(NegativeLobe, Clip);
|
||||
}
|
||||
|
||||
|
||||
float4 InterpolationSample(CenterPixelData CenterData, int2 SampleCoord, inout float LumaSample)
|
||||
{
|
||||
uint2 RadianceNormalDepthPacked = asuint(H_LOAD(_RadianceNormalDepth, SampleCoord).xy);
|
||||
float3 RadianceSample = UnpackFromR11G11B10f(RadianceNormalDepthPacked.x);
|
||||
float4 NormalDepthSample = UnpackNormalDepth(RadianceNormalDepthPacked.y);
|
||||
|
||||
float3 WorldPos = ComputeFastViewSpacePosition((SampleCoord * _HScaleFactorSSGI + 0.5) / _ScreenSize.xy, NormalDepthSample.w, H_LINEAR_EYE_DEPTH(NormalDepthSample.w));
|
||||
float PlaneWeight = ProbePlaneWeighting(CenterData.Plane, WorldPos, CenterData.DepthLinear, 5000);
|
||||
float NormalWeight = 1;
|
||||
|
||||
if (NORMAL_REJECTION)
|
||||
NormalWeight = saturate(dot(CenterData.Normal, NormalDepthSample.xyz));
|
||||
|
||||
LumaSample = Luminance(RadianceSample) * PlaneWeight * NormalWeight;
|
||||
return float4(RadianceSample, PlaneWeight * NormalWeight);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ INTERPOLATION -----------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void Interpolation(uint3 pixCoord : SV_DispatchThreadID, uint groupIndex : SV_GroupIndex, uint groupID : SV_GroupID)
|
||||
{
|
||||
|
||||
const float DepthCenter = HBUFFER_DEPTH(pixCoord.xy).x;
|
||||
if (DepthCenter <= 1e-7) { return; }
|
||||
|
||||
const uint RadiancePacked = asuint(H_LOAD(_RadianceNormalDepth, floor(pixCoord.xy / _HScaleFactorSSGI)).x);
|
||||
float3 RadianceCenter = UnpackFromR11G11B10f(RadiancePacked);
|
||||
|
||||
const float3 NormalCenterWS = HBUFFER_NORMAL_WS(pixCoord.xy).xyz;
|
||||
const float3 NormalCenterVS = H_TRANSFORM_WORLD_TO_VIEW_NORMAL(NormalCenterWS);
|
||||
const float3 WorldPosCenter = ComputeFastViewSpacePosition((pixCoord.xy + 0.5f) * _ScreenSize.zw, DepthCenter, H_LINEAR_EYE_DEPTH(DepthCenter));
|
||||
const int2 SampleOffsets[9] = {int2(0, 0), int2(1, 0), int2(0, 1), int2(-1, 0), int2(0, -1), int2(1, -1), int2(-1, 1), int2(-1, -1), int2(1, 1)};
|
||||
|
||||
CenterPixelData CenterData;
|
||||
CenterData.Normal = NormalCenterWS;
|
||||
CenterData.Plane = float4(NormalCenterVS, dot(WorldPosCenter, NormalCenterVS));
|
||||
CenterData.DepthLinear = H_LINEAR_EYE_DEPTH(DepthCenter);
|
||||
|
||||
float3 InterpolatedRadiance = 0;
|
||||
uint Count = 0;
|
||||
|
||||
if (INTERPOLATION_LANCZOS)
|
||||
{
|
||||
float2 LanczosOffset = float2(pixCoord.xy) / _HScaleFactorSSGI; LanczosOffset -= floor(LanczosOffset);
|
||||
int2 LanczosOffsetRounded = -floor(LanczosOffset );
|
||||
int2 DownscaledRes = floor(pixCoord.xy / _HScaleFactorSSGI);
|
||||
|
||||
float4 Samples[12];
|
||||
float LumaSamples[12];
|
||||
|
||||
Samples[0] = InterpolationSample(CenterData, DownscaledRes + int2( 0,-1) + LanczosOffsetRounded, LumaSamples[0] );
|
||||
Samples[1] = InterpolationSample(CenterData, DownscaledRes + int2( 1,-1) + LanczosOffsetRounded, LumaSamples[1] );
|
||||
Samples[2] = InterpolationSample(CenterData, DownscaledRes + int2(-1, 1) + LanczosOffsetRounded, LumaSamples[2] );
|
||||
Samples[3] = InterpolationSample(CenterData, DownscaledRes + int2( 0, 1) + LanczosOffsetRounded, LumaSamples[3] );
|
||||
Samples[4] = InterpolationSample(CenterData, DownscaledRes + int2( 0, 0) + LanczosOffsetRounded, LumaSamples[4] );
|
||||
Samples[5] = InterpolationSample(CenterData, DownscaledRes + int2(-1, 0) + LanczosOffsetRounded, LumaSamples[5] );
|
||||
Samples[6] = InterpolationSample(CenterData, DownscaledRes + int2( 1, 1) + LanczosOffsetRounded, LumaSamples[6] );
|
||||
Samples[7] = InterpolationSample(CenterData, DownscaledRes + int2( 2, 1) + LanczosOffsetRounded, LumaSamples[7] );
|
||||
Samples[8] = InterpolationSample(CenterData, DownscaledRes + int2( 2, 0) + LanczosOffsetRounded, LumaSamples[8] );
|
||||
Samples[9] = InterpolationSample(CenterData, DownscaledRes + int2( 1, 0) + LanczosOffsetRounded, LumaSamples[9] );
|
||||
Samples[10] = InterpolationSample(CenterData, DownscaledRes + int2( 1, 2) + LanczosOffsetRounded, LumaSamples[10]);
|
||||
Samples[11] = InterpolationSample(CenterData, DownscaledRes + int2( 0, 2) + LanczosOffsetRounded, LumaSamples[11]);
|
||||
|
||||
float4 DirLength; float2 LobeClip;
|
||||
AdaptiveLanczosData(LumaSamples, LanczosOffset, DirLength, LobeClip);
|
||||
|
||||
float3 MinNeighbourhood = min(min(Samples[4].xyz, Samples[9].xyz), min(Samples[3].xyz, Samples[6].xyz));
|
||||
float3 MaxNeighbourhood = max(max(Samples[4].xyz, Samples[9].xyz), max(Samples[3].xyz, Samples[6].xyz));
|
||||
|
||||
float4 AccumulatedData = 0;
|
||||
AccumulatedData += ProcessSample(float2( 0,-1) -LanczosOffset, DirLength, LobeClip, Samples[0]);
|
||||
AccumulatedData += ProcessSample(float2( 1,-1) -LanczosOffset, DirLength, LobeClip, Samples[1]);
|
||||
AccumulatedData += ProcessSample(float2(-1, 1) -LanczosOffset, DirLength, LobeClip, Samples[2]);
|
||||
AccumulatedData += ProcessSample(float2( 0, 1) -LanczosOffset, DirLength, LobeClip, Samples[3]);
|
||||
AccumulatedData += ProcessSample(float2( 0, 0) -LanczosOffset, DirLength, LobeClip, Samples[4]);
|
||||
AccumulatedData += ProcessSample(float2(-1, 0) -LanczosOffset, DirLength, LobeClip, Samples[5]);
|
||||
AccumulatedData += ProcessSample(float2( 1, 1) -LanczosOffset, DirLength, LobeClip, Samples[6]);
|
||||
AccumulatedData += ProcessSample(float2( 2, 1) -LanczosOffset, DirLength, LobeClip, Samples[7]);
|
||||
AccumulatedData += ProcessSample(float2( 2, 0) -LanczosOffset, DirLength, LobeClip, Samples[8]);
|
||||
AccumulatedData += ProcessSample(float2( 1, 0) -LanczosOffset, DirLength, LobeClip, Samples[9]);
|
||||
AccumulatedData += ProcessSample(float2( 1, 2) -LanczosOffset, DirLength, LobeClip, Samples[10]);
|
||||
AccumulatedData += ProcessSample(float2( 0, 2) -LanczosOffset, DirLength, LobeClip, Samples[11]);
|
||||
|
||||
AccumulatedData.w = max(AccumulatedData.w, 0.1f);
|
||||
AccumulatedData.xyz = AccumulatedData.w > 0 ? AccumulatedData.xyz / AccumulatedData.w : RadianceCenter;
|
||||
InterpolatedRadiance = min(MaxNeighbourhood, max(MinNeighbourhood, AccumulatedData.xyz ));
|
||||
}
|
||||
else
|
||||
{
|
||||
static const int2 SampleOffsets[9] = {int2(0, 0), int2(1, 0), int2(0, 1), int2(-1, 0), int2(0, -1), int2(1, -1), int2(-1, 1), int2(-1, -1), int2(1, 1)};
|
||||
|
||||
float2 pixCoordDownscaled = float2(pixCoord.xy) / _HScaleFactorSSGI;
|
||||
float2 pixCoordDownscaledSnapped = floor(pixCoordDownscaled + 0.5 / _HScaleFactorSSGI); // or round(pixCoordDownscaled) ?
|
||||
|
||||
float SigmaScale = pow(abs(_HScaleFactorSSGI - 1.0), 0.2);
|
||||
float Sigma = lerp(0.3, 0.65, SigmaScale);
|
||||
float AccumulatedWeight = 0;
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
float2 SampleCoord = pixCoordDownscaledSnapped + SampleOffsets[i];
|
||||
int2 SampleCoordSnapped = clamp(SampleCoord, 0 , _ScreenSize.xy / _HScaleFactorSSGI - 1);
|
||||
|
||||
float Unused;
|
||||
float4 Sample = InterpolationSample(CenterData, SampleCoordSnapped, Unused);
|
||||
Sample.xyz = SpatialDenoisingTonemap(Sample.xyz);
|
||||
|
||||
float2 Delta = (pixCoordDownscaled - SampleCoord);
|
||||
float DistanceSq = dot(Delta, Delta);
|
||||
float Weight = exp(-DistanceSq / (2.0 * Sigma * Sigma));
|
||||
|
||||
Sample.w *= Weight;
|
||||
InterpolatedRadiance += Sample.xyz * Sample.w;
|
||||
AccumulatedWeight += Sample.w;
|
||||
}
|
||||
|
||||
InterpolatedRadiance = AccumulatedWeight > 0 ? SpatialDenoisingTonemapInverse((InterpolatedRadiance) / AccumulatedWeight) : RadianceCenter;
|
||||
}
|
||||
|
||||
_Radiance_Output[H_COORD(pixCoord.xy)] = InterpolatedRadiance;
|
||||
_NormalDepth_HistoryOutput[H_COORD(pixCoord.xy)] = PackNormalDepth(NormalCenterWS, DepthCenter);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9e32df3caf2788448cd612608bce346
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Computes/HInterpolationSSGI.compute
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,231 @@
|
||||
#pragma kernel TraceSSGI
|
||||
#pragma kernel MaskExclude
|
||||
|
||||
#pragma multi_compile _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
|
||||
#pragma multi_compile _ FALLBACK_SKY FALLBACK_APV
|
||||
#pragma multi_compile _ CHECKERBOARDING
|
||||
|
||||
// Tracing keywords
|
||||
#pragma multi_compile _ REFINE_INTERSECTION
|
||||
#pragma multi_compile _ HALF_STEP_VALIDATION
|
||||
#pragma multi_compile _ FULL_RESOLUTION_DEPTH
|
||||
#pragma multi_compile LINEAR_THICKNESS UNIFORM_THICKNESS
|
||||
|
||||
#define FALLBACK_STAGE 1
|
||||
|
||||
#include "../Includes/HRayMarchingSSGI.hlsl"
|
||||
#include "../Includes/HFallbackSSGI.hlsl"
|
||||
#include "../Headers/HDRP files/RaytracingSampling.hlsl"
|
||||
#pragma multi_compile _ _GBUFFER_NORMALS_OCT
|
||||
|
||||
|
||||
int _IndexXR;
|
||||
int _RayCount;
|
||||
float _SkyFallbackIntensity;
|
||||
|
||||
H_TEXTURE(_SampleCount);
|
||||
|
||||
H_RW_TEXTURE(float3, _Radiance_Output);
|
||||
H_RW_TEXTURE(float, _AmbientOcclusion_Output);
|
||||
|
||||
RWStructuredBuffer<uint2> _TracingCoords;
|
||||
RWStructuredBuffer<uint> _RayCounter;
|
||||
|
||||
|
||||
// ------------------------ SSGI RENDER -------------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void TraceSSGI(uint3 pixCoord : SV_DispatchThreadID, uint groupIndex : SV_GroupIndex, uint groupID : SV_GroupID)
|
||||
{
|
||||
if (CHECKERBOARDING)
|
||||
{
|
||||
uint RayCounterOffsetVR = 0;
|
||||
uint IndirectCoordOffsetVR = 0;
|
||||
|
||||
|
||||
uint RayIndex = groupID * 64 + groupIndex;
|
||||
if (RayIndex >= _RayCounter[1 + RayCounterOffsetVR])
|
||||
return;
|
||||
|
||||
pixCoord.xy = _TracingCoords[RayIndex + IndirectCoordOffsetVR];
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
uint2 pixCoordUnscaled = GetUnscaledCoords(pixCoord.xy);
|
||||
float2 pixCoordNDC = (float2(pixCoordUnscaled) + 0.5f) * _ScreenSize.zw;
|
||||
|
||||
float DepthCenter = HBUFFER_DEPTH(pixCoordUnscaled);
|
||||
float3 NormalCenterWS = HBUFFER_NORMAL_WS(pixCoordUnscaled);
|
||||
float3 PositionCenterWS = H_COMPUTE_POSITION_WS(pixCoordNDC, DepthCenter, H_MATRIX_I_VP);
|
||||
|
||||
float3 ViewDir = normalize(_WorldSpaceCameraPos - H_GET_ABSOLUTE_POSITION_WS(PositionCenterWS) );
|
||||
|
||||
if (DepthCenter <= UNITY_RAW_FAR_CLIP_VALUE)
|
||||
{
|
||||
_Reservoir_Output[H_COORD(pixCoord.xy)] = 0;
|
||||
_AmbientOcclusion_Output[H_COORD(pixCoord.xy)] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
float3 Diffuse = GetReservoirDiffuse(pixCoordUnscaled);
|
||||
uint ReservoirUpdateRandom = Hash3(uint3(pixCoord.xy, _FrameCount));
|
||||
TemporalReservoir RadianceRes = (TemporalReservoir)0;
|
||||
OcclusionReservoir OcclusionRes = (OcclusionReservoir)0;
|
||||
|
||||
const float StepJitter = Jitter((pixCoord.xy) * 2 - 1);
|
||||
int FrameStep = 1; if (CHECKERBOARDING) { FrameStep = 2;}
|
||||
|
||||
float AmbientOcclusion = 0, AmbientOcclusionInvalidity = 0;
|
||||
float3 DirectionsAccumulated = 0, BentNormal = 0, Radiance = 0;
|
||||
|
||||
// Tracing
|
||||
for (int i = 0; i < _RayCount; i++)
|
||||
{
|
||||
int SampleIndex = ((floor(uint(_FrameCount) / FrameStep) % 16) * _RayCount + i);
|
||||
|
||||
float2 SampleRandom;
|
||||
SampleRandom.x = GetBNDSequenceSample(pixCoord.xy, SampleIndex, 0);
|
||||
SampleRandom.y = GetBNDSequenceSample(pixCoord.xy, SampleIndex, 1);
|
||||
float3 RayDirectionWS = HSampleHemisphereCosine(SampleRandom.x, SampleRandom.y, NormalCenterWS);
|
||||
|
||||
DirectionsAccumulated += RayDirectionWS;
|
||||
|
||||
float3 RayOriginBiasedWS, RayStartPositionNDC, RayEndPositionNDC;
|
||||
GetRayOriginAndDirectionNDC(_RayLength, DepthCenter, pixCoordNDC, PositionCenterWS, RayDirectionWS, NormalCenterWS, RayOriginBiasedWS, RayStartPositionNDC, RayEndPositionNDC);
|
||||
|
||||
float4 HitData = RayMarch(RayStartPositionNDC, RayEndPositionNDC, StepJitter);
|
||||
|
||||
float3 HitRadiance = 0;
|
||||
float OcclusionDistance = 0, HitOcclusion = 0, HitDistance = 0;
|
||||
|
||||
if (HitData.w)
|
||||
{
|
||||
bool MovingHitPoint;
|
||||
HitRadiance = UnpackColorHit(asuint(H_LOAD(_Color, HitData.xy * _ScreenSize.xy).x), MovingHitPoint);
|
||||
|
||||
float3 HitPosition = H_COMPUTE_POSITION_WS(HitData.xy, HitData.z, H_MATRIX_I_VP);
|
||||
HitDistance = distance(PositionCenterWS, HitPosition);
|
||||
//RayDirectionWS = normalize(HitPosition - PositionCenterWS);
|
||||
|
||||
float HitSurface = H_LOAD(g_HTraceDepthPyramidSSGI, HitData.xy * _ScreenSize.xy).x;
|
||||
float HitSurfaceLinear = H_LINEAR_EYE_DEPTH(HitSurface);
|
||||
float HitDepthLinear = H_LINEAR_EYE_DEPTH(HitData.z);
|
||||
|
||||
// Don't run hit validation on skybox hits
|
||||
if (HitSurface > UNITY_RAW_FAR_CLIP_VALUE)
|
||||
{
|
||||
if (abs(HitDepthLinear - HitSurfaceLinear) > HitDistance + 0.05f * max(HitSurfaceLinear, 0.25f))
|
||||
HitRadiance = 0;
|
||||
|
||||
if (dot(HBUFFER_NORMAL_WS(HitData.xy * _ScreenSize.xy), RayDirectionWS) > _BackfaceLighting)
|
||||
HitRadiance = 0;
|
||||
}
|
||||
|
||||
HitRadiance *= ExponentialFalloff(HitDistance, _RayLength);
|
||||
|
||||
if (HitDistance < 0.5)
|
||||
AmbientOcclusion++;
|
||||
|
||||
float HitSamplecount = H_LOAD(_SampleCount, HitData.xy * _ScreenSize.xy / _HScaleFactorSSGI).x;
|
||||
if (HitSamplecount < 2)
|
||||
AmbientOcclusionInvalidity++;
|
||||
|
||||
if (HitDistance < 1.0)
|
||||
{
|
||||
OcclusionDistance = HitDistance;
|
||||
HitOcclusion = MovingHitPoint ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
Radiance += HitRadiance;
|
||||
BentNormal += RayDirectionWS * (1 - HitData.w);
|
||||
|
||||
ReservoirUpdate(HitRadiance, RayDirectionWS, NormalCenterWS, HitDistance, HitData.w, Luminance(HitRadiance * Diffuse), 1, RadianceRes, ReservoirUpdateRandom);
|
||||
ReservoirUpdate(HitOcclusion, RayDirectionWS, OcclusionDistance, HitOcclusion, 1, OcclusionRes, ReservoirUpdateRandom);
|
||||
}
|
||||
|
||||
// Fallback
|
||||
if (FALLBACK_APV || FALLBACK_SKY)
|
||||
{
|
||||
float3 FallbackRadiance = 0;
|
||||
|
||||
if (length(DirectionsAccumulated) > 0)
|
||||
BentNormal /= length(DirectionsAccumulated);
|
||||
|
||||
float BentNormalOcclusion = length(BentNormal);
|
||||
BentNormal = BentNormalOcclusion > 0 ? BentNormal / BentNormalOcclusion : NormalCenterWS;
|
||||
|
||||
// APV Fallback
|
||||
#ifdef FALLBACK_APV
|
||||
if (_EnableProbeVolumes)
|
||||
{
|
||||
if (PROBE_VOLUMES_L1 || PROBE_VOLUMES_L2)
|
||||
{
|
||||
float3 BakedAPV = EvaluateFallbackAPV(_APVParams, PositionCenterWS, BentNormal, H_GET_VIEW_DIRECTION_WS(PositionCenterWS), pixCoord.xy);
|
||||
FallbackRadiance = BakedAPV * RadianceRes.M * BentNormalOcclusion;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Sky Fallback
|
||||
if (FALLBACK_SKY)
|
||||
{
|
||||
float3 Sky = EvaluateFallbackSky(BentNormal);
|
||||
FallbackRadiance = Sky * RadianceRes.M * BentNormalOcclusion * _SkyFallbackIntensity;
|
||||
}
|
||||
|
||||
FallbackRadiance = max(FallbackRadiance, 0);
|
||||
ReservoirUpdate(FallbackRadiance, NormalCenterWS, false, Luminance(FallbackRadiance * Diffuse), 1 / float(_RayCount), RadianceRes, ReservoirUpdateRandom);
|
||||
}
|
||||
|
||||
RadianceRes.W = RadianceRes.Wsum / max(RadianceRes.M * Luminance(RadianceRes.Color * Diffuse), 1e-7);
|
||||
OcclusionRes.W = OcclusionRes.Wsum / max(OcclusionRes.M * OcclusionRes.Occlusion, 1e-7);
|
||||
RadianceRes.OriginNormal = NormalCenterWS;
|
||||
|
||||
if (RadianceRes.HitFound == false) // && OcclusionRes.Distance > 0 && OcclusionRes.Occlusion > 0)
|
||||
{
|
||||
RadianceRes.Direction = OcclusionRes.Direction;
|
||||
RadianceRes.Distance = OcclusionRes.Distance;
|
||||
}
|
||||
|
||||
float InvalidityEncodingSign = AmbientOcclusionInvalidity > 0 ? -1 : 1;
|
||||
_AmbientOcclusion_Output[H_COORD(pixCoord.xy)] = (1 - (AmbientOcclusion / float(_RayCount))) * InvalidityEncodingSign;
|
||||
_Reservoir_Output[H_COORD(pixCoord.xy)] = PackTemporalReservoir(RadianceRes);
|
||||
|
||||
bool MovingHitPoint;
|
||||
float3 HitRadiance = UnpackColorHit(asuint(H_LOAD(_Color, pixCoord.xy).x), MovingHitPoint);
|
||||
|
||||
//_Radiance_Output[H_COORD(pixCoord.xy)] =RadianceRes.Color * RadianceRes.W;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ MASK EXCLUDE [HDRP ONLY] -----------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void MaskExclude(uint3 pixCoord : SV_DispatchThreadID)
|
||||
{
|
||||
|
||||
if (HBUFFER_RENDER_LAYER_MASK(pixCoord.xy) & _ExcludeReceivingLayerMaskSSGI)
|
||||
{
|
||||
float3 Radiance = 0;
|
||||
|
||||
#ifdef FALLBACK_APV
|
||||
if (_EnableProbeVolumes)
|
||||
{
|
||||
if (PROBE_VOLUMES_L1 || PROBE_VOLUMES_L2)
|
||||
{
|
||||
float DepthCenter = HBUFFER_DEPTH(pixCoord.xy);
|
||||
float3 NormalCenterWS = HBUFFER_NORMAL_WS(pixCoord.xy);
|
||||
float3 PositionCenterWS = H_COMPUTE_POSITION_WS((pixCoord.xy + 0.5f) * _ScreenSize.zw, DepthCenter, H_MATRIX_I_VP);
|
||||
|
||||
Radiance = EvaluateFallbackAPV(_APVParams, PositionCenterWS, NormalCenterWS, H_GET_VIEW_DIRECTION_WS(PositionCenterWS), pixCoord.xy);
|
||||
}
|
||||
}
|
||||
#elif FALLBACK_SKY
|
||||
float3 NormalCenterWS = HBUFFER_NORMAL_WS(pixCoord.xy);
|
||||
Radiance = EvaluateFallbackSky(NormalCenterWS);
|
||||
#endif
|
||||
|
||||
_Radiance_Output[H_COORD(pixCoord.xy)] = Radiance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a19906341f84b914a88dd6966db40d78
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Computes/HRenderSSGI.compute
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,498 @@
|
||||
#pragma kernel TemporalResampling
|
||||
#pragma kernel FireflySuppression
|
||||
#pragma kernel SpatialResampling SpatialResamplingValidation = SpatialResampling
|
||||
#pragma kernel SpatialValidation SpatialResamplingValidation = SpatialValidation VALIDATION_STAGE
|
||||
|
||||
#include "../Includes/HRayMarchingSSGI.hlsl"
|
||||
#include "../Headers/HSpaceTransforms.hlsl"
|
||||
#include "../Headers/HDRP files/RaytracingSampling.hlsl"
|
||||
|
||||
#pragma multi_compile _ _GBUFFER_NORMALS_OCT
|
||||
|
||||
#pragma multi_compile _ CHECKERBOARDING
|
||||
#pragma multi_compile _ VALIDATE_SPATIAL_OCCLUSION
|
||||
#pragma multi_compile _ VALIDATE_TEMPORAL_LIGHTING
|
||||
#pragma multi_compile _ VALIDATE_TEMPORAL_OCCLUSION
|
||||
|
||||
// Tracing keywords
|
||||
#pragma multi_compile _ REFINE_INTERSECTION
|
||||
#pragma multi_compile _ HALF_STEP_VALIDATION
|
||||
#pragma multi_compile _ FULL_RESOLUTION_DEPTH
|
||||
#pragma multi_compile LINEAR_THICKNESS UNIFORM_THICKNESS
|
||||
|
||||
#ifdef VALIDATION_STAGE
|
||||
#define SECOND_SPATIAL_PASS 1
|
||||
#else
|
||||
#define SECOND_SPATIAL_PASS 0
|
||||
#endif
|
||||
|
||||
#ifdef CHECKERBOARDING
|
||||
#define RESTIR_HISTORY_MAX_LENGTH 32
|
||||
#define RESTIR_HISTORY_MIN_LENGTH 1
|
||||
#else
|
||||
#define RESTIR_HISTORY_MAX_LENGTH 32
|
||||
#define RESTIR_HISTORY_MIN_LENGTH 0
|
||||
#endif
|
||||
|
||||
H_TEXTURE(_SpatialGuidance);
|
||||
H_TEXTURE(_SampleCount);
|
||||
H_TEXTURE (_AmbientOcclusion);
|
||||
H_TEXTURE(_AmbientOcclusionReprojected);
|
||||
H_TEXTURE(_SpatialOcclusion);
|
||||
H_TEXTURE(_TemporalInvalidity);
|
||||
|
||||
H_RW_TEXTURE(float3, _Radiance_Output);
|
||||
H_RW_TEXTURE(float2, _TemporalInvalidity_Output);
|
||||
H_RW_TEXTURE(float, _AmbientOcclusion_Output);
|
||||
H_RW_TEXTURE(float, _SpatialOcclusion_Output);
|
||||
H_RW_TEXTURE(uint2, _SpatialGuidance_Output);
|
||||
H_RW_TEXTURE(uint, _NormalDepth_HistoryOutput);
|
||||
|
||||
StructuredBuffer<float3> _PointDistribution;
|
||||
|
||||
float _FilterRadius;
|
||||
float _FilterAdaptivity;
|
||||
int _DenoiseFallback;
|
||||
int _RayCount;
|
||||
|
||||
|
||||
// ------------------------ TEMPORAL RESAMPLING + VALIDATION -------------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void TemporalResampling(uint3 pixCoord : SV_DispatchThreadID)
|
||||
{
|
||||
|
||||
uint2 pixCoordUnscaled = GetUnscaledCoords(pixCoord.xy);
|
||||
float DepthCenter = HBUFFER_DEPTH(pixCoordUnscaled);
|
||||
|
||||
if (DepthCenter <= UNITY_RAW_FAR_CLIP_VALUE)
|
||||
{
|
||||
_ReservoirLuminance_Output[H_COORD(pixCoord.xy)] = -1;
|
||||
_NormalDepth_HistoryOutput[H_COORD(pixCoord.xy)] = 0;
|
||||
_ReservoirSpatial_Output[H_COORD(pixCoord.xy)] = 0;
|
||||
_ReservoirTemporal_Output[H_COORD(pixCoord.xy)] = 0;
|
||||
_AmbientOcclusion_Output[H_COORD(pixCoord.xy)] = 0;
|
||||
_TemporalInvalidity_Output[H_COORD(pixCoord.xy)] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
float3 Diffuse = GetReservoirDiffuse(pixCoordUnscaled);
|
||||
uint ReservoirUpdateRandom = Hash3(uint3(pixCoord.xy, _FrameCount));
|
||||
|
||||
// Load and unpack current and reprojected reservoirs
|
||||
TemporalReservoir TemporalRes = (TemporalReservoir)0;
|
||||
TemporalReservoir TemporalReprojectedRes = (TemporalReservoir)0;
|
||||
UnpackTemporalReservoir(asuint(H_LOAD(_Reservoir, pixCoord.xy)), Diffuse, TemporalRes);
|
||||
UnpackTemporalReservoir(asuint(H_LOAD(_ReservoirReprojected, pixCoord.xy)), Diffuse, TemporalReprojectedRes);
|
||||
|
||||
float MaxHistoryClamp = RESTIR_HISTORY_MAX_LENGTH * max((uint(_RayCount) / 4), 1);
|
||||
MaxHistoryClamp = clamp(MaxHistoryClamp, 0, 100);
|
||||
|
||||
// Backup current Color and W for replacement
|
||||
float4 OriginalColorW = float4(TemporalRes.Color, TemporalRes.W);
|
||||
float SamplecountReprojected = H_LOAD(_SampleCount, pixCoord.xy).x;
|
||||
bool CullCheckerboard = true;
|
||||
|
||||
float AmbientOcclusion = H_LOAD(_AmbientOcclusion, pixCoord.xy).x;
|
||||
float AmbientOcclusionInvalidity = sign(AmbientOcclusion) < 0 ? 0 : 1;
|
||||
|
||||
// Checkerboarding logic
|
||||
if (ENABLE_TEMPORAL_RESTIR)
|
||||
{
|
||||
if (CHECKERBOARDING)
|
||||
{
|
||||
CullCheckerboard = false;
|
||||
if (((pixCoord.x + pixCoord.y) % 2 == 0 && uint(_FrameCount) % 2 == 0) || SamplecountReprojected <= 1) CullCheckerboard = true;
|
||||
if (((pixCoord.x + pixCoord.y) % 2 != 0 && uint(_FrameCount) % 2 != 0) || SamplecountReprojected <= 1) CullCheckerboard = true;
|
||||
|
||||
if (CullCheckerboard == false)
|
||||
{
|
||||
TemporalRes.Color = TemporalReprojectedRes.Color;
|
||||
TemporalRes.Wsum = TemporalReprojectedRes.Wsum;
|
||||
TemporalRes.W = TemporalReprojectedRes.W;
|
||||
TemporalRes.M = TemporalReprojectedRes.M;
|
||||
TemporalRes.OriginNormal = TemporalReprojectedRes.OriginNormal;
|
||||
TemporalRes.Direction = TemporalReprojectedRes.Direction;
|
||||
TemporalRes.Distance = TemporalReprojectedRes.Distance;
|
||||
TemporalRes.HitFound = TemporalReprojectedRes.HitFound;
|
||||
}
|
||||
else
|
||||
{ ReservoirUpdate(TemporalReprojectedRes, TemporalRes, ReservoirUpdateRandom); }
|
||||
}
|
||||
else
|
||||
{ ReservoirUpdate(TemporalReprojectedRes, TemporalRes, ReservoirUpdateRandom); }
|
||||
}
|
||||
|
||||
bool HitIsMoving = false;
|
||||
float3 NormalCenterWS = HBUFFER_NORMAL_WS(pixCoordUnscaled);
|
||||
float2 pixCoordNDC = (float2(pixCoordUnscaled) + 0.5f) / _ScreenSize.xy;
|
||||
float3 PositionCenterWS = H_COMPUTE_POSITION_WS(pixCoordNDC, DepthCenter, H_MATRIX_I_VP);
|
||||
|
||||
bool IsOcclusionValidation = false;
|
||||
if (!TemporalRes.HitFound && TemporalRes.Distance > 0 && TemporalRes.Distance < 1)
|
||||
IsOcclusionValidation = true;
|
||||
|
||||
bool ReplaceRadiance = false;
|
||||
if (VALIDATE_TEMPORAL_OCCLUSION)
|
||||
{
|
||||
// If the distance is in [0,1] and a hit wasn't found then we store occlusion data
|
||||
bool IsOcclusionValidation = false;
|
||||
if (!TemporalRes.HitFound && TemporalRes.Distance > 0 && TemporalRes.Distance < 1)
|
||||
IsOcclusionValidation = true;
|
||||
|
||||
float StepJitter = Jitter((pixCoord.xy) * 2 - 1);
|
||||
float3 RayOriginBiasedWS, RayStartPositionNDC, RayEndPositionNDC;
|
||||
GetRayOriginAndDirectionNDC(_RayLength, DepthCenter, pixCoordNDC, PositionCenterWS, TemporalRes.Direction, NormalCenterWS, RayOriginBiasedWS, RayStartPositionNDC, RayEndPositionNDC);
|
||||
float4 HitData = RayMarchValidation(RayStartPositionNDC, RayEndPositionNDC, StepJitter);
|
||||
|
||||
if (HitData.w)
|
||||
{
|
||||
float3 HitPosition = H_COMPUTE_POSITION_WS(HitData.xy, HitData.z, H_MATRIX_I_VP);
|
||||
float HitDistance = distance(PositionCenterWS, HitPosition);
|
||||
HitIsMoving = HBUFFER_MOTION_MASK(HitData.xy * _ScreenSize.xy);
|
||||
|
||||
// We did hit something, but it was the wrong spot
|
||||
if (abs(HitDistance - TemporalRes.Distance) / (TemporalRes.Distance + TemporalRes.Distance) > 0.2f)
|
||||
{
|
||||
// Clamp history (smoother reaction)
|
||||
if (TemporalRes.HitFound && HitDistance < TemporalRes.Distance ) // && HitDistance > 0 && TemporalRes.Distance > 0)
|
||||
MaxHistoryClamp = 0;
|
||||
|
||||
// Replace radiance (faster reaction) if it was occlusion validation
|
||||
if (IsOcclusionValidation && HitDistance < 1) // && dot(normalize(PositionCenterWS - HitPosition), TemporalRes.Direction) < 0)
|
||||
ReplaceRadiance = true;
|
||||
}
|
||||
}
|
||||
else if (IsOcclusionValidation)
|
||||
{
|
||||
// If we didn't hit anything but should have (because it was occlusion validation).
|
||||
ReplaceRadiance = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool SampleIsOffscreen = false;
|
||||
if (VALIDATE_TEMPORAL_LIGHTING && TemporalRes.HitFound)
|
||||
{
|
||||
float LightingInvalidity = 1.0f;
|
||||
for (int x = -1; x <= 1; x++)
|
||||
{
|
||||
for (int y = -1; y <= 1; y++)
|
||||
{
|
||||
bool MovingHitPoint;
|
||||
float2 HitCoordNDC = H_COMPUTE_NDC_Z(PositionCenterWS + TemporalRes.Direction * TemporalRes.Distance, H_MATRIX_VP).xy;
|
||||
float3 HitRadiance = UnpackColorHit(asuint(H_LOAD(_Color, floor(HitCoordNDC * _ScreenSize.xy) + int2(x,y)).x), MovingHitPoint);
|
||||
|
||||
HitRadiance *= ExponentialFalloff(TemporalRes.Distance, _RayLength);
|
||||
|
||||
if (any(HitCoordNDC < 0) || any(HitCoordNDC > 1))
|
||||
SampleIsOffscreen = true;
|
||||
|
||||
float3 LuminanceCurrent = (HitRadiance);
|
||||
float3 LuminanceHistory = (TemporalRes.Color);
|
||||
|
||||
float LightingDifference = length(abs(LuminanceHistory - LuminanceCurrent) / max(1e-3, LuminanceHistory + LuminanceCurrent));
|
||||
LightingInvalidity = min(LightingInvalidity, LightingDifference);
|
||||
}
|
||||
}
|
||||
|
||||
if (!SampleIsOffscreen)
|
||||
MaxHistoryClamp *= (1.0f - LightingInvalidity);
|
||||
}
|
||||
|
||||
if (ENABLE_EXPOSURE_CONTROL)
|
||||
{
|
||||
float ExposurePrevious = HGetPreviousExposureMultiplier;
|
||||
float ExposureCurrent = HGetCurrentExposureMultiplier;
|
||||
|
||||
float ExposureRatio = (ExposurePrevious * ExposureCurrent) != 0.0 ? ExposureCurrent / ExposurePrevious : 100.0;
|
||||
|
||||
if (max(ExposureRatio, 1.0 / ExposureRatio) > 2.0)
|
||||
MaxHistoryClamp = MaxHistoryClamp * HGetInversePreviousExposureMultiplier * ExposureCurrent;
|
||||
}
|
||||
|
||||
TemporalRes.W = TemporalRes.Wsum / max(TemporalRes.M * Luminance(TemporalRes.Color * Diffuse), 1e-8);
|
||||
TemporalRes.M = clamp(TemporalRes.M, RESTIR_HISTORY_MIN_LENGTH, max(RESTIR_HISTORY_MIN_LENGTH, MaxHistoryClamp));
|
||||
|
||||
if (ReplaceRadiance || SampleIsOffscreen || (AmbientOcclusionInvalidity == 0 && !TemporalRes.HitFound))
|
||||
{
|
||||
MaxHistoryClamp = 0;
|
||||
if (CullCheckerboard == true)
|
||||
{
|
||||
// Tried setting W and Color to 0, looks similar in certain cases, but worse in others
|
||||
TemporalRes.W = OriginalColorW.w;
|
||||
TemporalRes.Color = OriginalColorW.xyz;
|
||||
}
|
||||
}
|
||||
|
||||
float Samplecount = min(8, SamplecountReprojected + 1);
|
||||
float TemporalWeight = 1.0f - (1.0f / float(Samplecount));
|
||||
|
||||
float2 TemporalInvalidity = float2(1,1);
|
||||
if (VALIDATE_TEMPORAL_OCCLUSION || VALIDATE_TEMPORAL_LIGHTING)
|
||||
{
|
||||
TemporalInvalidity.x = MaxHistoryClamp / RESTIR_HISTORY_MAX_LENGTH;
|
||||
TemporalInvalidity.y = MaxHistoryClamp < (RESTIR_HISTORY_MAX_LENGTH && HitIsMoving) ? 0 : 1;
|
||||
|
||||
if (TemporalRes.HitFound == false)
|
||||
{ TemporalInvalidity.x *= AmbientOcclusionInvalidity; }
|
||||
|
||||
float2 TemporalInvalidityReprojected = H_LOAD(_TemporalInvalidity, pixCoord.xy).xy;
|
||||
TemporalInvalidity = lerp(TemporalInvalidity, TemporalInvalidityReprojected, CullCheckerboard ? TemporalWeight : 1);
|
||||
|
||||
_TemporalInvalidity_Output[H_COORD(pixCoord.xy)] = TemporalInvalidity;
|
||||
}
|
||||
|
||||
float AmbientOcclusionReprojected = H_LOAD(_AmbientOcclusionReprojected, pixCoord.xy).x;
|
||||
AmbientOcclusion = lerp(abs(AmbientOcclusion), AmbientOcclusionReprojected, CullCheckerboard ? TemporalWeight * pow(TemporalInvalidity.y, 2) * AmbientOcclusionInvalidity : 1);
|
||||
|
||||
// Transfer data from temporal to spatial reservoir
|
||||
SpatialReservoir SpatialRes;
|
||||
SpatialRes.Color = TemporalRes.Color;
|
||||
SpatialRes.W = TemporalRes.W;
|
||||
SpatialRes.M = TemporalRes.M;
|
||||
SpatialRes.HitFound = TemporalRes.HitFound;
|
||||
SpatialRes.Occlusion = H_LOAD(_SpatialOcclusion, pixCoord.xy).x;
|
||||
SpatialRes.Direction = TemporalRes.Direction;
|
||||
SpatialRes.Distance = TemporalRes.Distance;
|
||||
SpatialRes.Normal = NormalCenterWS;
|
||||
SpatialRes.Depth = DepthCenter;
|
||||
|
||||
_ReservoirSpatial_Output[H_COORD(pixCoord.xy)] = PackSpatialReservoir(SpatialRes);
|
||||
_ReservoirTemporal_Output[H_COORD(pixCoord.xy)] = PackTemporalReservoir(TemporalRes);
|
||||
_ReservoirLuminance_Output[H_COORD(pixCoord.xy)] = Luminance(TemporalRes.Color * TemporalRes.W);
|
||||
|
||||
_AmbientOcclusion_Output[H_COORD(pixCoord.xy)] = AmbientOcclusion;
|
||||
_NormalDepth_HistoryOutput[H_COORD(pixCoord.xy)] = PackNormalDepth(NormalCenterWS, DepthCenter);
|
||||
|
||||
// _Radiance_Output[H_COORD(pixCoord.xy)] = TemporalRes.Color * TemporalRes.W;
|
||||
// if (Luminance(TemporalRes.Color * TemporalRes.W) > 0.01)
|
||||
// _Radiance_Output[H_COORD(pixCoord.xy)] = lerp(float3(1,0,0), TemporalRes.Color * TemporalRes.W, saturate(MaxHistoryClamp / RESTIR_HISTORY_MAX_LENGTH));
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ FIREFLY SUPPRESSION -------------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void FireflySuppression(uint3 pixCoord : SV_DispatchThreadID)
|
||||
{
|
||||
|
||||
float LumaCenter = H_LOAD(_ReservoirLuminance, pixCoord.xy).x;
|
||||
|
||||
float2 Moments;
|
||||
Moments.x = 0;
|
||||
Moments.y = 0;
|
||||
|
||||
float TotalWeight = 0;
|
||||
|
||||
UNITY_UNROLL
|
||||
for (int x = -3; x <= 3; x++)
|
||||
{
|
||||
UNITY_UNROLL
|
||||
for (int y = -3; y <= 3; y++)
|
||||
{
|
||||
int2 SampleCoord = pixCoord.xy + int2(x, y);
|
||||
SampleCoord = clamp(SampleCoord, 0, _ScreenSize.xy / _HScaleFactorSSGI - 1);
|
||||
|
||||
float LumaSample = H_LOAD(_ReservoirLuminance, pixCoord.xy + int2(x, y)).x;
|
||||
|
||||
// Sky pixels are marked as -1
|
||||
if (LumaSample < 0)
|
||||
continue;
|
||||
|
||||
Moments.x += LumaSample;
|
||||
Moments.y += LumaSample * LumaSample;
|
||||
|
||||
TotalWeight += 1;
|
||||
}
|
||||
}
|
||||
|
||||
Moments.x /= TotalWeight;
|
||||
Moments.y /= TotalWeight;
|
||||
|
||||
float Variance = (max(0.0, Moments.y - Moments.x * Moments.x));
|
||||
float StdDev = sqrt(Variance);
|
||||
|
||||
float SamplecountReprojected = H_LOAD(_SampleCount, pixCoord.xy).x;
|
||||
|
||||
// Avoid applying firefly suppression for the first 4 frames of temporal accumulation
|
||||
float SamplecountScale = clamp(4 - SamplecountReprojected, 1, 2);
|
||||
float LumaThreshold = Moments.x + SamplecountScale * StdDev;
|
||||
|
||||
// If Luma is above threshold - unpack the reservoir, clamp W and pack it back
|
||||
if (LumaCenter > LumaThreshold)
|
||||
{
|
||||
uint4 ReservoirMW = _ReservoirSpatial_Output[H_COORD(pixCoord.xy)];
|
||||
|
||||
float W = f16tof32(ReservoirMW.y >> 16);
|
||||
W *= (LumaThreshold / max(LumaCenter, 1e-5));
|
||||
|
||||
uint PackedW = f32tof16(W);
|
||||
PackedW = PackedW << 16;
|
||||
|
||||
ReservoirMW.y &= 0x0000FFFF;
|
||||
ReservoirMW.y |= PackedW;
|
||||
_ReservoirSpatial_Output[H_COORD(pixCoord.xy)] = ReservoirMW;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ------------------------ SPATIAL RESAMPLING + VALIDATION -------------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void SpatialResamplingValidation(uint3 pixCoord : SV_DispatchThreadID)
|
||||
{
|
||||
|
||||
uint2 pixCoordUnscaled = GetUnscaledCoords(pixCoord.xy);
|
||||
int2 pixCoordMax = _ScreenSize.xy / _HScaleFactorSSGI.xx - 1;
|
||||
float2 pixCoordNDC = (float2(pixCoordUnscaled) + 0.5f) * _ScreenSize.zw;
|
||||
|
||||
float3 Diffuse = GetReservoirDiffuse(pixCoordUnscaled);
|
||||
uint ReservoirUpdateRandom = Hash3(uint3(pixCoord.xy, _FrameCount));
|
||||
SpatialReservoir Reservoir = (SpatialReservoir)0;
|
||||
UnpackSpatialReservoir(asuint(H_LOAD(_Reservoir, pixCoord.xy)), Diffuse, Reservoir);
|
||||
|
||||
if (Reservoir.Depth <= UNITY_RAW_FAR_CLIP_VALUE) { return; }
|
||||
|
||||
float DepthCetnerLinear = H_LINEAR_EYE_DEPTH(Reservoir.Depth);
|
||||
float3 NormalCenterVS = H_TRANSFORM_WORLD_TO_VIEW_NORMAL(Reservoir.Normal);
|
||||
float3 PositionCenterWS = H_COMPUTE_POSITION_WS(pixCoordNDC, Reservoir.Depth, H_MATRIX_I_VP);
|
||||
float3 PositionCenterVS = ComputeFastViewSpacePosition(pixCoordNDC, Reservoir.Depth, DepthCetnerLinear);
|
||||
float4 NormalPlaneVS = float4(NormalCenterVS.xyz, dot(PositionCenterVS, NormalCenterVS.xyz));
|
||||
|
||||
float SamplecountReprojected = H_LOAD(_SampleCount, pixCoord.xy).x;
|
||||
float AmbientOcclusion = H_LOAD(_AmbientOcclusion, pixCoord.xy).x;
|
||||
|
||||
#if SECOND_SPATIAL_PASS
|
||||
uint2 SpatialGuidancePacked = asuint(H_LOAD(_SpatialGuidance, pixCoord.xy).xy);
|
||||
float AmbientOcclusionFilterScale = UnpackAmbientOcclusion(SpatialGuidancePacked.y);
|
||||
uint SpatialGuidance = SpatialGuidancePacked.x;
|
||||
float FilterRadius = _FilterRadius;
|
||||
uint BufferOffset = 0;
|
||||
#else
|
||||
float AmbientOcclusionFilterScale = H_LOAD(_AmbientOcclusion, pixCoord.xy).x;
|
||||
|
||||
if (Luminance(Reservoir.Color * Reservoir.W) < 0.001)
|
||||
AmbientOcclusionFilterScale = AmbientOcclusionFilterScale > 0.4 ? 1 : AmbientOcclusionFilterScale;
|
||||
|
||||
float FilterRadius = _FilterRadius / 2.0f;
|
||||
uint SpatialGuidance = 0;
|
||||
uint BufferOffset = 8;
|
||||
#endif
|
||||
|
||||
float AdaptiveFilterScale;
|
||||
if (_DenoiseFallback) AdaptiveFilterScale = min(saturate(Reservoir.Distance / 2 + !Reservoir.HitFound), AmbientOcclusionFilterScale);
|
||||
else AdaptiveFilterScale = min(saturate(Reservoir.Distance / 2), AmbientOcclusionFilterScale);
|
||||
|
||||
float MinFilterRadius = lerp(0.01f, 0.1f, AmbientOcclusion);
|
||||
float AdaptivePlaneWeight = lerp(500.0f, 100.0f, AdaptiveFilterScale);
|
||||
|
||||
FilterRadius = max(MinFilterRadius, lerp(FilterRadius, FilterRadius * AdaptiveFilterScale, _FilterAdaptivity));
|
||||
|
||||
float3x3 OrthoBasis = HGetLocalFrame(Reservoir.Normal);
|
||||
float DistanceToPoint = length(H_GET_ABSOLUTE_POSITION_WS(PositionCenterWS) - H_GET_CAMERA_POSITION_WS());
|
||||
float RadiusScale = lerp(5.0f, 50.0f, saturate(DistanceToPoint / 500.0f));
|
||||
float Radius = DistanceToPoint * FilterRadius / RadiusScale;
|
||||
float Sigma = 0.9f * Radius;
|
||||
|
||||
float WeightTotal = 1;
|
||||
float2 TemporalInvalidity = 1, TemporalInvalidityAccumulated = 1;
|
||||
|
||||
if (VALIDATE_TEMPORAL_OCCLUSION || VALIDATE_TEMPORAL_LIGHTING)
|
||||
{ TemporalInvalidity = H_LOAD(_TemporalInvalidity, pixCoord.xy).xy; TemporalInvalidityAccumulated = TemporalInvalidity; }
|
||||
|
||||
UNITY_UNROLL
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
float GuidanceAdaptivity = 1 - (0.75 * ((SpatialGuidance >> i) & 0x1));
|
||||
float2 Point = _PointDistribution[i + BufferOffset].xy * Radius * GuidanceAdaptivity;
|
||||
|
||||
float3 PositionPointWS = PositionCenterWS + OrthoBasis[0] * Point.x + OrthoBasis[1] * Point.y;
|
||||
float2 SampleCoordNDC = H_COMPUTE_NDC_Z(PositionPointWS, H_MATRIX_VP).xy;
|
||||
int2 SampleCoord = SampleCoordNDC * _ScreenSize.xy / _HScaleFactorSSGI;
|
||||
|
||||
int2 Overshoot = max(SampleCoord - pixCoordMax, 0);
|
||||
SampleCoord = SampleCoord - 2 * Overshoot;
|
||||
|
||||
SpatialReservoir SampleReservoir = (SpatialReservoir)0;
|
||||
uint4 SampleReservoirPacked = asuint(H_LOAD(_Reservoir, SampleCoord));
|
||||
UnpackSpatialReservoir(SampleReservoirPacked, Diffuse, SampleReservoir);
|
||||
|
||||
float3 PositionSampleVS = ComputeFastViewSpacePosition(SampleCoordNDC, SampleReservoir.Depth, H_LINEAR_EYE_DEPTH(SampleReservoir.Depth));
|
||||
float PlaneWeight = ProbePlaneWeighting(NormalPlaneVS, PositionSampleVS, DepthCetnerLinear, AdaptivePlaneWeight);
|
||||
float NormalWeight = saturate(dot(Reservoir.Normal, SampleReservoir.Normal));
|
||||
float GaussianWeight = GaussianWeighting(length(Point), Sigma);
|
||||
float OcclusionWeight = 1.0f;
|
||||
|
||||
if (VALIDATE_SPATIAL_OCCLUSION)
|
||||
{ OcclusionWeight = exp2(-10 * abs(Reservoir.Occlusion - SampleReservoir.Occlusion)); }
|
||||
|
||||
float SampleWeight = PlaneWeight * NormalWeight * OcclusionWeight;
|
||||
SpatialGuidance |= (uint(round(1 - SampleWeight)) << i);
|
||||
|
||||
SampleWeight *= GaussianWeight * ENABLE_SPATIAL_RESTIR;
|
||||
|
||||
SampleReservoir.Wsum *= SampleWeight;
|
||||
SampleReservoir.M *= SampleWeight;
|
||||
ReservoirUpdate(SampleReservoir, Reservoir, ReservoirUpdateRandom);
|
||||
|
||||
WeightTotal += NormalWeight * PlaneWeight * GaussianWeight;
|
||||
|
||||
if (VALIDATE_TEMPORAL_OCCLUSION || VALIDATE_TEMPORAL_LIGHTING)
|
||||
{ TemporalInvalidityAccumulated += H_LOAD(_TemporalInvalidity, SampleCoord).xy * NormalWeight * PlaneWeight * GaussianWeight; }
|
||||
}
|
||||
|
||||
Reservoir.W = Reservoir.Wsum / max(Reservoir.M * Luminance(Reservoir.Color * Diffuse), 1e-8);
|
||||
float3 FinalColor = Reservoir.Color * Reservoir.W;
|
||||
|
||||
if (SECOND_SPATIAL_PASS)
|
||||
{
|
||||
if (VALIDATE_SPATIAL_OCCLUSION) // && Reservoir.HitFound)
|
||||
{
|
||||
float SpatialOcclusion = 1;
|
||||
const float3 RayDirectionWS = Reservoir.Direction;
|
||||
float StepJitter = Jitter((pixCoord.xy) * 2 - 1);
|
||||
|
||||
float3 RayOriginBiasedWS, RayStartPositionNDC, RayEndPositionNDC;
|
||||
GetRayOriginAndDirectionNDC(min(3, Reservoir.Distance), Reservoir.Depth, pixCoordNDC, PositionCenterWS, RayDirectionWS, Reservoir.Normal, RayOriginBiasedWS, RayStartPositionNDC, RayEndPositionNDC);
|
||||
|
||||
float4 HitData = RayMarchValidation(RayStartPositionNDC, RayEndPositionNDC, StepJitter);
|
||||
|
||||
if (HitData.w)
|
||||
{
|
||||
float3 HitPosition = H_COMPUTE_POSITION_WS(HitData.xy, HitData.z, H_MATRIX_I_VP);
|
||||
float HitDistance = distance(PositionCenterWS, HitPosition);
|
||||
|
||||
if (abs(HitDistance - Reservoir.Distance) / (Reservoir.Distance + Reservoir.Distance) > 0.2)
|
||||
{
|
||||
if (HitDistance < Reservoir.Distance)
|
||||
{
|
||||
SpatialOcclusion = saturate(HitDistance / 3.0f);
|
||||
|
||||
if (Reservoir.HitFound)
|
||||
{
|
||||
if (dot(HBUFFER_NORMAL_WS(HitData.xy * _ScreenSize.xy), RayDirectionWS) > _BackfaceLighting)
|
||||
{
|
||||
FinalColor *= saturate(HitDistance / 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float Samplecount = min(16, SamplecountReprojected + 1);
|
||||
float TemporalWeight = 1.0f - (1.0f / float(Samplecount));
|
||||
|
||||
float SpatialOcclusionReprojected = H_LOAD(_SpatialOcclusion, pixCoord.xy).x;
|
||||
SpatialOcclusion = lerp(SpatialOcclusion, SpatialOcclusionReprojected, TemporalWeight * pow(TemporalInvalidity.y, 2));
|
||||
_SpatialOcclusion_Output[H_COORD(pixCoord.xy)] = SpatialOcclusion;
|
||||
}
|
||||
|
||||
_Radiance_Output[H_COORD(pixCoord.xy)] = FinalColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
_SpatialGuidance_Output[H_COORD(pixCoord.xy)] = uint2(SpatialGuidance, PackAmbientOcclusion(AdaptiveFilterScale));
|
||||
_Reservoir_Output[H_COORD(pixCoord.xy)] = PackSpatialReservoir(Reservoir);
|
||||
}
|
||||
|
||||
if (VALIDATE_TEMPORAL_OCCLUSION || VALIDATE_TEMPORAL_LIGHTING)
|
||||
{ _TemporalInvalidity_Output[H_COORD(pixCoord.xy)] = TemporalInvalidityAccumulated / WeightTotal; }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97f6e36d045d93d4ea8ed934f8bc4a03
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Computes/HRestirSSGI.compute
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,438 @@
|
||||
#pragma kernel TemporalReprojection
|
||||
#pragma kernel ColorReprojection
|
||||
#pragma kernel CopyHistory
|
||||
#pragma kernel LuminanceMomentsGeneration
|
||||
#pragma kernel LuminanceMomentsClear
|
||||
|
||||
#include "../Includes/HReservoirSSGI.hlsl"
|
||||
#include "../Includes/HFallbackSSGI.hlsl"
|
||||
#pragma multi_compile _ _GBUFFER_NORMALS_OCT
|
||||
|
||||
#pragma multi_compile _ REPROJECT_COLOR
|
||||
#pragma multi_compile _ AUTOMATIC_BRIGHTNESS_CLAMP
|
||||
#pragma multi_compile _ REPROJECT_TEMPORAL_INVALIDITY
|
||||
#pragma multi_compile _ REPROJECT_SPATIAL_OCCLUSION
|
||||
#pragma multi_compile _ FULL_RESOLUTION_REPROJECTION
|
||||
|
||||
H_TEXTURE(_HTraceBufferGI);
|
||||
H_TEXTURE(_Color_History);
|
||||
H_TEXTURE(_NormalDepth_History);
|
||||
H_TEXTURE(_Radiance_History);
|
||||
H_TEXTURE(_Samplecount_History);
|
||||
H_TEXTURE(_SpatialOcclusion_History);
|
||||
H_TEXTURE(_TemporalInvalidity_History);
|
||||
H_TEXTURE(_AmbientOcclusion_History);
|
||||
|
||||
H_RW_TEXTURE(float, _AmbientOcclusion_Output);
|
||||
H_RW_TEXTURE(float2, _TemporalInvalidity_Output);
|
||||
H_RW_TEXTURE(float, _Samplecount_Output);
|
||||
H_RW_TEXTURE(float, _SpatialOcclusion_Output);
|
||||
H_RW_TEXTURE(float4, _Radiance_Output);
|
||||
H_RW_TEXTURE(uint, _ReprojectedColor_Output);
|
||||
|
||||
groupshared uint GroupMoment1;
|
||||
groupshared uint GroupMoment2;
|
||||
RWStructuredBuffer<uint> _LuminanceMoments;
|
||||
|
||||
float _BrightnessClamp;
|
||||
float _MaxDeviation;
|
||||
|
||||
|
||||
// ------------------------ REPROJECTION STRUCTS -----------------------
|
||||
struct CurrentFrameData
|
||||
{
|
||||
float3 Normal;
|
||||
float3 WorldPos;
|
||||
float DepthRaw;
|
||||
float DepthLinear;
|
||||
float2 RejectionPower;
|
||||
};
|
||||
|
||||
struct PreviousFrameData
|
||||
{
|
||||
float3 Normal;
|
||||
float3 WorldPos;
|
||||
float DepthLinear;
|
||||
};
|
||||
|
||||
|
||||
// ------------------------ REPROJECTION STRUCTS -----------------------
|
||||
float Disocclusion(CurrentFrameData CurrentData, PreviousFrameData PreviousData)
|
||||
{
|
||||
float Diosocclusion = 1;
|
||||
|
||||
float PlaneDistance = abs(dot(PreviousData.WorldPos - CurrentData.WorldPos, CurrentData.Normal));
|
||||
float RelativeDepthDifference = PlaneDistance / CurrentData.DepthLinear;
|
||||
if (exp2(-CurrentData.RejectionPower.x * (RelativeDepthDifference * RelativeDepthDifference)) < 0.1f)
|
||||
Diosocclusion = 0.0f;
|
||||
|
||||
if (abs((PreviousData.DepthLinear - CurrentData.DepthLinear) / CurrentData.DepthLinear) >= CurrentData.RejectionPower.y)
|
||||
Diosocclusion = 0.0f;
|
||||
|
||||
if (dot(PreviousData.Normal, CurrentData.Normal) < 0.5)
|
||||
Diosocclusion = 0.0f;
|
||||
|
||||
return Diosocclusion;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ COLOR REPROJECTION -----------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void ColorReprojection(uint3 pixCoord : SV_DispatchThreadID)
|
||||
{
|
||||
|
||||
bool MovingPixel = HBUFFER_MOTION_MASK(pixCoord.xy);
|
||||
float2 pixCoordNDC = (pixCoord.xy + 0.5f) / _ScreenSize.xy;
|
||||
|
||||
float3 Sky = EvaluateFallbackSky(H_GET_VIEW_VECTOR_WS(pixCoordNDC));
|
||||
|
||||
float LumaThreshold = _BrightnessClamp;
|
||||
|
||||
if (AUTOMATIC_BRIGHTNESS_CLAMP)
|
||||
{
|
||||
uint2 MomentsPacked;
|
||||
MomentsPacked.x = _LuminanceMoments[0];
|
||||
MomentsPacked.y = _LuminanceMoments[1];
|
||||
|
||||
float2 Moments;
|
||||
float Scale = 4294967295.0f / (30.0f * 30.0f);
|
||||
Moments.x = float(MomentsPacked.x) / Scale;
|
||||
Moments.y = float(MomentsPacked.y) / Scale;
|
||||
|
||||
float Variance = (max(0.0, Moments.y - Moments.x * Moments.x));
|
||||
float StdDev = sqrt(Variance);
|
||||
LumaThreshold = Moments.x + _MaxDeviation * StdDev;
|
||||
}
|
||||
|
||||
CurrentFrameData CurrentData;
|
||||
CurrentData.DepthRaw = HBUFFER_DEPTH(pixCoord.xy);
|
||||
CurrentData.Normal = HBUFFER_NORMAL_WS(pixCoord.xy);
|
||||
CurrentData.DepthLinear = H_LINEAR_EYE_DEPTH(CurrentData.DepthRaw);
|
||||
CurrentData.WorldPos = H_COMPUTE_POSITION_WS(pixCoordNDC, CurrentData.DepthRaw, H_MATRIX_I_VP);
|
||||
|
||||
const float DepthAligment = 1.0f - dot(-normalize(H_GET_ABSOLUTE_POSITION_WS((CurrentData.WorldPos)) - _WorldSpaceCameraPos), CurrentData.Normal);
|
||||
CurrentData.RejectionPower.x = 100000.0f * (MovingPixel ? 0.0001 * CurrentData.DepthLinear * CurrentData.DepthLinear : 1);
|
||||
CurrentData.RejectionPower.y = lerp(1e-2f, 1e-1f, pow(DepthAligment, 8)) * (MovingPixel ? 50 / CurrentData.DepthLinear : 1);
|
||||
|
||||
if (!REPROJECT_COLOR)
|
||||
{
|
||||
float3 ReprojectedColor = CurrentData.DepthRaw <= UNITY_RAW_FAR_CLIP_VALUE ? Sky : HBUFFER_COLOR(pixCoord.xy).xyz;
|
||||
|
||||
float ReprojectedColorLuma = Luminance(ReprojectedColor);
|
||||
if (ReprojectedColorLuma > LumaThreshold)
|
||||
ReprojectedColor *= (LumaThreshold / ReprojectedColorLuma);
|
||||
|
||||
_ReprojectedColor_Output[H_COORD(pixCoord.xy)] = PackColorHit(ReprojectedColor, MovingPixel);
|
||||
//return;
|
||||
}
|
||||
|
||||
float2 ReprojectionCoord = float2(pixCoord.xy) - HBUFFER_MOTION_VECTOR(pixCoord.xy) * floor(_ScreenSize.xy);
|
||||
ReprojectionCoord /= (HRenderScale.xy / HRenderScalePrevious.xy);
|
||||
|
||||
float UVx = frac(ReprojectionCoord.x);
|
||||
float UVy = frac(ReprojectionCoord.y);
|
||||
|
||||
float4 ReprojectionWeights;
|
||||
ReprojectionWeights.x = (1.0f - UVx) * (1.0f - UVy);
|
||||
ReprojectionWeights.y = (UVx) * (1.0f - UVy);
|
||||
ReprojectionWeights.z = (1.0f - UVx) * (UVy);
|
||||
ReprojectionWeights.w = (UVx) * (UVy);
|
||||
|
||||
const uint2 ReprojectionOffsets[4] = {uint2(0, 0), uint2(1, 0), uint2(0, 1), uint2(1, 1)};
|
||||
|
||||
UNITY_UNROLL
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
int2 SampleCoord = ReprojectionCoord + ReprojectionOffsets[i];
|
||||
uint HistoryNormalDepthPacked = asuint(H_LOAD(_NormalDepth_History, SampleCoord).x);
|
||||
float4 HistoryNormalDepth = UnpackNormalDepth(HistoryNormalDepthPacked);
|
||||
|
||||
SampleCoord /= (HRenderScalePrevious.xy / HRenderScale.xy);
|
||||
|
||||
PreviousFrameData PreviousData;
|
||||
PreviousData.Normal = HistoryNormalDepth.xyz;
|
||||
PreviousData.WorldPos = H_COMPUTE_POSITION_WS((SampleCoord + 0.5f) * _ScreenSize.zw, HistoryNormalDepth.w, H_MATRIX_PREV_I_VP);
|
||||
PreviousData.DepthLinear = H_LINEAR_EYE_DEPTH(PreviousData.WorldPos, UNITY_MATRIX_V);
|
||||
|
||||
ReprojectionWeights[i] *= Disocclusion(CurrentData, PreviousData);
|
||||
|
||||
if (CurrentData.DepthRaw <= UNITY_RAW_FAR_CLIP_VALUE)
|
||||
ReprojectionWeights[i] = 1;
|
||||
|
||||
if (any(SampleCoord.xy >= _ScreenSize.xy))
|
||||
ReprojectionWeights[i] = 0;
|
||||
}
|
||||
|
||||
float WeightsTotal = ReprojectionWeights.x + ReprojectionWeights.y + ReprojectionWeights.z + ReprojectionWeights.w;
|
||||
|
||||
float ReprojectedSamplecount = 0;
|
||||
float3 ReprojectedRadiance = 0;
|
||||
float3 ReprojectedColor = 0;
|
||||
|
||||
if (WeightsTotal > 0.15f)
|
||||
{
|
||||
ReprojectionWeights = WeightsTotal > 0 ? ReprojectionWeights / WeightsTotal : 0;
|
||||
|
||||
float BestWeight = 0;
|
||||
uint2 BestOffset = 0;
|
||||
|
||||
UNITY_UNROLL
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
float4 RadianceSamplecountHistory = H_LOAD(_Radiance_History, ReprojectionCoord + ReprojectionOffsets[i]) * ReprojectionWeights[i];
|
||||
ReprojectedSamplecount += RadianceSamplecountHistory.w;
|
||||
ReprojectedRadiance += RadianceSamplecountHistory.xyz;
|
||||
|
||||
// Select best reprojection for color
|
||||
if (ReprojectionWeights[i] > BestWeight)
|
||||
{
|
||||
BestWeight = ReprojectionWeights[i];
|
||||
BestOffset = ReprojectionOffsets[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (REPROJECT_COLOR)
|
||||
{
|
||||
ReprojectedColor = CurrentData.DepthRaw <= UNITY_RAW_FAR_CLIP_VALUE ? Sky : H_LOAD(_Color_History, ReprojectionCoord + BestOffset).xyz;
|
||||
|
||||
float ReprojectedColorLuma = Luminance(ReprojectedColor);
|
||||
if (ReprojectedColorLuma > LumaThreshold)
|
||||
ReprojectedColor *= (LumaThreshold / ReprojectedColorLuma);
|
||||
}
|
||||
}
|
||||
|
||||
_Radiance_Output[H_COORD(pixCoord.xy)] = float4(ReprojectedRadiance.xyz, ReprojectedSamplecount.x);
|
||||
_ReprojectedColor_Output[H_COORD(pixCoord.xy)] = PackColorHit(ReprojectedColor, MovingPixel);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ TEMPORAL REPROJECTION -----------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void TemporalReprojection(uint3 pixCoord : SV_DispatchThreadID)
|
||||
{
|
||||
|
||||
uint2 pixCoordUnscaled = GetUnscaledCoords(pixCoord.xy);
|
||||
float2 pixCoordNDC = (float2(pixCoordUnscaled) + 0.5f) / _ScreenSize.xy;
|
||||
|
||||
float3 Sky = EvaluateFallbackSky(H_GET_VIEW_VECTOR_WS(pixCoordNDC));
|
||||
|
||||
float LumaThreshold = _BrightnessClamp;
|
||||
|
||||
if (AUTOMATIC_BRIGHTNESS_CLAMP)
|
||||
{
|
||||
uint2 MomentsPacked;
|
||||
MomentsPacked.x = _LuminanceMoments[0];
|
||||
MomentsPacked.y = _LuminanceMoments[1];
|
||||
|
||||
float2 Moments;
|
||||
float Scale = 4294967295.0f / (30.0f * 30.0f);
|
||||
Moments.x = float(MomentsPacked.x) / Scale;
|
||||
Moments.y = float(MomentsPacked.y) / Scale;
|
||||
|
||||
float Variance = (max(0.0, Moments.y - Moments.x * Moments.x));
|
||||
float StdDev = sqrt(Variance);
|
||||
LumaThreshold = Moments.x + _MaxDeviation * StdDev;
|
||||
}
|
||||
|
||||
CurrentFrameData CurrentData;
|
||||
CurrentData.DepthRaw = HBUFFER_DEPTH(pixCoordUnscaled);
|
||||
CurrentData.Normal = HBUFFER_NORMAL_WS(pixCoordUnscaled);
|
||||
CurrentData.DepthLinear = H_LINEAR_EYE_DEPTH(CurrentData.DepthRaw);
|
||||
CurrentData.WorldPos = H_COMPUTE_POSITION_WS(pixCoordNDC, CurrentData.DepthRaw, H_MATRIX_I_VP);
|
||||
|
||||
bool MovingPixel = HBUFFER_MOTION_MASK(pixCoordUnscaled);
|
||||
float DepthAligment = 1.0f - dot(-normalize(H_GET_ABSOLUTE_POSITION_WS((CurrentData.WorldPos)) - _WorldSpaceCameraPos), CurrentData.Normal);
|
||||
CurrentData.RejectionPower.x = 100000.0f * (MovingPixel ? 0.0001 * CurrentData.DepthLinear * CurrentData.DepthLinear : 1);
|
||||
CurrentData.RejectionPower.y = lerp(1e-2f, 1e-1f, pow(DepthAligment, 8)) * (MovingPixel ? 50 / CurrentData.DepthLinear : 1);
|
||||
|
||||
float2 MotionVectors = HBUFFER_MOTION_VECTOR(pixCoordUnscaled);
|
||||
float2 ReprojectionCoord = float2(pixCoord.xy) - MotionVectors * floor(_ScreenSize.xy / _HScaleFactorSSGI);
|
||||
ReprojectionCoord /= (_HPreviousScaleFactorSSGI.xx / _HScaleFactorSSGI.xx);
|
||||
ReprojectionCoord /= (HRenderScale.xy / HRenderScalePrevious.xy);
|
||||
|
||||
float UVx = frac(ReprojectionCoord.x);
|
||||
float UVy = frac(ReprojectionCoord.y);
|
||||
|
||||
float4 ReprojectionWeights;
|
||||
ReprojectionWeights.x = (1.0f - UVx) * (1.0f - UVy);
|
||||
ReprojectionWeights.y = (UVx) * (1.0f - UVy);
|
||||
ReprojectionWeights.z = (1.0f - UVx) * (UVy);
|
||||
ReprojectionWeights.w = (UVx) * (UVy);
|
||||
|
||||
const uint2 ReprojectionOffsets[4] = {uint2(0, 0), uint2(1, 0), uint2(0, 1), uint2(1, 1)};
|
||||
|
||||
UNITY_UNROLL
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
int2 SampleCoord = ReprojectionCoord + ReprojectionOffsets[i];
|
||||
|
||||
uint HistoryNormalDepthPacked = asuint(H_LOAD(_NormalDepth_History, SampleCoord).x);
|
||||
float4 HistoryNormalDepth = UnpackNormalDepth(HistoryNormalDepthPacked);
|
||||
|
||||
SampleCoord /= (HRenderScalePrevious.xy / HRenderScale.xy);
|
||||
|
||||
PreviousFrameData PreviousData;
|
||||
PreviousData.Normal = HistoryNormalDepth.xyz;
|
||||
PreviousData.WorldPos = H_COMPUTE_POSITION_WS((SampleCoord * _HPreviousScaleFactorSSGI + 0.5f) * _ScreenSize.zw, HistoryNormalDepth.w, H_MATRIX_PREV_I_VP);
|
||||
PreviousData.DepthLinear = H_LINEAR_EYE_DEPTH(PreviousData.WorldPos, UNITY_MATRIX_V);
|
||||
|
||||
ReprojectionWeights[i] *= Disocclusion(CurrentData, PreviousData);
|
||||
|
||||
if (CurrentData.DepthRaw <= UNITY_RAW_FAR_CLIP_VALUE)
|
||||
ReprojectionWeights[i] = 1;
|
||||
|
||||
if (any(SampleCoord.xy >= _ScreenSize.xy / _HPreviousScaleFactorSSGI))
|
||||
ReprojectionWeights[i] = 0;
|
||||
}
|
||||
|
||||
float WeightsTotal = ReprojectionWeights.x + ReprojectionWeights.y + ReprojectionWeights.z + ReprojectionWeights.w;
|
||||
|
||||
TemporalReservoir Reservoir = (TemporalReservoir)0;
|
||||
float3 Diffuse = GetReservoirDiffuse(pixCoordUnscaled);
|
||||
|
||||
float Samplecount = 0;
|
||||
float ReprojectedAmbientOcclusion = 1;
|
||||
float ReprojectedSpatialOcclusion = 1;
|
||||
float2 ReprojectedTemporalInvalidity = 1;
|
||||
float3 ReprojectedColor = 0;
|
||||
float3 ReprojectedRadiance = 0;
|
||||
|
||||
if (WeightsTotal > 0.15f)
|
||||
{
|
||||
ReprojectionWeights /= WeightsTotal;
|
||||
|
||||
float BestWeight = 0;
|
||||
uint2 BestOffset = 0;
|
||||
ReprojectedSpatialOcclusion = 0;
|
||||
ReprojectedTemporalInvalidity = 0;
|
||||
ReprojectedAmbientOcclusion = 0;
|
||||
|
||||
uint ReservoirUpdateRandom = Hash3(uint3(pixCoord.xy, _FrameCount));
|
||||
|
||||
UNITY_UNROLL
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
// Reproject Spatial Occlusion
|
||||
if (REPROJECT_TEMPORAL_INVALIDITY) { ReprojectedTemporalInvalidity += H_LOAD(_TemporalInvalidity_History, ReprojectionCoord + ReprojectionOffsets[i]).xy * ReprojectionWeights[i]; }
|
||||
if (REPROJECT_SPATIAL_OCCLUSION) { ReprojectedSpatialOcclusion += H_LOAD(_SpatialOcclusion_History, ReprojectionCoord + ReprojectionOffsets[i]).x * ReprojectionWeights[i]; }
|
||||
ReprojectedAmbientOcclusion += H_LOAD(_AmbientOcclusion_History, ReprojectionCoord + ReprojectionOffsets[i]).x * ReprojectionWeights[i];
|
||||
ReprojectedRadiance += H_LOAD(_Radiance_History, ReprojectionCoord + ReprojectionOffsets[i]).xyz * ReprojectionWeights[i];
|
||||
Samplecount += H_LOAD(_Samplecount_History, ReprojectionCoord + ReprojectionOffsets[i]).x * ReprojectionWeights[i];
|
||||
|
||||
// Reproject ReSTIR reservoir
|
||||
TemporalReservoir HistoryReservoir = (TemporalReservoir)0;
|
||||
UnpackTemporalReservoir(asuint(H_LOAD(_Reservoir, ReprojectionCoord + ReprojectionOffsets[i])), Diffuse, HistoryReservoir);
|
||||
|
||||
HistoryReservoir.Wsum *= ReprojectionWeights[i];
|
||||
HistoryReservoir.M *= ReprojectionWeights[i];
|
||||
|
||||
ReservoirUpdate(HistoryReservoir, Reservoir, ReservoirUpdateRandom);
|
||||
|
||||
// Select best reprojection for color
|
||||
if (ReprojectionWeights[i] > BestWeight)
|
||||
{
|
||||
BestWeight = ReprojectionWeights[i];
|
||||
BestOffset = ReprojectionOffsets[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Reproject Color
|
||||
if (FULL_RESOLUTION_REPROJECTION && REPROJECT_COLOR)
|
||||
{
|
||||
// Use original reprojection coord to avoid reading Color buffer in wrong location (scaled by _HScaleFactorSSGI / _HPreviousScaleFactorSSGI)
|
||||
float2 ReprojectionCoord = float2(pixCoord.xy) - MotionVectors * floor(_ScreenSize.xy / _HScaleFactorSSGI);
|
||||
ReprojectionCoord /= (HRenderScale.xy / HRenderScalePrevious.xy);
|
||||
|
||||
ReprojectedColor = CurrentData.DepthRaw <= UNITY_RAW_FAR_CLIP_VALUE ? Sky : H_LOAD(_Color_History, ReprojectionCoord + BestOffset).xyz;
|
||||
|
||||
float ReprojectedColorLuma = Luminance(ReprojectedColor);
|
||||
if (ReprojectedColorLuma > LumaThreshold)
|
||||
ReprojectedColor *= (LumaThreshold / ReprojectedColorLuma);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reservoir.W = Reservoir.Wsum / max(Reservoir.M * Luminance(Reservoir.Color * Diffuse), 1e-8);
|
||||
|
||||
_Samplecount_Output[H_COORD(pixCoord.xy)] = Samplecount;
|
||||
_Radiance_Output[H_COORD(pixCoord.xy)] = float4(ReprojectedRadiance.xyz, 0);
|
||||
_Reservoir_Output[H_COORD(pixCoord.xy)] = PackTemporalReservoir(Reservoir);
|
||||
_AmbientOcclusion_Output[H_COORD(pixCoord.xy)] = ReprojectedAmbientOcclusion;
|
||||
|
||||
if (!REPROJECT_COLOR)
|
||||
{
|
||||
ReprojectedColor = CurrentData.DepthRaw <= UNITY_RAW_FAR_CLIP_VALUE ? Sky : HBUFFER_COLOR(pixCoord.xy).xyz;
|
||||
|
||||
float ReprojectedColorLuma = Luminance(ReprojectedColor);
|
||||
if (ReprojectedColorLuma > LumaThreshold)
|
||||
ReprojectedColor *= (LumaThreshold / ReprojectedColorLuma);
|
||||
}
|
||||
|
||||
if (FULL_RESOLUTION_REPROJECTION) { _ReprojectedColor_Output[H_COORD(pixCoordUnscaled)] = PackColorHit(ReprojectedColor, MovingPixel); }
|
||||
if (REPROJECT_SPATIAL_OCCLUSION) { _SpatialOcclusion_Output[H_COORD(pixCoord.xy)] = ReprojectedSpatialOcclusion; }
|
||||
if (REPROJECT_TEMPORAL_INVALIDITY) { _TemporalInvalidity_Output[H_COORD(pixCoord.xy)] = ReprojectedTemporalInvalidity; }
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ HISTORY COPYING -----------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void CopyHistory(uint3 pixCoord : SV_DispatchThreadID)
|
||||
{
|
||||
|
||||
float3 IndirectLighting = H_LOAD(_HTraceBufferGI, pixCoord.xy).xyz;
|
||||
float3 DiffuseColor = HBUFFER_DIFFUSE(pixCoord.xy).xyz;
|
||||
float Metallic = H_LOAD(g_HTraceGBuffer1, pixCoord.xy).x;
|
||||
|
||||
// No Indirect Intensity multiplier here to avoid overblown lighting through the temporal loop
|
||||
float3 FinalIndirectLighting = IndirectLighting * DiffuseColor * (1 - Metallic);
|
||||
|
||||
_Radiance_Output[H_COORD(pixCoord.xy)] = float4(HBUFFER_COLOR(pixCoord.xy).xyz + FinalIndirectLighting, 0);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ LUMINANCE MOMENTS GENERATION ------------------------
|
||||
[numthreads(8, 8, 1)]
|
||||
void LuminanceMomentsGeneration(uint3 pixCoord : SV_DispatchThreadID, uint groupIndex : SV_GroupIndex)
|
||||
{
|
||||
if (groupIndex == 0)
|
||||
{ GroupMoment1 = 0; GroupMoment2 = 0;}
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
// We don't reproject this buffer even if it's from the prev. frame because it's fine for this operation
|
||||
float2 pixCoordNDC = float2(pixCoord.xy + 0.5) * _ScreenSize.zw;
|
||||
float3 Color = HBUFFER_DEPTH(pixCoord.xy).x <= UNITY_RAW_FAR_CLIP_VALUE ? EvaluateFallbackSky(H_GET_VIEW_VECTOR_WS(pixCoordNDC)) : H_LOAD(_Color_History, pixCoord.xy).xyz;
|
||||
float Luma = Luminance(Color);
|
||||
Luma = clamp(Luma, 0.0, 30);
|
||||
|
||||
float Scale = 4294967295.0f / (30.0f * 30.0f);
|
||||
uint Moment1 = uint(Luma * Scale / 64.0f);
|
||||
uint Moment2 = uint(Luma * Luma * Scale / 64.0f);
|
||||
|
||||
InterlockedAdd(GroupMoment1, Moment1);
|
||||
InterlockedAdd(GroupMoment2, Moment2);
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
UNITY_BRANCH
|
||||
if (groupIndex == 0)
|
||||
{
|
||||
float2 Moments = 0;
|
||||
Moments.x = float(GroupMoment1);
|
||||
Moments.y = float(GroupMoment2);
|
||||
|
||||
GroupMoment1 = uint(Moments.x / (_ScreenSize.x * _ScreenSize.y / 64));
|
||||
GroupMoment2 = uint(Moments.y / (_ScreenSize.x * _ScreenSize.y / 64));
|
||||
|
||||
uint Index = 0;
|
||||
InterlockedAdd(_LuminanceMoments[0], GroupMoment1, Index);
|
||||
InterlockedAdd(_LuminanceMoments[1], GroupMoment2, Index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ LUMINANCE MOMENTS CLEAR ------------------------
|
||||
[numthreads(1, 1, 1)]
|
||||
void LuminanceMomentsClear(uint3 pixCoord : SV_DispatchThreadID, uint2 groupThreadID : SV_GroupThreadID)
|
||||
{
|
||||
_LuminanceMoments[0] = 0;
|
||||
_LuminanceMoments[1] = 0;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c91b570672b56b14ca13f188b77120ab
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Computes/HTemporalReprojectionSSGI.compute
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,62 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-7993483843299501905
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 3
|
||||
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: 6bd486065ce11414fa40e631affc4900, type: 3}
|
||||
m_Name: ProbeVolumesOptions
|
||||
m_EditorClassIdentifier:
|
||||
active: 0
|
||||
normalBias:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
viewBias:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
scaleBiasWithMinProbeDistance:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
samplingNoise:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0
|
||||
animateSamplingNoise:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0
|
||||
leakReductionMode:
|
||||
m_OverrideState: 0
|
||||
m_Value: 2
|
||||
minValidDotProductValue:
|
||||
m_OverrideState: 0
|
||||
m_Value: 0.1
|
||||
occlusionOnlyReflectionNormalization:
|
||||
m_OverrideState: 0
|
||||
m_Value: 1
|
||||
intensityMultiplier:
|
||||
m_OverrideState: 0
|
||||
m_Value: 1
|
||||
skyOcclusionIntensityMultiplier:
|
||||
m_OverrideState: 0
|
||||
m_Value: 1
|
||||
worldOffset:
|
||||
m_OverrideState: 0
|
||||
m_Value: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
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: d7fd9488000d3734a9e00ee676215985, type: 3}
|
||||
m_Name: HTraceSSGI Volume Profile URP
|
||||
m_EditorClassIdentifier:
|
||||
components:
|
||||
- {fileID: -7993483843299501905}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ace954f626dae2f42bd7ce088bf3a88f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/HTraceSSGI Volume Profile URP.asset
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d45cf09bd8aeb74da02a17745b1a2fb
|
||||
timeCreated: 1659620468
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6fd27422052b4b24fa14bee0cd9faf8f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
// Hue, Saturation, Value
|
||||
// Ranges:
|
||||
// Hue [0.0, 1.0]
|
||||
// Sat [0.0, 1.0]
|
||||
// Lum [0.0, HALF_MAX]
|
||||
float3 RgbToHsv(float3 c)
|
||||
{
|
||||
const float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
float4 p = lerp(float4(c.bg, K.wz), float4(c.gb, K.xy), step(c.b, c.g));
|
||||
float4 q = lerp(float4(p.xyw, c.r), float4(c.r, p.yzx), step(p.x, c.r));
|
||||
float d = q.x - min(q.w, q.y);
|
||||
const float e = 1.0e-4;
|
||||
return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
}
|
||||
|
||||
float3 HsvToRgb(float3 c)
|
||||
{
|
||||
const float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f691d60f06346958b6ee703007d2346
|
||||
timeCreated: 1747411471
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Headers/HDRP files/Color.hlsl
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
|
||||
Texture2D<float> g_OwenScrambledTexture;
|
||||
Texture2D<float> g_ScramblingTileXSPP;
|
||||
Texture2D<float> g_RankingTileXSPP;
|
||||
Texture2D<float2> g_ScramblingTexture;
|
||||
|
||||
float ScramblingValueFloat(uint2 pixelCoord)
|
||||
{
|
||||
pixelCoord = pixelCoord & 255;
|
||||
return g_ScramblingTexture[uint2(pixelCoord.x, pixelCoord.y)].x;
|
||||
}
|
||||
|
||||
float2 ScramblingValueFloat2(uint2 pixelCoord)
|
||||
{
|
||||
pixelCoord = pixelCoord & 255;
|
||||
return g_ScramblingTexture[uint2(pixelCoord.x, pixelCoord.y)].xy;
|
||||
}
|
||||
|
||||
uint ScramblingValueUInt(uint2 pixelCoord)
|
||||
{
|
||||
pixelCoord = pixelCoord & 255;
|
||||
return clamp((uint)(g_ScramblingTexture[uint2(pixelCoord.x, pixelCoord.y)].x * 256.0), 0, 255);
|
||||
}
|
||||
|
||||
uint2 ScramblingValueUInt2(uint2 pixelCoord)
|
||||
{
|
||||
pixelCoord = pixelCoord & 255;
|
||||
return clamp((uint2)(g_ScramblingTexture[uint2(pixelCoord.x, pixelCoord.y)] * 256.0), uint2(0,0), uint2(255, 255));
|
||||
}
|
||||
|
||||
// Wrapper to sample the scrambled low Low-Discrepancy sequence (returns a float)
|
||||
float GetLDSequenceSampleFloat(uint sampleIndex, uint sampleDimension)
|
||||
{
|
||||
// Make sure arguments are in the right range
|
||||
sampleIndex = sampleIndex & 255;
|
||||
// sampleDimension = sampleDimension & 255;
|
||||
|
||||
// Fetch the sequence value and return it
|
||||
return g_OwenScrambledTexture[uint2(sampleDimension, sampleIndex)];
|
||||
}
|
||||
|
||||
// Wrapper to sample the scrambled low Low-Discrepancy sequence (returns an unsigned int)
|
||||
uint GetLDSequenceSampleUInt(uint sampleIndex, uint sampleDimension)
|
||||
{
|
||||
// Make sure arguments are in the right range
|
||||
sampleIndex = sampleIndex & 255;
|
||||
// sampleDimension = sampleDimension & 255;
|
||||
|
||||
// Fetch the sequence value and return it
|
||||
return clamp((uint)(g_OwenScrambledTexture[uint2(sampleDimension, sampleIndex)] * 256.0), 0, 255);
|
||||
}
|
||||
|
||||
// This is an implementation of the method from the paper
|
||||
// "A Low-Discrepancy Sampler that Distributes Monte Carlo Errors as a Blue Noise in Screen Space" by Heitz et al.
|
||||
float GetBNDSequenceSample(uint2 pixelCoord, uint sampleIndex, uint sampleDimension)
|
||||
{
|
||||
// wrap arguments
|
||||
pixelCoord = pixelCoord & 127;
|
||||
sampleIndex = sampleIndex & 255;
|
||||
sampleDimension = sampleDimension & 255;
|
||||
|
||||
// xor index based on optimized ranking
|
||||
uint rankingIndex = (pixelCoord.x + pixelCoord.y * 128) * 8 + (sampleDimension & 7);
|
||||
uint rankedSampleIndex = sampleIndex ^ clamp((uint)(g_RankingTileXSPP[uint2(rankingIndex & 127, rankingIndex / 128)] * 256.0), 0, 255);
|
||||
|
||||
// fetch value in sequence
|
||||
uint value = clamp((uint)(g_OwenScrambledTexture[uint2(sampleDimension, rankedSampleIndex.x)] * 256.0), 0, 255);
|
||||
|
||||
// If the dimension is optimized, xor sequence value based on optimized scrambling
|
||||
uint scramblingIndex = (pixelCoord.x + pixelCoord.y * 128) * 8 + (sampleDimension & 7);
|
||||
float scramblingValue = min(g_ScramblingTileXSPP[uint2(scramblingIndex & 127, scramblingIndex / 128)], 0.999);
|
||||
value = value ^ uint(scramblingValue * 256.0);
|
||||
|
||||
// Convert to float (to avoid the same 1/256th quantization everywhere, we jitter by the pixel scramblingValue)
|
||||
return (scramblingValue + value) / 256.0;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65e6e8fcb728c8c4c84222455e57dc80
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Headers/HDRP files/RaytracingSampling.hlsl
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,219 @@
|
||||
//pipelinedefine
|
||||
#define H_URP
|
||||
|
||||
#ifndef HMAIN_INCLUDED
|
||||
#define HMAIN_INCLUDED
|
||||
|
||||
// TODO: check if we need all these includes or some can be removed?
|
||||
// --------------------------------- INCLUDE FILES ----------------------------- //
|
||||
|
||||
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareOpaqueTexture.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Sampling.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
||||
|
||||
|
||||
// --------------------------------- VALUES ----------------------------- //
|
||||
|
||||
float4 _HRenderScale;
|
||||
float4 _HRenderScalePrevious;
|
||||
|
||||
#define HRenderScale _HRenderScale
|
||||
#define HRenderScalePrevious _HRenderScalePrevious
|
||||
|
||||
|
||||
uint _FrameCount;
|
||||
|
||||
|
||||
// --------------------------------- CONSTANTS ----------------------------- //
|
||||
#define H_TWO_PI (6.28318530718f)
|
||||
#define H_PI (3.1415926535897932384626433832795)
|
||||
#define H_PI_HALF (1.5707963267948966192313216916398)
|
||||
|
||||
|
||||
// --------------------------------- TEXTURE SAMPLERS ----------------------------- //
|
||||
|
||||
|
||||
SamplerState sampler_point_clamp;
|
||||
SamplerState sampler_linear_clamp;
|
||||
SamplerState sampler_point_repeat;
|
||||
SamplerState sampler_point_mirror;
|
||||
SamplerState sampler_linear_repeat;
|
||||
SamplerState sampler_trilinear_clamp;
|
||||
|
||||
#define H_SAMPLER_POINT_CLAMP sampler_point_clamp
|
||||
#define H_SAMPLER_LINEAR_CLAMP sampler_linear_clamp
|
||||
#define H_SAMPLER_LINEAR_REPEAT sampler_linear_repeat
|
||||
#define H_SAMPLER_TRILINEAR_CLAMP sampler_trilinear_clamp
|
||||
|
||||
|
||||
// --------------------------------- TEXTURE READ / WRITE HELPERS ----------------------------- //
|
||||
|
||||
|
||||
#define H_COORD(pixelCoord) uint2(pixelCoord) //todo: do we need defines for VR?
|
||||
#define H_INDEX_ARRAY(slot) (slot)
|
||||
|
||||
|
||||
// ----------------------------- TEXTURE PROPERTY DECLARATIONS ----------------------------- //
|
||||
|
||||
|
||||
#define H_TEXTURE(textureName) TEXTURE2D(textureName)
|
||||
#define H_TEXTURE_ARRAY(textureName) TEXTURE2D_ARRAY(textureName)
|
||||
|
||||
#define H_RW_TEXTURE(type, textureName) RW_TEXTURE2D(type, textureName)
|
||||
#define H_RW_TEXTURE_ARRAY(type, textureName) RW_TEXTURE2D_ARRAY(type, textureName)
|
||||
|
||||
|
||||
// ----------------------------- TEXTURE FETCH ----------------------------- //
|
||||
|
||||
|
||||
#define H_LOAD(textureName, unCoord2) LOAD_TEXTURE2D(textureName, unCoord2)
|
||||
#define H_LOAD_LOD(textureName, unCoord2, lod) LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod)
|
||||
#define H_LOAD_ARRAY(textureName, unCoord2, index) LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index)
|
||||
#define H_LOAD_ARRAY_LOD(textureName, unCoord2, index, lod) LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod)
|
||||
|
||||
#define H_SAMPLE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2)
|
||||
#define H_SAMPLE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod)
|
||||
#define H_SAMPLE_ARRAY(textureName, samplerName, coord2, index) SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index)
|
||||
#define H_SAMPLE_ARRAY_LOD(textureName, samplerName, coord2, index, lod) SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod)
|
||||
|
||||
#define H_GATHER_RED(textureName, samplerName, coord2, offset) GATHER_RED_TEXTURE2D(textureName, samplerName, coord2)
|
||||
#define H_GATHER_BLUE(textureName, samplerName, coord2, offset) GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2)
|
||||
#define H_GATHER_GREEN(textureName, samplerName, coord2, offset) GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2)
|
||||
#define H_GATHER_ALPHA(textureName, samplerName, coord2, offset) GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2)
|
||||
|
||||
|
||||
// ---------------------------------- MATRICES ----------------------------- //
|
||||
|
||||
|
||||
float4x4 _H_MATRIX_I_P;
|
||||
float4x4 _H_MATRIX_PREV_VP;
|
||||
float4x4 _H_MATRIX_PREV_I_VP;
|
||||
|
||||
#define H_MATRIX_PREV_VP _H_MATRIX_PREV_VP
|
||||
#define H_MATRIX_PREV_I_VP _H_MATRIX_PREV_I_VP
|
||||
#define H_MATRIX_I_VP UNITY_MATRIX_I_VP
|
||||
#define H_MATRIX_I_P UNITY_MATRIX_I_P
|
||||
#define H_MATRIX_VP UNITY_MATRIX_VP
|
||||
#define H_MATRIX_V UNITY_MATRIX_V
|
||||
#define H_MATRIX_I_V UNITY_MATRIX_I_V
|
||||
|
||||
|
||||
// ------------------------------------- GBUFFER RESOURCES ----------------------------- //
|
||||
|
||||
float4 H_SHAr;
|
||||
float4 H_SHAg;
|
||||
float4 H_SHAb;
|
||||
float4 H_SHBr;
|
||||
float4 H_SHBg;
|
||||
float4 H_SHBb;
|
||||
float4 H_SHC;
|
||||
|
||||
H_TEXTURE(g_HTraceGBuffer0);
|
||||
H_TEXTURE(g_HTraceGBuffer1);
|
||||
H_TEXTURE(g_HTraceGBuffer2);
|
||||
H_TEXTURE(g_HTraceGBuffer3);
|
||||
|
||||
H_TEXTURE(g_HTraceDepth);
|
||||
H_TEXTURE(g_HTraceDepthPyramidSSGI);
|
||||
H_TEXTURE(g_HTraceColor);
|
||||
H_TEXTURE(g_HTraceMotionMask);
|
||||
H_TEXTURE(g_HTraceMotionVectors);
|
||||
H_TEXTURE(g_HTraceRenderLayerMask);
|
||||
|
||||
H_TEXTURE(g_HTraceSSAO);
|
||||
|
||||
|
||||
|
||||
// --------------------------------- GBUFFER FETCH ----------------------------- //
|
||||
#define HBUFFER_NORMAL_WS(pixCoord) GetNormalWS(pixCoord)
|
||||
#define HBUFFER_ROUGHNESS(pixCoord) GetRoughness(pixCoord)
|
||||
#define HBUFFER_DEPTH(pixCoord) GetDepth(pixCoord)
|
||||
#define HBUFFER_COLOR(pixCoord) GetColor(pixCoord)
|
||||
#define HBUFFER_DIFFUSE(pixCoord) GetDiffuse(pixCoord)
|
||||
#define HBUFFER_MOTION_VECTOR(pixCoord) GetMotionVectors(pixCoord)
|
||||
#define HBUFFER_MOTION_MASK(pixCoord) GetMotionMask(pixCoord)
|
||||
#define HBUFFER_RENDER_LAYER_MASK(pixCoord) GetRenderLayerMask(pixCoord)
|
||||
|
||||
float3 GetNormalWS(uint2 pixCoord)
|
||||
{
|
||||
|
||||
|
||||
float3 Normal = H_LOAD(g_HTraceGBuffer2, pixCoord).xyz;
|
||||
#if defined(_GBUFFER_NORMALS_OCT)
|
||||
float2 RemappedOctNormalWS = Unpack888ToFloat2(Normal);
|
||||
float2 OctNormalWS = RemappedOctNormalWS.xy * 2.0 - 1.0;
|
||||
Normal = UnpackNormalOctQuadEncode(OctNormalWS);
|
||||
#endif
|
||||
return Normal;
|
||||
}
|
||||
|
||||
float GetDepth(uint2 pixCoord)
|
||||
{
|
||||
|
||||
|
||||
return H_LOAD(g_HTraceDepth, pixCoord).x;
|
||||
}
|
||||
|
||||
float4 GetColor(uint2 pixCoord)
|
||||
{
|
||||
|
||||
|
||||
return H_LOAD(g_HTraceColor, pixCoord);
|
||||
}
|
||||
|
||||
float4 GetDiffuse(uint2 pixCoord)
|
||||
{
|
||||
|
||||
|
||||
return H_LOAD(g_HTraceGBuffer0, pixCoord).xyzw;
|
||||
}
|
||||
|
||||
|
||||
float2 GetMotionVectors(uint2 pixCoord)
|
||||
{
|
||||
|
||||
|
||||
return H_LOAD(g_HTraceMotionVectors, pixCoord).xy;
|
||||
}
|
||||
|
||||
|
||||
float GetMotionMask(uint2 pixCoord)
|
||||
{
|
||||
|
||||
|
||||
return any(H_LOAD(g_HTraceMotionMask, pixCoord).xy != 0);
|
||||
}
|
||||
|
||||
uint GetRenderLayerMask(uint2 pixCoord)
|
||||
{
|
||||
#if UNITY_VERSION >= 600000
|
||||
|
||||
|
||||
|
||||
#if UNITY_VERSION >= 60020000
|
||||
return asuint(H_LOAD(g_HTraceRenderLayerMask, pixCoord.xy).x);
|
||||
#else
|
||||
float4 RenderLayers = H_LOAD(g_HTraceRenderLayerMask, pixCoord.xy);
|
||||
return DecodeMeshRenderingLayer(RenderLayers.x);
|
||||
#endif
|
||||
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ---------------------------------- OTHER -----------------------------------------
|
||||
|
||||
|
||||
|
||||
#define HGetInversePreviousExposureMultiplier 1
|
||||
#define HGetInverseCurrentExposureMultiplier 1
|
||||
#define HGetCurrentExposureMultiplier 1
|
||||
#define HGetPreviousExposureMultiplier 1
|
||||
|
||||
#endif // HMAIN_INCLUDED
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4c2fc6c03cd9d5449598ccc2642ba20
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Headers/HMain.hlsl
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,154 @@
|
||||
#pragma once
|
||||
|
||||
#define FLT_MIN 1.175494351e-38
|
||||
#define FLT_MAX 3.402823466e+38
|
||||
|
||||
float3 HSafeNormalize(float3 inVec)
|
||||
{
|
||||
float dp3 = max(FLT_MIN, dot(inVec, inVec));
|
||||
return inVec * rsqrt(dp3);
|
||||
}
|
||||
|
||||
float HSinFromCos(float cosX)
|
||||
{
|
||||
return sqrt(saturate(1 - cosX * cosX));
|
||||
}
|
||||
|
||||
float HFastSqrt(float x)
|
||||
{
|
||||
return (asfloat(0x1fbd1df5 + (asint(x) >> 1)));
|
||||
}
|
||||
|
||||
float HFastACos( float inX )
|
||||
{
|
||||
float pi = 3.141593;
|
||||
float half_pi = 1.570796;
|
||||
float x = abs(inX);
|
||||
float res = -0.156583 * x + half_pi;
|
||||
res *= HFastSqrt(1.0 - x);
|
||||
return (inX >= 0) ? res : pi - res;
|
||||
}
|
||||
|
||||
float3x3 HGetLocalFrame(float3 localZ)
|
||||
{
|
||||
float x = localZ.x;
|
||||
float y = localZ.y;
|
||||
float z = localZ.z;
|
||||
|
||||
|
||||
float sz = FastSign(z);
|
||||
float a = 1 / (sz + z);
|
||||
float ya = y * a;
|
||||
float b = x * ya;
|
||||
float c = x * sz;
|
||||
|
||||
float3 localX = float3(c * x * a - 1, sz * b, c);
|
||||
float3 localY = float3(b, y * ya - sz, y);
|
||||
|
||||
return float3x3(localX, localY, localZ);
|
||||
}
|
||||
|
||||
float2 HSampleDiskCubic(float u1, float u2)
|
||||
{
|
||||
float r = u1;
|
||||
float phi = 6.28318530718f * u2;
|
||||
|
||||
float sinPhi, cosPhi;
|
||||
sincos(phi, sinPhi, cosPhi);
|
||||
|
||||
return r * float2(cosPhi, sinPhi);
|
||||
}
|
||||
|
||||
float3 HSphericalToCartesian(float cosPhi, float sinPhi, float cosTheta)
|
||||
{
|
||||
float sinTheta = HSinFromCos(cosTheta);
|
||||
return float3(float2(cosPhi, sinPhi) * sinTheta, cosTheta);
|
||||
}
|
||||
|
||||
float3 HSphericalToCartesian(float phi, float cosTheta)
|
||||
{
|
||||
float sinPhi, cosPhi;
|
||||
sincos(phi, sinPhi, cosPhi);
|
||||
return HSphericalToCartesian(cosPhi, sinPhi, cosTheta);
|
||||
}
|
||||
|
||||
float3 HSampleSphereUniform(float u1, float u2)
|
||||
{
|
||||
float phi = 6.28318530718f * u2;
|
||||
float cosTheta = 1.0 - 2.0 * u1;
|
||||
return HSphericalToCartesian(phi, cosTheta);
|
||||
}
|
||||
|
||||
float3 HSampleHemisphereCosine(float u1, float u2, float3 normal)
|
||||
{
|
||||
float3 pointOnSphere = HSampleSphereUniform(u1, u2);
|
||||
return HSafeNormalize(normal + pointOnSphere);
|
||||
}
|
||||
|
||||
|
||||
float2 HLineBoxIntersect(float3 RayOrigin, float3 RayEnd, float3 BoxMin, float3 BoxMax)
|
||||
{
|
||||
float3 InvRayDir = 1.0f / (RayEnd - RayOrigin);
|
||||
|
||||
float3 FirstPlaneIntersections = (BoxMin - RayOrigin) * InvRayDir;
|
||||
float3 SecondPlaneIntersections = (BoxMax - RayOrigin) * InvRayDir;
|
||||
float3 ClosestPlaneIntersections = min(FirstPlaneIntersections, SecondPlaneIntersections);
|
||||
float3 FurthestPlaneIntersections = max(FirstPlaneIntersections, SecondPlaneIntersections);
|
||||
|
||||
float2 BoxIntersections;
|
||||
BoxIntersections.x = max(ClosestPlaneIntersections.x, max(ClosestPlaneIntersections.y, ClosestPlaneIntersections.z));
|
||||
BoxIntersections.y = min(FurthestPlaneIntersections.x, min(FurthestPlaneIntersections.y, FurthestPlaneIntersections.z));
|
||||
return saturate(BoxIntersections);
|
||||
}
|
||||
|
||||
float HUintToFloat01(uint h)
|
||||
{
|
||||
static const uint MantissaMask = 0x007FFFFFu;
|
||||
static const uint One = 0x3F800000u;
|
||||
|
||||
h &= MantissaMask;
|
||||
h |= One;
|
||||
|
||||
float r2 = asfloat(h);
|
||||
return r2 - 1.0;
|
||||
}
|
||||
|
||||
uint Hash_Combine(uint x, uint y)
|
||||
{
|
||||
static const uint M = 1664525u, C = 1013904223u;
|
||||
uint seed = (x * M + y + C) * M;
|
||||
|
||||
seed ^= (seed >> 11u);
|
||||
seed ^= (seed << 7u) & 0x9d2c5680u;
|
||||
seed ^= (seed << 15u) & 0xefc60000u;
|
||||
seed ^= (seed >> 18u);
|
||||
return seed;
|
||||
}
|
||||
|
||||
uint Hash1(uint x)
|
||||
{
|
||||
x += (x << 10u);
|
||||
x ^= (x >> 6u);
|
||||
x += (x << 3u);
|
||||
x ^= (x >> 11u);
|
||||
x += (x << 15u);
|
||||
return x;
|
||||
}
|
||||
|
||||
uint Hash2(uint2 v)
|
||||
{
|
||||
return Hash_Combine(v.x, Hash1(v.y));
|
||||
}
|
||||
|
||||
uint Hash3(uint3 v)
|
||||
{
|
||||
return Hash_Combine(v.x, Hash2(v.yz));
|
||||
}
|
||||
|
||||
uint Hash1Mutate(inout uint h)
|
||||
{
|
||||
uint Res = h;
|
||||
h = Hash1(h);
|
||||
return Res;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9742473896537694a88a5b10866e1a9c
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Headers/HMath.hlsl
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,144 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
|
||||
// --------------------------------- GET CAMERA POSITION
|
||||
float3 H_GET_CAMERA_POSITION_WS()
|
||||
{
|
||||
|
||||
|
||||
return _WorldSpaceCameraPos;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------- GET ABSOLUTE WS POSITION
|
||||
float3 H_GET_ABSOLUTE_POSITION_WS(float3 PositionWS)
|
||||
{
|
||||
|
||||
|
||||
return PositionWS;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------- GET RELATIVE WS POSITION
|
||||
float3 H_GET_RELATIVE_POSITION_WS(float3 PositionWS)
|
||||
{
|
||||
|
||||
|
||||
return GetCameraRelativePositionWS(PositionWS);
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------- GET NORMALIZED WS VIEW DIRECTION
|
||||
float3 H_GET_VIEW_DIRECTION_WS(float3 PositionWS)
|
||||
{
|
||||
float3 ViewDirectionWS = H_GET_CAMERA_POSITION_WS() - H_GET_ABSOLUTE_POSITION_WS(PositionWS);
|
||||
return normalize(ViewDirectionWS);
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------- GET NORMALIZED WS VIEW VECTOR
|
||||
float3 H_GET_VIEW_VECTOR_WS(float2 pixCoordNDC)
|
||||
{
|
||||
float4 PositionVS = mul(H_MATRIX_I_P, float4(pixCoordNDC * 2.0 - 1.0, 1.0, 1.0));
|
||||
float3 DirectionVS = normalize(float3(PositionVS.x, -PositionVS.y, PositionVS.z));
|
||||
return normalize(mul((float3x3)H_MATRIX_I_V, DirectionVS));
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------- COMPUTE CLIP SPACE POSITION
|
||||
float4 H_COMPUTE_POSITION_CS(float2 pixCoordNDC, float Depth)
|
||||
{
|
||||
float4 PositionCS = float4(pixCoordNDC * 2.0 - 1.0, Depth, 1.0);
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
PositionCS.y = -PositionCS.y;
|
||||
#endif
|
||||
|
||||
return PositionCS;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------- COMPUTE CLIP SPACE POSITION
|
||||
float3 H_COMPUTE_NDC_Z(float3 Position, float4x4 InvViewProjMatrix)
|
||||
{
|
||||
|
||||
return ComputeNormalizedDeviceCoordinatesWithZ(Position, InvViewProjMatrix);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------- COMPUTE WORLD SPACE POSITION
|
||||
float3 H_COMPUTE_POSITION_WS(float2 pixCoordNDC, float Depth, float4x4 InvViewProjMatrix)
|
||||
{
|
||||
|
||||
return ComputeWorldSpacePosition(pixCoordNDC, Depth, InvViewProjMatrix);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------- WORLD TO VIEW DIRECTION
|
||||
float3 H_TRANSFORM_WORLD_TO_VIEW_DIR(float3 DirectionWS, bool Normalize = false)
|
||||
{
|
||||
float3 DirectionVS = mul((float3x3)H_MATRIX_V, DirectionWS).xyz;
|
||||
if (Normalize) return normalize(DirectionVS);
|
||||
|
||||
return DirectionVS;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------- VIEW TO WORLD DIRECTION
|
||||
float3 H_TRANSFORM_VIEW_TO_WORLD_DIR(float3 DirectionVS, bool Normalize = false)
|
||||
{
|
||||
float3 DirectionWS = mul((float3x3)H_MATRIX_I_V, DirectionVS).xyz;
|
||||
if (Normalize) return normalize(Normalize);
|
||||
|
||||
return DirectionWS;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------- WORLD TO VIEW NOWMAL
|
||||
float3 H_TRANSFORM_WORLD_TO_VIEW_NORMAL(float3 NormalWS, bool Normalize = false)
|
||||
{
|
||||
|
||||
return TransformWorldToViewNormal(NormalWS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --------------------------------- VIEW TO WORLD NOWMAL
|
||||
float3 H_TRANSFORM_VIEW_TO_WORLD_NORMAL(float3 NormalVS, bool Normalize = false)
|
||||
{
|
||||
|
||||
return TransformViewToWorldNormal(NormalVS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --------------------------------- RAW TO 01 LINEAR DEPTH
|
||||
float H_LINEAR_01_DEPTH(float Depth)
|
||||
{
|
||||
|
||||
|
||||
return Linear01Depth(Depth, _ZBufferParams);
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------- RAW TO EYE LINEAR DEPTH
|
||||
float H_LINEAR_EYE_DEPTH(float3 PositionWS, float4x4 ViewMatrix)
|
||||
{
|
||||
|
||||
|
||||
return LinearEyeDepth(PositionWS, ViewMatrix);
|
||||
}
|
||||
|
||||
|
||||
float H_LINEAR_EYE_DEPTH(float Depth)
|
||||
{
|
||||
|
||||
|
||||
return LinearEyeDepth(Depth, _ZBufferParams);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60126f3b2f7939246ab1d0c0e26f670f
|
||||
timeCreated: 1727882853
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Headers/HSpaceTransforms.hlsl
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc41ad21f8ea07c458acca5c5c52c745
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,237 @@
|
||||
#include "../Headers/HMain.hlsl"
|
||||
#include "../Headers/HMath.hlsl"
|
||||
#include "../Headers/HSpaceTransforms.hlsl"
|
||||
|
||||
#define ENABLE_RCRS_FILTER 1
|
||||
#define ENABLE_EXPOSURE_CONTROL 1
|
||||
|
||||
#define ENABLE_SPATIAL_RESTIR 1
|
||||
#define ENABLE_TEMPORAL_RESTIR 1
|
||||
|
||||
#define ENABLE_SPATIAL_DENOISING 1
|
||||
#define ENABLE_TEMPORAL_DENOISING 1
|
||||
#define ENABLE_TEMPORAL_STABILIZATION 1
|
||||
|
||||
|
||||
// ------------------------ COMMON PROPERTIES -------------------------
|
||||
float _HScaleFactorSSGI;
|
||||
float _HPreviousScaleFactorSSGI;
|
||||
|
||||
float _Falloff;
|
||||
float4 _APVParams;
|
||||
float4 _DepthToViewParams;
|
||||
|
||||
uint _ExcludeCastingLayerMaskSSGI;
|
||||
uint _ExcludeReceivingLayerMaskSSGI;
|
||||
|
||||
|
||||
// ------------------------ SCALING FUNCTIONS -------------------------
|
||||
uint2 GetUnscaledCoords(uint2 pixCoord)
|
||||
{
|
||||
return round(pixCoord.xy * _HScaleFactorSSGI.xx);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ SAMPLING FUNCTIONS -------------------------
|
||||
float ProbePlaneWeighting(float4 Plane, float3 WorldPosSample, float DepthLinearCenter, float Multiplier)
|
||||
{
|
||||
float PlaneDistance = abs(dot(float4(WorldPosSample, -1), Plane));
|
||||
float DepthDifference = PlaneDistance / DepthLinearCenter;
|
||||
float PlaneWeight = exp2(-100.0f * Multiplier * (DepthDifference * DepthDifference));
|
||||
return PlaneWeight;
|
||||
}
|
||||
|
||||
float3 ComputeFastViewSpacePosition(float2 pixCoordNDC, float Depth, float DepthLinear)
|
||||
{
|
||||
#ifdef VR_COMPATIBILITY
|
||||
return ComputeViewSpacePosition(pixCoordNDC, Depth, UNITY_MATRIX_I_P) * float3(1, -1, 1);
|
||||
#endif
|
||||
|
||||
float3 PositionVS = float3((pixCoordNDC * _DepthToViewParams.xy + _DepthToViewParams.zw) * DepthLinear.xx, DepthLinear);
|
||||
return float3(PositionVS.x, PositionVS.y, -PositionVS.z);
|
||||
}
|
||||
|
||||
float ExponentialFalloff(float HitDistance, float MaxDistance)
|
||||
{
|
||||
float Falloff = 0;
|
||||
|
||||
float Threshold = 0.35 * MaxDistance;
|
||||
if (HitDistance <= Threshold)
|
||||
Falloff = 1.0;
|
||||
|
||||
float NormalizedDistance = saturate((HitDistance - Threshold) / (MaxDistance - Threshold));
|
||||
Falloff = exp2(-(_Falloff * 3) * NormalizedDistance);
|
||||
|
||||
return Falloff;
|
||||
}
|
||||
|
||||
float RadicalInverseVdC(uint bits)
|
||||
{
|
||||
bits = (bits << 16) | (bits >> 16);
|
||||
bits = ((bits & 0x55555555) << 1) | ((bits & 0xAAAAAAAA) >> 1);
|
||||
bits = ((bits & 0x33333333) << 2) | ((bits & 0xCCCCCCCC) >> 2);
|
||||
bits = ((bits & 0x0F0F0F0F) << 4) | ((bits & 0xF0F0F0F0) >> 4);
|
||||
bits = ((bits & 0x00FF00FF) << 8) | ((bits & 0xFF00FF00) >> 8);
|
||||
return float(bits) * 2.3283064365386963e-10;
|
||||
}
|
||||
|
||||
float2 SampleUnitDisk(uint Index)
|
||||
{
|
||||
float Angle = RadicalInverseVdC(Index) * 2.0 * H_PI;
|
||||
float Radius = sqrt(frac(float(Index) * 0.61803398875)); // Golden ratio for decorrelation
|
||||
return float2(cos(Angle), sin(Angle)) * Radius;
|
||||
}
|
||||
|
||||
inline float Jitter(float2 Coord)
|
||||
{
|
||||
float a = 12.9898;
|
||||
float b = 78.233;
|
||||
float c = 43758.5453;
|
||||
float dt = dot(Coord.xy, float2(a, b));
|
||||
float sn = fmod(dt, 3.14);
|
||||
return frac(sin(sn) * c);
|
||||
}
|
||||
|
||||
float sqr(float value)
|
||||
{
|
||||
return value * value;
|
||||
}
|
||||
|
||||
float GaussianWeighting(float Radius, float Sigma)
|
||||
{
|
||||
return exp2(-sqr(Radius / Sigma));
|
||||
}
|
||||
|
||||
float3 SpatialDenoisingTonemap(float3 Color)
|
||||
{
|
||||
return Color * rcp(max(max(Color.r, Color.g), Color.b) + 1.0);
|
||||
}
|
||||
|
||||
float3 SpatialDenoisingTonemapInverse(float3 Color)
|
||||
{
|
||||
return Color * rcp(1.0 - max(max(Color.r, Color.g), Color.b));
|
||||
}
|
||||
|
||||
// ------------------------ Color.hlsl in HDRP -------------------------
|
||||
|
||||
float HInterleavedGradientNoise(float2 pixCoord, int frameCount)
|
||||
{
|
||||
const float3 magic = float3(0.06711056f, 0.00583715f, 52.9829189f);
|
||||
float2 frameMagicScale = float2(2.083f, 4.867f);
|
||||
pixCoord += frameCount * frameMagicScale;
|
||||
return frac(magic.z * frac(dot(pixCoord, magic.xy)));
|
||||
}
|
||||
|
||||
// ------------------------ PACKING FUNCTIONS -------------------------
|
||||
|
||||
uint PackDirection32Bit(float3 Direction)
|
||||
{
|
||||
float2 DirectionOctahedral = PackNormalOctQuadEncode(Direction);
|
||||
DirectionOctahedral = DirectionOctahedral * 0.5f + 0.5f;
|
||||
|
||||
uint DirectionX = uint(DirectionOctahedral.x * 65534.0f + 0.5f);
|
||||
uint DirectionY = uint(DirectionOctahedral.y * 65534.0f + 0.5f);
|
||||
return (DirectionX << 16) | (DirectionY << 0);
|
||||
}
|
||||
|
||||
float3 UnpackDirection32Bit(uint PackedDirection)
|
||||
{
|
||||
float3 Direction;
|
||||
Direction.x = float((PackedDirection >> 16) & 0xFFFF) / 65534.0f;
|
||||
Direction.y = float((PackedDirection >> 0) & 0xFFFF) / 65534.0f;
|
||||
Direction = UnpackNormalOctQuadEncode(Direction.xy * 2.0f - 1.0f);
|
||||
return Direction;
|
||||
}
|
||||
|
||||
uint PackDirection24Bit(float3 Direction)
|
||||
{
|
||||
float2 DirectionOctahedral = PackNormalOctQuadEncode(Direction);
|
||||
DirectionOctahedral = DirectionOctahedral * 0.5f + 0.5f;
|
||||
|
||||
uint DirectionX = uint(DirectionOctahedral.x * 4095.0f + 0.5f);
|
||||
uint DirectionY = uint(DirectionOctahedral.y * 4095.0f + 0.5f);
|
||||
return (DirectionX << 12) | (DirectionY << 0);
|
||||
}
|
||||
|
||||
float3 UnpackDirection24Bit(uint PackedDirection)
|
||||
{
|
||||
float3 Direction;
|
||||
Direction.x = float((PackedDirection >> 12) & 0xFFF) / 4095.0f;
|
||||
Direction.y = float((PackedDirection >> 0) & 0xFFF) / 4095.0f;
|
||||
Direction = UnpackNormalOctQuadEncode(Direction.xy * 2.0f - 1.0f);
|
||||
return Direction;
|
||||
}
|
||||
|
||||
uint PackDirection16Bit(float3 Direction)
|
||||
{
|
||||
float2 DirectionOctahedral = PackNormalOctQuadEncode(Direction);
|
||||
DirectionOctahedral = DirectionOctahedral * 0.5f + 0.5f;
|
||||
|
||||
uint DirectionX = uint(DirectionOctahedral.x * 255.0f + 0.5f);
|
||||
uint DirectionY = uint(DirectionOctahedral.y * 255.0f + 0.5f);
|
||||
return (DirectionX << 8) | (DirectionY << 0);
|
||||
}
|
||||
|
||||
float3 UnpackDirection16Bit(uint PackedDirection)
|
||||
{
|
||||
float3 Direction;
|
||||
Direction.x = float((PackedDirection >> 8) & 0xFF) / 255.0f;
|
||||
Direction.y = float((PackedDirection >> 0) & 0xFF) / 255.0f;
|
||||
Direction = UnpackNormalOctQuadEncode(Direction.xy * 2.0f - 1.0f);
|
||||
return Direction;
|
||||
}
|
||||
|
||||
uint PackAmbientOcclusion(float AmbientOcclusion)
|
||||
{
|
||||
uint AmbientOcclusionPacked = AmbientOcclusion * 255.0f + 0.5f;
|
||||
return AmbientOcclusionPacked;
|
||||
}
|
||||
|
||||
float UnpackAmbientOcclusion(uint AmbientOcclusionPacked)
|
||||
{
|
||||
float AmbientOcclusion = float(AmbientOcclusionPacked) / 255.0f;
|
||||
return AmbientOcclusion;
|
||||
}
|
||||
|
||||
uint PackColorHit(float3 Color, bool Hit)
|
||||
{
|
||||
uint R = (f32tof16(Color.r) << 17) & 0xFFE00000;
|
||||
uint G = (f32tof16(Color.g) << 6) & 0x001FF800;
|
||||
uint B = (f32tof16(Color.b) >> 4) & 0x000007FE;
|
||||
uint A = Hit ? 0x00000001 : 0x00000000;
|
||||
return R | G | B | A;
|
||||
}
|
||||
|
||||
float3 UnpackColorHit(uint ColorHitPacked, inout bool Hit)
|
||||
{
|
||||
float3 Color;
|
||||
Color.r = f16tof32((ColorHitPacked >> 17) & 0x7FF0);
|
||||
Color.g = f16tof32((ColorHitPacked >> 6) & 0x7FF0);
|
||||
Color.b = f16tof32((ColorHitPacked << 4) & 0x7FE0);
|
||||
Hit = (ColorHitPacked & 0x00000001) == 0x00000001 ? true : false;
|
||||
return Color;
|
||||
}
|
||||
|
||||
uint PackNormalDepth(float3 Normal, float Depth)
|
||||
{
|
||||
float2 NormalOctahedral = PackNormalOctQuadEncode(Normal);
|
||||
NormalOctahedral = NormalOctahedral * 0.5f + 0.5f;
|
||||
uint NormalX = uint(NormalOctahedral.x * 255.0f + 0.5f);
|
||||
uint NormalY = uint(NormalOctahedral.y * 255.0f + 0.5f);
|
||||
|
||||
uint DepthPacked = f32tof16(Depth);
|
||||
return (DepthPacked << 16) | (NormalX << 8) | (NormalY << 0);
|
||||
}
|
||||
|
||||
float4 UnpackNormalDepth(uint NormalDepthPacked)
|
||||
{
|
||||
float2 Normal;
|
||||
float4 NormalDepth;
|
||||
Normal.x = float((NormalDepthPacked >> 8) & 0xFF) / 255.0f;
|
||||
Normal.y = float((NormalDepthPacked >> 0) & 0xFF) / 255.0f;
|
||||
NormalDepth.xyz = UnpackNormalOctQuadEncode(Normal * 2.0f - 1.0f);
|
||||
|
||||
NormalDepth.w = f16tof32(NormalDepthPacked >> 16);
|
||||
|
||||
return NormalDepth.xyzw;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da57d648cbc5caf44837dabea199a907
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Includes/HCommonSSGI.hlsl
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,66 @@
|
||||
//pipelinedefine
|
||||
#define H_URP
|
||||
|
||||
|
||||
#if UNITY_VERSION >= 600000
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/AmbientProbe.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl"
|
||||
|
||||
float3 EvaluateFallbackSky(float3 Direction)
|
||||
{
|
||||
unity_SHAr = H_SHAr;
|
||||
unity_SHAg = H_SHAg;
|
||||
unity_SHAb = H_SHAb;
|
||||
unity_SHBr = H_SHBr;
|
||||
unity_SHBg = H_SHBg;
|
||||
unity_SHBb = H_SHBb;
|
||||
unity_SHC = H_SHC;
|
||||
|
||||
return EvaluateAmbientProbe(Direction);
|
||||
}
|
||||
|
||||
float3 EvaluateFallbackAPV(float4 APVParams, float3 PositionWS, float3 NormalWS, float3 ViewDirection, float2 pixCoord)
|
||||
{
|
||||
float3 BakedAPV = 0;
|
||||
float3 Unused = 0;
|
||||
|
||||
_APVSamplingNoise = APVParams.z;
|
||||
PositionWS = AddNoiseToSamplingPosition(PositionWS, pixCoord, ViewDirection);
|
||||
PositionWS = (PositionWS + NormalWS * APVParams.x) + ViewDirection * APVParams.y;
|
||||
|
||||
unity_SHAr = H_SHAr;
|
||||
unity_SHAg = H_SHAg;
|
||||
unity_SHAb = H_SHAb;
|
||||
unity_SHBr = H_SHBr;
|
||||
unity_SHBg = H_SHBg;
|
||||
unity_SHBb = H_SHBb;
|
||||
unity_SHC = H_SHC;
|
||||
|
||||
EvaluateAdaptiveProbeVolume(PositionWS, NormalWS, -NormalWS, ViewDirection, pixCoord, BakedAPV, Unused);
|
||||
|
||||
#ifdef FALLBACK_STAGE
|
||||
BakedAPV *= APVParams.w;
|
||||
#endif
|
||||
|
||||
return BakedAPV;
|
||||
}
|
||||
#else
|
||||
#include "Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBlendStates.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl"
|
||||
|
||||
float3 EvaluateFallbackAPV(float4 APVParams, float3 PositionWS, float3 NormalWS, float3 ViewDirection, int2 pixCoord)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
float3 EvaluateFallbackSky(float3 Direction)
|
||||
{
|
||||
float3 Sky = SHEvalLinearL0L1(Direction, H_SHAr, H_SHAg, H_SHAb);
|
||||
Sky += SHEvalLinearL2(Direction, H_SHBr, H_SHBg, H_SHBb, H_SHC);
|
||||
|
||||
return max(Sky, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad1d271555f9ba343b68747597d2cae6
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Includes/HFallbackSSGI.hlsl
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,195 @@
|
||||
#ifdef FULL_RESOLUTION_DEPTH
|
||||
#define MAX_DEPTH_MIP_LEVEL 0
|
||||
#else
|
||||
#define MAX_DEPTH_MIP_LEVEL 1
|
||||
#endif
|
||||
|
||||
#include "HReservoirSSGI.hlsl"
|
||||
|
||||
uint _StepCount;
|
||||
float _RayLength;
|
||||
float _BackfaceLighting;
|
||||
float4 _ThicknessParams;
|
||||
|
||||
H_TEXTURE(_Color);
|
||||
|
||||
|
||||
float GetRayOriginAndDirectionNDC(float MaxLength, float Depth, float2 pixCoordNDC, float3 PositionWS, float3 RayDirectionWS, float3 NormalWS, inout float3 RayOriginBiasedWS, inout float3 RayStartPositionNDC, inout float3 RayEndPositionNDC)
|
||||
{
|
||||
// Bias ray origin in world space
|
||||
{
|
||||
RayOriginBiasedWS = PositionWS;
|
||||
float3 NormalForBias = dot(NormalWS, RayDirectionWS) < 0 ? -NormalWS : NormalWS;
|
||||
|
||||
// Calculate normal bias
|
||||
float2 CornerCoordNDC = pixCoordNDC + 0.5f * _ScreenSize.zw;
|
||||
float3 CornerPositionWS = H_COMPUTE_POSITION_WS(CornerCoordNDC.xy, Depth, H_MATRIX_I_VP);
|
||||
float NormalBias = abs(dot(CornerPositionWS - PositionWS, NormalForBias)) * 2.0f;
|
||||
|
||||
// This can push the ray origin off-screen causing black pixels on the border
|
||||
RayOriginBiasedWS += NormalForBias * max(NormalBias, 0.01f) + RayDirectionWS * 0.01f;
|
||||
}
|
||||
|
||||
// Calculate ray start position in screen space
|
||||
RayStartPositionNDC = H_COMPUTE_NDC_Z(RayOriginBiasedWS, H_MATRIX_VP).xyz;
|
||||
|
||||
// Calculate ray end clipped position in screen space
|
||||
{
|
||||
// Calculate clipped ray distance in world space
|
||||
float MaxRayDistanceWS = MaxLength;
|
||||
|
||||
float3 RayDirectionVS = H_TRANSFORM_WORLD_TO_VIEW_DIR(-RayDirectionWS, true);
|
||||
float SceneDepth = H_LINEAR_EYE_DEPTH(RayOriginBiasedWS, H_MATRIX_V);
|
||||
float RayClippedDistanceWS = RayDirectionVS.z < 0.0 ? min(-0.99f * SceneDepth / RayDirectionVS.z, MaxRayDistanceWS) : MaxRayDistanceWS;
|
||||
|
||||
// Calculate ray end position in screen space
|
||||
RayEndPositionNDC.xyz = H_COMPUTE_NDC_Z(RayOriginBiasedWS + RayDirectionWS * RayClippedDistanceWS, H_MATRIX_VP).xyz;
|
||||
|
||||
// Recalculate ray end position where it leaves the screen
|
||||
float2 ScreenEdgeIntersections = HLineBoxIntersect(RayStartPositionNDC, RayEndPositionNDC, 0, 1);
|
||||
RayEndPositionNDC = RayStartPositionNDC + (RayEndPositionNDC - RayStartPositionNDC) * ScreenEdgeIntersections.y;
|
||||
|
||||
return ScreenEdgeIntersections.y;
|
||||
}
|
||||
}
|
||||
|
||||
float2 GetWorkingDepth(float SurfaceDepth, float RayDepth)
|
||||
{
|
||||
#ifdef LINEAR_THICKNESS
|
||||
return float2(SurfaceDepth, RayDepth);
|
||||
#else
|
||||
return float2(H_LINEAR_EYE_DEPTH(SurfaceDepth), H_LINEAR_EYE_DEPTH(RayDepth));
|
||||
#endif
|
||||
}
|
||||
|
||||
bool WorkingDepthCompare(float SurfaceDepth, float RayDepth, float2 ThicknessParams)
|
||||
{
|
||||
#ifdef LINEAR_THICKNESS
|
||||
return RayDepth > SurfaceDepth * ThicknessParams.x + ThicknessParams.y;
|
||||
#else
|
||||
return RayDepth < SurfaceDepth * ThicknessParams.x + ThicknessParams.y;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
float4 RayMarch(float3 RayStartPositionNDC, float3 RayEndPositionNDC, float StepJitter)
|
||||
{
|
||||
int StepCount = _StepCount;
|
||||
|
||||
bool HitFound = false;
|
||||
bool SkyPassed = false;
|
||||
|
||||
float3 HitCoordNDC = 0;
|
||||
float3 PreviousPositionNDC = RayStartPositionNDC;
|
||||
|
||||
for (int i = 0; i < StepCount; i++)
|
||||
{
|
||||
float3 SamplePositionNDC = lerp(RayStartPositionNDC, RayEndPositionNDC, pow(float(min(float(StepCount), i + StepJitter * 1)) / float(StepCount), 2));
|
||||
|
||||
uint DepthLOD = lerp(MAX_DEPTH_MIP_LEVEL, 4, (float(i)) / StepCount);
|
||||
float SurfaceDepth = H_SAMPLE_LOD(g_HTraceDepthPyramidSSGI, H_SAMPLER_POINT_CLAMP, SamplePositionNDC.xy * HRenderScale.xy, DepthLOD).x;
|
||||
|
||||
if (SurfaceDepth <= 0)
|
||||
{
|
||||
SkyPassed = true;
|
||||
}
|
||||
|
||||
if (SamplePositionNDC.z < SurfaceDepth)
|
||||
{
|
||||
float2 WorkingDepth = GetWorkingDepth(SurfaceDepth, SamplePositionNDC.z);
|
||||
|
||||
if (WorkingDepthCompare(WorkingDepth.x, WorkingDepth.y, _ThicknessParams.xy))
|
||||
{
|
||||
HitCoordNDC = SamplePositionNDC.xyz;
|
||||
HitFound = true;
|
||||
break;
|
||||
}
|
||||
if (REFINE_INTERSECTION && WorkingDepthCompare(WorkingDepth.x, WorkingDepth.y, _ThicknessParams.zw))
|
||||
{
|
||||
float3 MiddlePositionNDC = lerp(SamplePositionNDC, PreviousPositionNDC, 0.25f);
|
||||
float MiddleSurfaceDepth = H_SAMPLE_LOD(g_HTraceDepthPyramidSSGI, H_SAMPLER_POINT_CLAMP, MiddlePositionNDC.xy * HRenderScale.xy, DepthLOD).x;
|
||||
float2 MiddleWorkingDepth = GetWorkingDepth(MiddleSurfaceDepth, MiddlePositionNDC.z);
|
||||
|
||||
if (WorkingDepthCompare(MiddleWorkingDepth.x, MiddleWorkingDepth.y, _ThicknessParams.xy)) // && SurfaceDepth > 0)
|
||||
{
|
||||
HitCoordNDC = MiddlePositionNDC.xyz;
|
||||
HitFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PreviousPositionNDC = SamplePositionNDC;
|
||||
}
|
||||
|
||||
HitCoordNDC = SkyPassed ? PreviousPositionNDC : HitCoordNDC;
|
||||
|
||||
return float4(HitCoordNDC.xyz, HitFound);
|
||||
}
|
||||
|
||||
|
||||
float4 RayMarchHalf(float3 RayStartPositionNDC, float3 RayEndPositionNDC, float StepJitter)
|
||||
{
|
||||
int StepCount = _StepCount / 2;
|
||||
uint FirstStep = _FrameCount % 2;
|
||||
|
||||
bool HitFound = false;
|
||||
bool SkyPassed = false;
|
||||
|
||||
float3 HitCoordNDC = 0;
|
||||
float3 PreviousPositionNDC = RayStartPositionNDC;
|
||||
|
||||
for (int i = FirstStep; i < StepCount; i = i + 2)
|
||||
{
|
||||
float3 SamplePositionNDC = lerp(RayStartPositionNDC, RayEndPositionNDC, pow(float(min(StepCount, i + StepJitter * 1)) / StepCount, 2));
|
||||
|
||||
uint DepthLOD = lerp(MAX_DEPTH_MIP_LEVEL, 4, (float(i)) / StepCount);
|
||||
float SurfaceDepth = H_SAMPLE_LOD(g_HTraceDepthPyramidSSGI, H_SAMPLER_POINT_CLAMP, SamplePositionNDC.xy * HRenderScale.xy, DepthLOD).x;
|
||||
|
||||
if (SurfaceDepth <= 0)
|
||||
{
|
||||
SkyPassed = true;
|
||||
}
|
||||
|
||||
if (SamplePositionNDC.z < SurfaceDepth)
|
||||
{
|
||||
float2 WorkingDepth = GetWorkingDepth(SurfaceDepth, SamplePositionNDC.z);
|
||||
|
||||
if (WorkingDepthCompare(WorkingDepth.x, WorkingDepth.y, _ThicknessParams.xy))
|
||||
{
|
||||
HitCoordNDC = SamplePositionNDC.xyz;
|
||||
HitFound = true;
|
||||
break;
|
||||
}
|
||||
else if (REFINE_INTERSECTION && WorkingDepthCompare(WorkingDepth.x, WorkingDepth.y, _ThicknessParams.zw))
|
||||
{
|
||||
float3 MiddlePositionNDC = lerp(SamplePositionNDC, PreviousPositionNDC, 0.25f);
|
||||
float MiddleSurfaceDepth = H_SAMPLE_LOD(g_HTraceDepthPyramidSSGI, H_SAMPLER_POINT_CLAMP, MiddlePositionNDC.xy * HRenderScale.xy, DepthLOD).x;
|
||||
float2 MiddleWorkingDepth = GetWorkingDepth(MiddleSurfaceDepth, MiddlePositionNDC.z);
|
||||
|
||||
if (WorkingDepthCompare(MiddleWorkingDepth.x, MiddleWorkingDepth.y, _ThicknessParams.xy))
|
||||
{
|
||||
HitCoordNDC = MiddlePositionNDC.xyz;
|
||||
HitFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PreviousPositionNDC = SamplePositionNDC;
|
||||
}
|
||||
|
||||
HitCoordNDC = SkyPassed ? PreviousPositionNDC : HitCoordNDC;
|
||||
|
||||
return float4(HitCoordNDC.xyz, HitFound);
|
||||
}
|
||||
|
||||
|
||||
float4 RayMarchValidation(float3 RayStartPositionNDC, float3 RayEndPositionNDC, float StepJitter)
|
||||
{
|
||||
#ifdef HALF_STEP_VALIDATION
|
||||
return RayMarchHalf(RayStartPositionNDC, RayEndPositionNDC, StepJitter);
|
||||
#else
|
||||
return RayMarch(RayStartPositionNDC, RayEndPositionNDC, StepJitter);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d70f0a4fb67872c4eb21e7facb552b46
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Includes/HRayMarchingSSGI.hlsl
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,242 @@
|
||||
#include "HCommonSSGI.hlsl"
|
||||
|
||||
H_TEXTURE(_Reservoir);
|
||||
H_TEXTURE(_ReservoirReprojected);
|
||||
H_TEXTURE(_ReservoirLuminance);
|
||||
|
||||
H_RW_TEXTURE(uint4, _Reservoir_Output);
|
||||
H_RW_TEXTURE(uint4, _ReservoirSpatial_Output);
|
||||
H_RW_TEXTURE(uint4, _ReservoirTemporal_Output);
|
||||
H_RW_TEXTURE(float, _ReservoirLuminance_Output);
|
||||
|
||||
float _ReservoirDiffuseWeight;
|
||||
|
||||
// ------------------------ RESERVOIR STRUCTS -----------------------
|
||||
struct OcclusionReservoir
|
||||
{
|
||||
// Main
|
||||
float Occlusion;
|
||||
float Wsum;
|
||||
float M;
|
||||
float W;
|
||||
|
||||
// Ray
|
||||
float3 Direction;
|
||||
float Distance;
|
||||
};
|
||||
|
||||
struct TemporalReservoir
|
||||
{
|
||||
// Main
|
||||
float3 Color;
|
||||
float Wsum;
|
||||
float M;
|
||||
float W;
|
||||
|
||||
// Origin
|
||||
float3 OriginNormal;
|
||||
|
||||
// Ray
|
||||
float3 Direction;
|
||||
float Distance;
|
||||
bool HitFound;
|
||||
};
|
||||
|
||||
struct SpatialReservoir
|
||||
{
|
||||
// Main
|
||||
float3 Color;
|
||||
float Wsum;
|
||||
float M;
|
||||
float W;
|
||||
|
||||
// Denoiser
|
||||
float3 Normal;
|
||||
float Depth;
|
||||
float Occlusion;
|
||||
|
||||
// Ray
|
||||
float3 Direction;
|
||||
float Distance;
|
||||
bool HitFound;
|
||||
};
|
||||
|
||||
|
||||
// ------------------------ PACKING FUNCTIONS -----------------------
|
||||
|
||||
uint4 PackTemporalReservoir(TemporalReservoir Reservoir)
|
||||
{
|
||||
uint W = f32tof16(Reservoir.W);
|
||||
uint M = f32tof16(Reservoir.M);
|
||||
uint PackedMW = (W << 16) | (M & 0xFFFE) | (Reservoir.HitFound & 0x1);
|
||||
uint PackedColorHit = PackToR11G11B10f(Reservoir.Color); // PackColorHit(Reservoir.Color, Reservoir.HitFound);
|
||||
uint PackedDistance = f32tof16(Reservoir.Distance); // uint(Reservoir.Distance * 65534.0f + 0.5f);
|
||||
uint PackedDirection = PackDirection32Bit(Reservoir.Direction);
|
||||
uint PackedOriginaNormal = PackDirection16Bit(Reservoir.OriginNormal);
|
||||
uint PackedNormalDistance = (PackedDistance << 16) | (PackedOriginaNormal << 0);
|
||||
|
||||
return uint4(PackedColorHit, PackedMW, PackedDirection, PackedNormalDistance);
|
||||
}
|
||||
|
||||
void UnpackTemporalReservoir(uint4 ReservoirPacked, float3 Diffuse, inout TemporalReservoir Reservoir)
|
||||
{
|
||||
Reservoir.HitFound = ReservoirPacked.y & 0x1;
|
||||
Reservoir.Color = UnpackFromR11G11B10f(ReservoirPacked.x); // UnpackColorHit(ReservoirPacked.x, Reservoir.HitFound);
|
||||
Reservoir.W = f16tof32(ReservoirPacked.y >> 16);
|
||||
Reservoir.M = f16tof32(ReservoirPacked.y & 0xFFFE);
|
||||
Reservoir.Wsum = Reservoir.W * Reservoir.M * Luminance(Reservoir.Color * Diffuse);
|
||||
Reservoir.Distance = f16tof32(ReservoirPacked.w >> 16);
|
||||
Reservoir.Direction = UnpackDirection32Bit(ReservoirPacked.z);
|
||||
Reservoir.OriginNormal = UnpackDirection16Bit(ReservoirPacked.w);
|
||||
}
|
||||
|
||||
uint4 PackSpatialReservoir(SpatialReservoir Reservoir)
|
||||
{
|
||||
uint W = f32tof16(Reservoir.W);
|
||||
uint M = f32tof16(Reservoir.M);
|
||||
uint PackedMW = (W << 16) | (M & 0xFFFE) | (Reservoir.HitFound & 0x1);
|
||||
uint PackedColor = PackToR11G11B10f(Reservoir.Color);
|
||||
uint PackedDistance = (uint(f32tof16(Reservoir.Distance)) >> 6) & 0x3FF;
|
||||
uint PackedDirection = PackDirection16Bit(Reservoir.Direction) & 0xFFFF;
|
||||
uint PackedOcclusion = uint(Reservoir.Occlusion * 63.0f + 0.5f) & 0x3F;
|
||||
uint PackedDirectionDistanceOcclusion = (PackedDirection << 16) | (PackedOcclusion << 10) | (PackedDistance << 0);
|
||||
uint DepthPacked = f32tof16(Reservoir.Depth) & 0xFFFF;
|
||||
uint NormalPacked = PackDirection16Bit(Reservoir.Normal) & 0xFFFF;
|
||||
uint NormalDepthPacked = (NormalPacked << 16) | (DepthPacked << 0);
|
||||
|
||||
return uint4(PackedColor, PackedMW, PackedDirectionDistanceOcclusion, NormalDepthPacked);
|
||||
}
|
||||
|
||||
void UnpackSpatialReservoir(uint4 ReservoirPacked, float3 Diffuse, inout SpatialReservoir Reservoir)
|
||||
{
|
||||
Reservoir.HitFound = ReservoirPacked.y & 0x1;
|
||||
Reservoir.Color = UnpackFromR11G11B10f(ReservoirPacked.x);
|
||||
Reservoir.W = f16tof32(ReservoirPacked.y >> 16);
|
||||
Reservoir.M = f16tof32(ReservoirPacked.y >> 0);
|
||||
Reservoir.Wsum = Reservoir.W * Reservoir.M * Luminance(Reservoir.Color * Diffuse);
|
||||
Reservoir.Distance = f16tof32((ReservoirPacked.z & 0x3FF) << 6);
|
||||
Reservoir.Occlusion = float((ReservoirPacked.z >> 10) & 0x3F) / 63;
|
||||
Reservoir.Direction = UnpackDirection16Bit((ReservoirPacked.z >> 16) & 0xFFFF);
|
||||
Reservoir.Normal = UnpackDirection16Bit((ReservoirPacked.w >> 16) & 0xFFFF);
|
||||
Reservoir.Depth = f16tof32(ReservoirPacked.w & 0xFFFF);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------ RESERVOIR FUNCTIONS -----------------------
|
||||
float3 GetReservoirDiffuse(uint2 pixCoord)
|
||||
{
|
||||
float3 DiffuseBuffer = HBUFFER_DIFFUSE(pixCoord).xyz * _ReservoirDiffuseWeight;
|
||||
|
||||
if (DiffuseBuffer.x + DiffuseBuffer.y + DiffuseBuffer.z <= 0.05f)
|
||||
DiffuseBuffer = float3(0.05f, 0.05f, 0.05f);
|
||||
|
||||
return DiffuseBuffer;
|
||||
}
|
||||
|
||||
// Spatial reservoir exchange
|
||||
bool ReservoirUpdate(SpatialReservoir SampleReservoir, inout SpatialReservoir MainReservoir, inout uint Random)
|
||||
{
|
||||
float RandomValue = HUintToFloat01(Hash1Mutate(Random));
|
||||
|
||||
MainReservoir.Wsum += SampleReservoir.Wsum;
|
||||
MainReservoir.M += SampleReservoir.M;
|
||||
|
||||
if (RandomValue < SampleReservoir.Wsum / MainReservoir.Wsum)
|
||||
{
|
||||
MainReservoir.Color = SampleReservoir.Color;
|
||||
MainReservoir.HitFound = SampleReservoir.HitFound;
|
||||
MainReservoir.Distance = SampleReservoir.Distance;
|
||||
MainReservoir.Direction = SampleReservoir.Direction;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Temporal reservoir exchange
|
||||
bool ReservoirUpdate(TemporalReservoir SampleReservoir, inout TemporalReservoir MainReservoir, inout uint Random)
|
||||
{
|
||||
float RandomValue = HUintToFloat01(Hash1Mutate(Random));
|
||||
|
||||
MainReservoir.Wsum += SampleReservoir.Wsum;
|
||||
MainReservoir.M += SampleReservoir.M;
|
||||
|
||||
if (RandomValue < SampleReservoir.Wsum / MainReservoir.Wsum)
|
||||
{
|
||||
MainReservoir.Color = SampleReservoir.Color;
|
||||
MainReservoir.HitFound = SampleReservoir.HitFound;
|
||||
MainReservoir.Distance = SampleReservoir.Distance;
|
||||
MainReservoir.Direction = SampleReservoir.Direction;
|
||||
MainReservoir.OriginNormal = SampleReservoir.OriginNormal;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Radiance reservoir fill
|
||||
bool ReservoirUpdate(float3 SampleColor, float3 SampleNormal, bool HitFound, float SampleW, float SampleM, inout TemporalReservoir Reservoir, inout uint Random)
|
||||
{
|
||||
float RandomValue = HUintToFloat01(Hash1Mutate(Random));
|
||||
|
||||
Reservoir.Wsum += SampleW;
|
||||
Reservoir.M += SampleM;
|
||||
|
||||
if (RandomValue < SampleW / Reservoir.Wsum)
|
||||
{
|
||||
Reservoir.Color = SampleColor;
|
||||
Reservoir.HitFound = HitFound;
|
||||
Reservoir.OriginNormal = SampleNormal;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Radiance reservoir fill
|
||||
bool ReservoirUpdate(float3 SampleColor, float3 SampleDirection, float3 SampleNormal, float SampleDistance, bool HitFound, float SampleW, float SampleM, inout TemporalReservoir Reservoir, inout uint Random)
|
||||
{
|
||||
float RandomValue = HUintToFloat01(Hash1Mutate(Random));
|
||||
|
||||
Reservoir.Wsum += SampleW;
|
||||
Reservoir.M += SampleM;
|
||||
|
||||
if (RandomValue < SampleW / Reservoir.Wsum)
|
||||
{
|
||||
Reservoir.Color = SampleColor;
|
||||
Reservoir.HitFound = HitFound;
|
||||
Reservoir.Distance = SampleDistance;
|
||||
Reservoir.Direction = SampleDirection;
|
||||
Reservoir.OriginNormal = SampleNormal;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Occlusion reservoir fill
|
||||
bool ReservoirUpdate(float SampleOcclusion, float3 SampleDirection, float SampleDistance, float SampleW, float SampleM, inout OcclusionReservoir Reservoir, inout uint Random)
|
||||
{
|
||||
float RandomValue = HUintToFloat01(Hash1Mutate(Random));
|
||||
|
||||
Reservoir.Wsum += SampleW;
|
||||
Reservoir.M += SampleM;
|
||||
|
||||
if (RandomValue < SampleW / Reservoir.Wsum)
|
||||
{
|
||||
Reservoir.Distance = SampleDistance;
|
||||
Reservoir.Direction = SampleDirection;
|
||||
Reservoir.Occlusion = SampleOcclusion;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d85ff336dd0f7d34c938a3c1920ae46a
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Includes/HReservoirSSGI.hlsl
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34ae425a90532074bae6cd5dbd2aafe5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e08fec73177458e4186aa8fdc8e7961d
|
||||
timeCreated: 1730137400
|
||||
@@ -0,0 +1,210 @@
|
||||
Shader "Hidden/HTraceSSGI/ColorComposeURP"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
HLSLINCLUDE
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
uint VertexID : SV_VertexID;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 PositionCS : POSITION;
|
||||
float2 TexCoord : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
Varyings SharedVertexStage(Attributes input)
|
||||
{
|
||||
Varyings output;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
output.PositionCS = GetFullScreenTriangleVertexPosition(input.VertexID);
|
||||
output.TexCoord = GetFullScreenTriangleTexCoord(input.VertexID);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Copy Color Buffer"
|
||||
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex SharedVertexStage
|
||||
#pragma fragment FragmentStage
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityInput.hlsl"
|
||||
#include "../../Headers/HMain.hlsl"
|
||||
|
||||
float4 FragmentStage(Varyings input) : SV_Target
|
||||
{
|
||||
return float4(HBUFFER_COLOR(input.TexCoord * _ScreenSize.xy).xyz, 1);
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Override Indirect Lighting"
|
||||
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
|
||||
// Doesn't seem to work for the R16G16A16B16 Color Buffer
|
||||
// Blend One One
|
||||
// BlendOp RevSub
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex SharedVertexStage
|
||||
#pragma fragment FragmentStage
|
||||
|
||||
#pragma multi_compile _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
|
||||
#pragma multi_compile _ _GBUFFER_NORMALS_OCT
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
#include "../../Headers/HMain.hlsl"
|
||||
#include "../../Headers/HSpaceTransforms.hlsl"
|
||||
#include "../../Includes/HFallbackSSGI.hlsl"
|
||||
|
||||
H_TEXTURE(_ColorCopy);
|
||||
|
||||
#define kMaterialFlagSpecularSetup 8
|
||||
uint UnpackMaterialFlags(float packedMaterialFlags)
|
||||
{ return uint((packedMaterialFlags * 255.0h) + 0.5h); }
|
||||
|
||||
float4 FragmentStage(Varyings input) : SV_Target
|
||||
{
|
||||
uint2 pixCoord = input.TexCoord * _ScreenSize.xy;
|
||||
float3 ColorCopy = H_LOAD(_ColorCopy, pixCoord).xyz;
|
||||
|
||||
float DepthCenter = HBUFFER_DEPTH(pixCoord);
|
||||
float3 NormalCenterWS = HBUFFER_NORMAL_WS(pixCoord);
|
||||
float3 PositionCenterWS = H_COMPUTE_POSITION_WS(input.TexCoord, DepthCenter, H_MATRIX_I_VP);
|
||||
|
||||
float4 GBuffer0 = H_LOAD(g_HTraceGBuffer0, pixCoord);
|
||||
float4 Gbuffer1 = H_LOAD(g_HTraceGBuffer1, pixCoord);
|
||||
|
||||
float3 IndirectLighting = 0;
|
||||
float Metallic = Gbuffer1.r;
|
||||
|
||||
// This seems to make everything worse.
|
||||
// if ((UnpackMaterialFlags(GBuffer0.a) & kMaterialFlagSpecularSetup) != 0)
|
||||
// Metallic = (ReflectivitySpecular(Gbuffer1.rgb));
|
||||
|
||||
#if UNITY_VERSION >= 600000
|
||||
if (_EnableProbeVolumes)
|
||||
{
|
||||
if (PROBE_VOLUMES_L1 || PROBE_VOLUMES_L2)
|
||||
{ IndirectLighting = EvaluateFallbackAPV(float4(0,0,0,0), PositionCenterWS, NormalCenterWS, H_GET_VIEW_DIRECTION_WS(PositionCenterWS), pixCoord); }
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{ IndirectLighting = EvaluateFallbackSky(NormalCenterWS); }
|
||||
|
||||
// This works reliably only with Render Graph, so we'll use Unity's _ScreenSpaceOcclusionTexture texture directly here
|
||||
// float SSAO = H_SAMPLE(g_HTraceSSAO, H_SAMPLER_POINT_CLAMP, input.TexCoord);
|
||||
float SSAO = _AmbientOcclusionParam.x == 0 ? 1 : H_SAMPLE(_ScreenSpaceOcclusionTexture, H_SAMPLER_POINT_CLAMP, input.TexCoord).x;
|
||||
float AmbientOcclusion = min(SSAO, Gbuffer1.a);
|
||||
|
||||
IndirectLighting = IndirectLighting * GBuffer0.rgb * (1.0 - Metallic) * AmbientOcclusion;
|
||||
|
||||
return float4(max(ColorCopy - IndirectLighting, 0), 1);
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Final Output"
|
||||
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
Blend One One
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex SharedVertexStage
|
||||
#pragma fragment FragmentStage
|
||||
|
||||
#pragma multi_compile _ PROBE_VOLUMES_L1 PROBE_VOLUMES_L2
|
||||
#pragma multi_compile _ _GBUFFER_NORMALS_OCT
|
||||
#pragma multi_compile _ USE_RECEIVE_LAYER_MASK
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
#include "../../Headers/HMain.hlsl"
|
||||
#include "../../Headers/HSpaceTransforms.hlsl"
|
||||
#include "../../Includes/HFallbackSSGI.hlsl"
|
||||
|
||||
H_TEXTURE(_HTraceBufferGI);
|
||||
|
||||
uint _MetallicIndirectFallback;
|
||||
uint _ExcludeReceivingLayerMaskSSGI;
|
||||
float _IndirectLightingIntensity;
|
||||
float4 _APVParams;
|
||||
|
||||
float4 FragmentStage(Varyings input) : SV_Target
|
||||
{
|
||||
uint2 pixCoord = input.TexCoord * _ScreenSize.xy;
|
||||
|
||||
if (HBUFFER_DEPTH(pixCoord) <= 1e-7) return 0;
|
||||
|
||||
float3 IndirectLighting = H_LOAD(_HTraceBufferGI, pixCoord).xyz;
|
||||
|
||||
#if UNITY_VERSION >= 600000
|
||||
// Restore indirect lighting on masked out objects
|
||||
if (USE_RECEIVE_LAYER_MASK)
|
||||
{
|
||||
if (HBUFFER_RENDER_LAYER_MASK(input.TexCoord * _ScreenSize.xy) & _ExcludeReceivingLayerMaskSSGI)
|
||||
{
|
||||
float3 NormalCenterWS = HBUFFER_NORMAL_WS(pixCoord);
|
||||
if (_EnableProbeVolumes)
|
||||
{
|
||||
float DepthCenter = HBUFFER_DEPTH(pixCoord);
|
||||
float3 PositionCenterWS = H_COMPUTE_POSITION_WS(input.TexCoord, DepthCenter, H_MATRIX_I_VP);
|
||||
|
||||
if (PROBE_VOLUMES_L1 || PROBE_VOLUMES_L2)
|
||||
{ IndirectLighting = EvaluateFallbackAPV(_APVParams, PositionCenterWS, NormalCenterWS, H_GET_VIEW_DIRECTION_WS(PositionCenterWS), pixCoord); }
|
||||
}
|
||||
else
|
||||
IndirectLighting = EvaluateFallbackSky(NormalCenterWS);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
float4 GBuffer0 = H_LOAD(g_HTraceGBuffer0, pixCoord);
|
||||
float4 Gbuffer1 = H_LOAD(g_HTraceGBuffer1, pixCoord);
|
||||
|
||||
// This works reliably only with Render Graph, so we'll use Unity's _ScreenSpaceOcclusionTexture texture directly here
|
||||
// float SSAO = H_SAMPLE(g_HTraceSSAO, H_SAMPLER_POINT_CLAMP, input.TexCoord);
|
||||
float SSAO = _AmbientOcclusionParam.x == 0 ? 1 : H_SAMPLE(_ScreenSpaceOcclusionTexture, H_SAMPLER_POINT_CLAMP, input.TexCoord).x;
|
||||
float AmbientOcclusion = min(SSAO, Gbuffer1.a);
|
||||
|
||||
float Metallic = _MetallicIndirectFallback ? 0 : MetallicFromReflectivity(ReflectivitySpecular(Gbuffer1.rgb));
|
||||
|
||||
float3 FinalIndirectLighting = IndirectLighting * _IndirectLightingIntensity * GBuffer0.rgb * (1 - Metallic) * AmbientOcclusion;
|
||||
|
||||
return float4(FinalIndirectLighting, 1);
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a65a40305a962f458eb23b936f45b2c
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Shaders/URP/ColorComposeURP.shader
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,231 @@
|
||||
Shader "Hidden/HTraceSSGI/MotionVectorsURP"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
Name "Camera Motion Vectors"
|
||||
|
||||
Cull Off
|
||||
ZWrite Off
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex VertexStage
|
||||
#pragma fragment FragmentStage
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl"
|
||||
#include "../../Headers/HMain.hlsl"
|
||||
|
||||
H_TEXTURE(_ObjectMotionVectors);
|
||||
H_TEXTURE(_ObjectMotionVectorsDepth);
|
||||
|
||||
float _BiasOffset;
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
uint VertexID : SV_VertexID;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 PositionCS : SV_POSITION;
|
||||
float2 TexCoord : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
struct FragOutput
|
||||
{
|
||||
float2 MotionVectors : SV_Target0;
|
||||
float Mask : SV_Target1;
|
||||
};
|
||||
|
||||
Varyings VertexStage(Attributes Input)
|
||||
{
|
||||
Varyings Output;
|
||||
UNITY_SETUP_INSTANCE_ID(Input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
Output.PositionCS = GetFullScreenTriangleVertexPosition(Input.VertexID);
|
||||
Output.TexCoord = GetFullScreenTriangleTexCoord(Input.VertexID);
|
||||
|
||||
return Output;
|
||||
}
|
||||
|
||||
FragOutput FragmentStage(Varyings Input)
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
FragOutput Output = (FragOutput)0;
|
||||
|
||||
float2 ObjectMotionVectorsColor = H_LOAD(_ObjectMotionVectors, Input.PositionCS.xy).xy;
|
||||
float ObjectMotionVectorsDepth = H_LOAD(_ObjectMotionVectorsDepth, Input.PositionCS.xy).x;
|
||||
float CameraDepth = LoadSceneDepth(Input.PositionCS.xy);
|
||||
|
||||
#if !UNITY_REVERSED_Z
|
||||
CameraDepth = lerp(UNITY_NEAR_CLIP_VALUE, 1, LoadSceneDepth(Input.PositionCS.xy).x);
|
||||
#endif
|
||||
|
||||
if (ObjectMotionVectorsDepth >= CameraDepth + _BiasOffset)
|
||||
{
|
||||
Output.MotionVectors = ObjectMotionVectorsColor;
|
||||
Output.Mask = 1;
|
||||
return Output;
|
||||
}
|
||||
|
||||
// Reconstruct world position
|
||||
float3 PositionWS = ComputeWorldSpacePosition(Input.PositionCS.xy * _ScreenSize.zw, CameraDepth, UNITY_MATRIX_I_VP);
|
||||
|
||||
// Multiply with current and previous non-jittered view projection
|
||||
float4 PositionCS = mul(H_MATRIX_VP, float4(PositionWS.xyz, 1.0));
|
||||
float4 PreviousPositionCS = mul(H_MATRIX_PREV_VP, float4(PositionWS.xyz, 1.0));
|
||||
|
||||
// Non-uniform raster needs to keep the posNDC values in float to avoid additional conversions
|
||||
// since uv remap functions use floats
|
||||
float2 PositionNDC = PositionCS.xy * rcp(PositionCS.w);
|
||||
float2 PreviousPositionNDC = PreviousPositionCS.xy * rcp(PreviousPositionCS.w);
|
||||
|
||||
// Calculate forward velocity
|
||||
float2 Velocity = (PositionNDC - PreviousPositionNDC);
|
||||
|
||||
// TODO: test that velocity.y is correct
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
Velocity.y = -Velocity.y;
|
||||
#endif
|
||||
|
||||
// Convert velocity from NDC space (-1..1) to screen UV 0..1 space
|
||||
// Note: It doesn't mean we don't have negative values, we store negative or positive offset in the UV space.
|
||||
// Note: ((posNDC * 0.5 + 0.5) - (prevPosNDC * 0.5 + 0.5)) = (velocity * 0.5)
|
||||
Velocity.xy *= 0.5;
|
||||
|
||||
Output.MotionVectors = Velocity;
|
||||
Output.Mask = 0;
|
||||
|
||||
return Output;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Object Motion Vectors"
|
||||
|
||||
Tags { "LightMode" = "MotionVectors" }
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_instancing
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/UnityInput.hlsl"
|
||||
#include "../../Headers/HMain.hlsl"
|
||||
|
||||
#ifndef HAVE_VFX_MODIFICATION
|
||||
#pragma multi_compile _ DOTS_INSTANCING_ON
|
||||
#if UNITY_PLATFORM_ANDROID || UNITY_PLATFORM_WEBGL || UNITY_PLATFORM_UWP
|
||||
#pragma target 3.5 DOTS_INSTANCING_ON
|
||||
#else
|
||||
#pragma target 4.5 DOTS_INSTANCING_ON
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 Position : POSITION;
|
||||
float3 PositionOld : TEXCOORD4;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 PositionCS : SV_POSITION;
|
||||
float4 PositionCSNoJitter : TEXCOORD0;
|
||||
float4 PreviousPositionCSNoJitter : TEXCOORD1;
|
||||
float MotionMask : TEXCOORD2;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
Varyings vert(Attributes Input)
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(Input);
|
||||
Varyings Output = (Varyings)0;
|
||||
UNITY_TRANSFER_INSTANCE_ID(Input, Output);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(Output);
|
||||
|
||||
VertexPositionInputs VertexInput = GetVertexPositionInputs(Input.Position.xyz);
|
||||
|
||||
// Jittered. Match the frame.
|
||||
Output.PositionCS = VertexInput.positionCS;
|
||||
|
||||
// This is required to avoid artifacts ("gaps" in the _MotionVectorTexture) on some platforms
|
||||
#if defined(UNITY_REVERSED_Z)
|
||||
Output.PositionCS.z -= unity_MotionVectorsParams.z * Output.PositionCS.w;
|
||||
#else
|
||||
Output.PositionCS.z += unity_MotionVectorsParams.z * Output.PositionCS.w;
|
||||
#endif
|
||||
|
||||
const float4 PreviousPosition = (unity_MotionVectorsParams.x == 1) ? float4(Input.PositionOld, 1) : Input.Position;
|
||||
const float4 PositionWS = mul(UNITY_MATRIX_M, Input.Position);
|
||||
const float4 PreviousPositionWS = mul(UNITY_PREV_MATRIX_M, PreviousPosition);
|
||||
|
||||
Output.PositionCSNoJitter = mul(H_MATRIX_VP, PositionWS);
|
||||
Output.PreviousPositionCSNoJitter = mul(H_MATRIX_PREV_VP, PreviousPositionWS);
|
||||
Output.MotionMask = length(PositionWS - PreviousPositionWS) > 0.0001 ? 1 : 0;
|
||||
|
||||
return Output;
|
||||
}
|
||||
|
||||
struct FragOutput
|
||||
{
|
||||
float2 MotionVectors : SV_Target0;
|
||||
float Mask : SV_Target1;
|
||||
};
|
||||
|
||||
FragOutput frag(Varyings Input)
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
FragOutput Output = (FragOutput)0;
|
||||
|
||||
// Note: unity_MotionVectorsParams.y is 0 is forceNoMotion is enabled
|
||||
bool ForceNoMotion = unity_MotionVectorsParams.y == 0.0;
|
||||
if (ForceNoMotion)
|
||||
{
|
||||
Output.MotionVectors = 0;
|
||||
Output.Mask = 0;
|
||||
return Output;
|
||||
}
|
||||
|
||||
// Calculate positions
|
||||
float4 PositionCS = Input.PositionCSNoJitter;
|
||||
float4 PreviousPositionCS = Input.PreviousPositionCSNoJitter;
|
||||
|
||||
float2 PositionNDC = PositionCS.xy * rcp(PositionCS.w);
|
||||
float2 PreviousPositionNDC = PreviousPositionCS.xy * rcp(PreviousPositionCS.w);
|
||||
|
||||
float2 Velocity = (PositionNDC.xy - PreviousPositionNDC.xy);
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
Velocity.y = -Velocity.y;
|
||||
#endif
|
||||
|
||||
// Convert velocity from NDC space (-1..1) to UV 0..1 space
|
||||
// Note: It doesn't mean we don't have negative values, we store negative or positive offset in UV space.
|
||||
// Note: ((posNDC * 0.5 + 0.5) - (prevPosNDC * 0.5 + 0.5)) = (velocity * 0.5)
|
||||
Velocity.xy *= 0.5;
|
||||
|
||||
Output.MotionVectors = Velocity;
|
||||
Output.Mask = Input.MotionMask;
|
||||
return Output;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f27aac68f194270ad9353a4177fcf0a
|
||||
timeCreated: 1745943152
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Resources/HTraceSSGI/Shaders/URP/MotionVectorsURP.shader
|
||||
uploadId: 840002
|
||||
8
Assets/Plugins/HTraceSSGI/Sample Scene.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c5d5b37adba1e741b0c5e491ae76235
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,65 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
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: 4cfa758cbcc84a509b4fbdd3a170a992, type: 3}
|
||||
m_Name: Default HTrace SSGI Profile
|
||||
m_EditorClassIdentifier: HTraceSSGI::HTraceSSGI.Scripts.Data.Private.HTraceSSGIProfile
|
||||
GeneralSettings:
|
||||
DebugMode: 0
|
||||
HBuffer: 0
|
||||
Multibounce: 1
|
||||
ExcludeCastingMask:
|
||||
serializedVersion: 0
|
||||
m_Bits: 0
|
||||
ExcludeReceivingMask:
|
||||
serializedVersion: 0
|
||||
m_Bits: 0
|
||||
FallbackType: 0
|
||||
_skyIntensity: 0.5
|
||||
_viewBias: 0
|
||||
_normalBias: 0.33
|
||||
_samplingNoise: 0.1
|
||||
_intensityMultiplier: 1
|
||||
DenoiseFallback: 1
|
||||
SSGISettings:
|
||||
_backfaceLighting: 0
|
||||
_maxRayLength: 100
|
||||
ThicknessMode: 0
|
||||
_thickness: 0.35
|
||||
_falloff: 0
|
||||
_rayCount: 4
|
||||
_stepCount: 32
|
||||
RefineIntersection: 1
|
||||
FullResolutionDepth: 1
|
||||
Checkerboard: 0
|
||||
_renderScale: 1
|
||||
DenoisingSettings:
|
||||
BrightnessClamp: 1
|
||||
_maxValueBrightnessClamp: 12
|
||||
_maxDeviationBrightnessClamp: 2
|
||||
HalfStepValidation: 0
|
||||
SpatialOcclusionValidation: 1
|
||||
TemporalLightingValidation: 1
|
||||
TemporalOcclusionValidation: 1
|
||||
_spatialRadius: 0.6
|
||||
_adaptivity: 0.9
|
||||
RecurrentBlur: 0
|
||||
FireflySuppression: 1
|
||||
DebugSettings:
|
||||
ShowBowels: 0
|
||||
ShowFullDebugLog: 0
|
||||
HInjectionPoint: 1
|
||||
HTraceLayer:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
TestCheckBox1: 0
|
||||
TestCheckBox2: 0
|
||||
TestCheckBox3: 0
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b20d84daa4c7da478a5f7a10fead959
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Sample Scene/Default HTrace SSGI Profile.asset
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6cfd446d4b049a4b848d41d5fef1fb3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2b7b1942fa57e1a4cbcff6ea0d7d65f8
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Sample Scene/Sample Scene SSGI URP/HTrace SSGI Sample
|
||||
Scene URP Volume Profile.asset
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a2578560f514a8a488c151ed7db841fb
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 336896
|
||||
packageName: 'HTrace: Screen Space Global Illumination URP'
|
||||
packageVersion: 1.2.0
|
||||
assetPath: Assets/HTraceSSGI/Sample Scene/Sample Scene SSGI URP/HTrace SSGI Sample
|
||||
Scene URP.unity
|
||||
uploadId: 840002
|
||||
@@ -0,0 +1,356 @@
|
||||
%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: Material Green
|
||||
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: -1
|
||||
stringTagMap:
|
||||
RenderType: Opaque
|
||||
disabledShaderPasses:
|
||||
- TransparentDepthPrepass
|
||||
- TransparentDepthPostpass
|
||||
- TransparentBackface
|
||||
- RayTracingPrepass
|
||||
- MOTIONVECTORS
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _AnisotropyMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BaseColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BentNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BentNormalMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _CoatMaskMap:
|
||||
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}
|
||||
- _DetailMap:
|
||||
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}
|
||||
- _EmissiveColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _HeightMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _IridescenceMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _IridescenceThicknessMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
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}
|
||||
- _NormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _NormalMapOS:
|
||||
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}
|
||||
- _SpecularColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SubsurfaceMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TangentMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TangentMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ThicknessMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TransmissionMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TransmittanceColorMap:
|
||||
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:
|
||||
- _AORemapMax: 1
|
||||
- _AORemapMin: 0
|
||||
- _ATDistance: 1
|
||||
- _AddPrecomputedVelocity: 0
|
||||
- _AlbedoAffectEmissive: 0
|
||||
- _AlphaClip: 0
|
||||
- _AlphaCutoff: 0.5
|
||||
- _AlphaCutoffEnable: 0
|
||||
- _AlphaCutoffPostpass: 0.5
|
||||
- _AlphaCutoffPrepass: 0.5
|
||||
- _AlphaCutoffShadow: 0.5
|
||||
- _AlphaDstBlend: 0
|
||||
- _AlphaRemapMax: 1
|
||||
- _AlphaRemapMin: 0
|
||||
- _AlphaSrcBlend: 1
|
||||
- _AlphaToMask: 0
|
||||
- _Anisotropy: 0
|
||||
- _Blend: 0
|
||||
- _BlendMode: 0
|
||||
- _BlendModePreserveSpecular: 1
|
||||
- _BumpScale: 1
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _CoatMask: 0
|
||||
- _Cull: 2
|
||||
- _CullMode: 2
|
||||
- _CullModeForward: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DepthOffsetEnable: 0
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailAlbedoScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DetailNormalScale: 1
|
||||
- _DetailSmoothnessScale: 1
|
||||
- _DiffusionProfile: 0
|
||||
- _DiffusionProfileHash: 0
|
||||
- _DisplacementLockObjectScale: 1
|
||||
- _DisplacementLockTilingScale: 1
|
||||
- _DisplacementMode: 0
|
||||
- _DoubleSidedEnable: 0
|
||||
- _DoubleSidedGIMode: 0
|
||||
- _DoubleSidedNormalMode: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlend2: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EmissiveColorMode: 1
|
||||
- _EmissiveExposureWeight: 1
|
||||
- _EmissiveIntensity: 1
|
||||
- _EmissiveIntensityUnit: 0
|
||||
- _EnableBlendModePreserveSpecularLighting: 1
|
||||
- _EnableFogOnTransparent: 1
|
||||
- _EnableGeometricSpecularAA: 0
|
||||
- _EnergyConservingSpecularColor: 1
|
||||
- _EnvironmentReflections: 1
|
||||
- _GlossMapScale: 0
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _HeightAmplitude: 0.02
|
||||
- _HeightCenter: 0.5
|
||||
- _HeightMapParametrization: 0
|
||||
- _HeightMax: 1
|
||||
- _HeightMin: -1
|
||||
- _HeightOffset: 0
|
||||
- _HeightPoMAmplitude: 2
|
||||
- _HeightTessAmplitude: 2
|
||||
- _HeightTessCenter: 0.5
|
||||
- _InvTilingScale: 1
|
||||
- _Ior: 1.5
|
||||
- _IridescenceMask: 1
|
||||
- _IridescenceThickness: 1
|
||||
- _LinkDetailsWithBase: 1
|
||||
- _MaterialID: 1
|
||||
- _Metallic: 0
|
||||
- _MetallicRemapMax: 1
|
||||
- _MetallicRemapMin: 0
|
||||
- _NormalMapSpace: 0
|
||||
- _NormalScale: 1
|
||||
- _ObjectSpaceUVMapping: 0
|
||||
- _ObjectSpaceUVMappingEmissive: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _OpaqueCullMode: 2
|
||||
- _PPDLodThreshold: 5
|
||||
- _PPDMaxSamples: 15
|
||||
- _PPDMinSamples: 5
|
||||
- _PPDPrimitiveLength: 1
|
||||
- _PPDPrimitiveWidth: 1
|
||||
- _Parallax: 0.005
|
||||
- _PerPixelSorting: 0
|
||||
- _QueueOffset: 0
|
||||
- _RayTracing: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _ReceivesSSR: 1
|
||||
- _ReceivesSSRTransparent: 0
|
||||
- _RefractionModel: 0
|
||||
- _Smoothness: 0
|
||||
- _SmoothnessRemapMax: 1
|
||||
- _SmoothnessRemapMin: 0
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularAAScreenSpaceVariance: 0.1
|
||||
- _SpecularAAThreshold: 0.2
|
||||
- _SpecularHighlights: 1
|
||||
- _SpecularOcclusionMode: 1
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _StencilRef: 0
|
||||
- _StencilRefDepth: 8
|
||||
- _StencilRefGBuffer: 10
|
||||
- _StencilRefMV: 40
|
||||
- _StencilWriteMask: 6
|
||||
- _StencilWriteMaskDepth: 9
|
||||
- _StencilWriteMaskGBuffer: 15
|
||||
- _StencilWriteMaskMV: 41
|
||||
- _SubsurfaceMask: 1
|
||||
- _SupportDecals: 1
|
||||
- _Surface: 0
|
||||
- _SurfaceType: 0
|
||||
- _TexWorldScale: 1
|
||||
- _TexWorldScaleEmissive: 1
|
||||
- _Thickness: 1
|
||||
- _TransmissionEnable: 1
|
||||
- _TransmissionMask: 1
|
||||
- _TransparentBackfaceEnable: 0
|
||||
- _TransparentCullMode: 2
|
||||
- _TransparentDepthPostpassEnable: 0
|
||||
- _TransparentDepthPrepassEnable: 0
|
||||
- _TransparentSortPriority: 0
|
||||
- _TransparentWritingMotionVec: 0
|
||||
- _TransparentZWrite: 0
|
||||
- _UVBase: 0
|
||||
- _UVDetail: 0
|
||||
- _UVEmissive: 0
|
||||
- _UseEmissiveIntensity: 0
|
||||
- _UseShadowThreshold: 0
|
||||
- _WorkflowMode: 1
|
||||
- _ZTestDepthEqualForOpaque: 3
|
||||
- _ZTestGBuffer: 4
|
||||
- _ZTestTransparent: 4
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 0, g: 1, b: 0, a: 1}
|
||||
- _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _Color: {r: 0, g: 1, b: 0, a: 1}
|
||||
- _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
|
||||
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EmissiveColorLDR: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
|
||||
- _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
|
||||
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
--- !u!114 &1339670755895587704
|
||||
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: 10
|
||||
--- !u!114 &7733451441409226090
|
||||
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: da692e001514ec24dbc4cca1949ff7e8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 13
|
||||
hdPluginSubTargetMaterialVersions:
|
||||
m_Keys: []
|
||||
m_Values:
|
||||