Compare commits

..

6 Commits

Author SHA1 Message Date
rsformoso 97c82d46b8 Restructure project 2026-03-28 21:31:03 +08:00
rsformoso 3769723861 Add analytic Gaussian shader 2026-03-28 21:28:29 +08:00
rsformoso 48a0e3facb Switch to non-branching approach for GetMajorAxes 2026-03-28 21:27:46 +08:00
rsformoso f620a650aa Update TODO 2026-03-22 11:21:33 +08:00
rsformoso 2a2ebf8ae7 Switch to interleaved RGB for spherical harmonics 2026-03-20 23:56:30 +08:00
rsformoso e774cc6663 Add minimum splat size to GetMajorAxes 2026-03-20 23:55:40 +08:00
30 changed files with 4073 additions and 2337 deletions
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3af8f06e8a10afb43b30f6746acbf7a3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 8705e6675e3398743b179e7517477f95
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 7aed4a49184670549a7848ee83952078, type: 3}
Binary file not shown.
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: dfbafcee1589b994190c8b138fa536fd
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 7aed4a49184670549a7848ee83952078, type: 3}
Binary file not shown.
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 06451afa071792b4fb063e0bcda1bf4e
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 7aed4a49184670549a7848ee83952078, type: 3}
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 31ae15794738c134a94e378c021711b0
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 7aed4a49184670549a7848ee83952078, type: 3}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cb5a5730510d4e149b46695b20885be2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -119,191 +119,6 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1001 &562634546
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.size
value: 2
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.size
value: 2
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[0].m_Name
value: SplatCount
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[1].m_Name
value: SHDegrees
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Name
value: ScaleMultiplier
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[1].m_Name
value: OpacityMultiplier
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[0].m_Value
value: 200000
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[1].m_Value
value: 3
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Value
value: 64
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[1].m_Value
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Name
value: GradientScale
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[0].m_Overridden
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[1].m_Overridden
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Overridden
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[1].m_Overridden
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Overridden
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.atime0
value: 0
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.atime1
value: 65535
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.ctime0
value: 0
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.ctime1
value: 65535
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.key1.a
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.key1.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.key1.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.key1.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.m_Mode
value: 0
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.m_ColorSpace
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.m_NumAlphaKeys
value: 2
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Value.m_NumColorKeys
value: 2
objectReference: {fileID: 0}
- target: {fileID: -774367247743995920, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_LocalScale.y
value: -1
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8980549144392899874, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_Name
value: splat_45000
objectReference: {fileID: 0}
- target: {fileID: 8980549144392899874, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: -4216948427090074523, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
--- !u!1 &688714159
GameObject:
m_ObjectHideFlags: 0
@@ -440,7 +255,7 @@ Transform:
m_GameObject: {fileID: 1826889287}
serializedVersion: 2
m_LocalRotation: {x: 0.18301274, y: -0.6830127, z: 0.18301274, w: 0.6830127}
m_LocalPosition: {x: 2.1, y: 0.8, z: 0.2}
m_LocalPosition: {x: 2.1, y: 1.23, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -617,10 +432,151 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1001 &2104382819
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: -8930390722167643903, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_ExecuteInEditor
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.size
value: 2
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.size
value: 2
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[0].m_Name
value: SplatCount
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[1].m_Name
value: SHDegrees
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Name
value: OpacityMultiplier
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[1].m_Name
value: ScaleMultiplier
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[0].m_Value
value: 20000
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[1].m_Value
value: 3
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Value
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[1].m_Value
value: 64
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[0].m_Overridden
value: 1
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[1].m_Overridden
value: 0
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Overridden
value: 0
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[1].m_Overridden
value: 0
objectReference: {fileID: 0}
- target: {fileID: -774367247743995920, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_LocalScale.x
value: 2
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_LocalScale.y
value: -2
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_LocalScale.z
value: 2
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_LocalPosition.x
value: 0.11
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_LocalPosition.y
value: 3.09
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_LocalPosition.z
value: -0.1
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_LocalRotation.w
value: 0.96583617
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_LocalRotation.x
value: 0.09989466
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_LocalRotation.y
value: -0.23785771
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_LocalRotation.z
value: 0.024601186
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 11.81
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: -27.67
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -364223573239433514, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_ConstrainProportionsScale
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8980549144392899874, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_Name
value: watch
objectReference: {fileID: 0}
- target: {fileID: 8980549144392899874, guid: 31ae15794738c134a94e378c021711b0, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: -4216948427090074523, guid: 31ae15794738c134a94e378c021711b0, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 688714160}
- {fileID: 1911516433}
- {fileID: 562634546}
- {fileID: 2104382819}
@@ -319,9 +319,11 @@ namespace SplatVfx.Editor
color = 0.5f + color * SH_C0;
splatDataNative.color[elemIx] = color;
for (int j = 0; j < 45; j++)
for (int j = 0; j < 15; j++)
{
splatDataNative.sh[elemIx * 45 + j] = chunkBytes.ReinterpretLoad<float>(start + headerData.ElementByteOffsets[(int)DataEnum.f_rest_0 + j]);
splatDataNative.sh[elemIx * 45 + j * 3] = chunkBytes.ReinterpretLoad<float>(start + headerData.ElementByteOffsets[(int)DataEnum.f_rest_0 + j]);
splatDataNative.sh[elemIx * 45 + j * 3 + 1] = chunkBytes.ReinterpretLoad<float>(start + headerData.ElementByteOffsets[(int)DataEnum.f_rest_0 + 15 + j]);
splatDataNative.sh[elemIx * 45 + j * 3 + 2] = chunkBytes.ReinterpretLoad<float>(start + headerData.ElementByteOffsets[(int)DataEnum.f_rest_0 + 30 + j]);
}
float opacity = chunkBytes.ReinterpretLoad<float>(start + headerData.ElementByteOffsets[(int)DataEnum.opacity]);
@@ -1,3 +1,5 @@
#define sh(i) SHBuffer[Index * 45 + (i - 1)]
/// Index: The splat's index
/// Degrees: The degrees of spherical harmonics to calculate
/// DirClr: A 4x4 matrix with the first row containing a vector from the splat position to the camera, and the second row containing its base color
@@ -27,47 +29,49 @@ float3 CalculateSHColor(uint Index, uint Degrees, float4x4 DirClr, StructuredBuf
float3 sh[16];
// INTERLEAVED RGB when loaded as StructuredBuffer<float>
// for (int i = 1; i < 16; i++)
// {
// sh[i].x = SHBuffer[Index * 45 + (i - 1) * 3];
// sh[i].y = SHBuffer[Index * 45 + (i - 1) * 3 + 1];
// sh[i].z = SHBuffer[Index * 45 + (i - 1) * 3 + 2];
// }
for (int i = 1; i < 16; i++)
{
sh[i].x = SHBuffer[Index * 45 + (i - 1)];
sh[i].y = SHBuffer[Index * 45 + 15 + (i - 1)];
sh[i].z = SHBuffer[Index * 45 + 30 + (i - 1)];
}
// CONTINUOUS CHANNELS when loaded as StructuredBuffer<float>
// for (int i = 1; i < 16; i++)
// {
// sh[i].x = SHBuffer[Index * 45 + (i - 1)];
// sh[i].y = SHBuffer[Index * 45 + 15 + (i - 1)];
// sh[i].z = SHBuffer[Index * 45 + 30 + (i - 1)];
// }
if (Degrees > 0)
{
float x = dir.x;
float y = dir.y;
float z = dir.z;
result = result - SH_C1 * y * sh[1] + SH_C1 * z * sh[2] - SH_C1 * x * sh[3];
result = result - SH_C1 * y * sh(1) + SH_C1 * z * sh(2) - SH_C1 * x * sh(3);
if (Degrees > 1)
{
float xx = x * x, yy = y * y, zz = z * z;
float xy = x * y, yz = y * z, xz = x * z;
result = result +
SH_C2[0] * xy * sh[4] +
SH_C2[1] * yz * sh[5] +
SH_C2[2] * (2.0f * zz - xx - yy) * sh[6] +
SH_C2[3] * xz * sh[7] +
SH_C2[4] * (xx - yy) * sh[8];
SH_C2[0] * xy * sh(4) +
SH_C2[1] * yz * sh(5) +
SH_C2[2] * (2.0f * zz - xx - yy) * sh(6) +
SH_C2[3] * xz * sh(7) +
SH_C2[4] * (xx - yy) * sh(8);
if (Degrees > 2)
{
result = result +
SH_C3[0] * y * (3.0f * xx - yy) * sh[9] +
SH_C3[1] * xy * z * sh[10] +
SH_C3[2] * y * (4.0f * zz - xx - yy) * sh[11] +
SH_C3[3] * z * (2.0f * zz - 3.0f * xx - 3.0f * yy) * sh[12] +
SH_C3[4] * x * (4.0f * zz - xx - yy) * sh[13] +
SH_C3[5] * z * (xx - yy) * sh[14] +
SH_C3[6] * x * (xx - 3.0f * yy) * sh[15];
SH_C3[0] * y * (3.0f * xx - yy) * sh(9) +
SH_C3[1] * xy * z * sh(10) +
SH_C3[2] * y * (4.0f * zz - xx - yy) * sh(11) +
SH_C3[3] * z * (2.0f * zz - 3.0f * xx - 3.0f * yy) * sh(12) +
SH_C3[4] * x * (4.0f * zz - xx - yy) * sh(13) +
SH_C3[5] * z * (xx - yy) * sh(14) +
SH_C3[6] * x * (xx - 3.0f * yy) * sh(15);
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: f0801febb2a50a54ba1429eca4d4c0a1
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
useAsTemplate: 0
exposeTemplateAsShader: 0
template:
name:
category:
description:
icon: {instanceID: 0}
thumbnail: {instanceID: 0}
+54
View File
@@ -0,0 +1,54 @@
#define EPSILON 0.0004f
float CrossProduct(float2 A, float2 B)
{
return A.x * B.y - A.y * B.x;
}
float SweepArea(float2 A, float2 B)
{
return abs(CrossProduct(A, B));
}
float4x4 GetMajorAxes(float4x4 Axes, float4x4 AxesProjections)
{
float4x4 result = (float4x4)0;
float2 x_proj = AxesProjections[0].xy;
float2 y_proj = AxesProjections[1].xy;
float2 z_proj = AxesProjections[2].xy;
float3 x_axes = Axes[0].xyz;
float3 y_axes = Axes[1].xyz;
float3 z_axes = Axes[2].xyz;
float xy_area = SweepArea(x_proj, y_proj);
float xz_area = SweepArea(x_proj, z_proj);
float yz_area = SweepArea(y_proj, z_proj);
// Compute selection weights using step
float xy_is_max = step(xz_area, xy_area) * step(yz_area, xy_area);
float xz_is_max = step(yz_area, xz_area) * (1.0 - xy_is_max);
float yz_is_max = 1.0 - xy_is_max - xz_is_max;
// Select axis0
float3 axis0 =
xy_is_max * x_axes +
xz_is_max * x_axes +
yz_is_max * y_axes;
// Select axis1
float3 axis1 =
xy_is_max * y_axes +
xz_is_max * z_axes +
yz_is_max * z_axes;
// Normalize and scale if length is below threshold
float len0 = length(axis0);
float len1 = length(axis1);
result[0].xyz = normalize(axis0) * max(len0, EPSILON);
result[1].xyz = normalize(axis1) * max(len1, EPSILON);
return result;
}
File diff suppressed because it is too large Load Diff
@@ -1,46 +0,0 @@
/// Hidden
float CrossProduct(float2 A, float2 B)
{
return A.x * B.y - A.y * B.x;
}
/// Hidden
float SweepArea(float2 A, float2 B)
{
return abs(CrossProduct(A, B));
}
float4x4 GetMajorAxes(float4x4 Axes, float4x4 AxesProjections)
{
float4x4 result = (float4x4)0;
float2 x_proj = AxesProjections[0].xy;
float2 y_proj = AxesProjections[1].xy;
float2 z_proj = AxesProjections[2].xy;
float3 x_axes = Axes[0].xyz;
float3 y_axes = Axes[1].xyz;
float3 z_axes = Axes[2].xyz;
float xy_area = SweepArea(x_proj, y_proj);
float xz_area = SweepArea(x_proj, z_proj);
float yz_area = SweepArea(y_proj, z_proj);
if (xy_area > xz_area && xy_area > yz_area)
{
result[0].xyz = x_axes;
result[1].xyz = y_axes;
}
else if (xz_area > yz_area)
{
result[0].xyz = x_axes;
result[1].xyz = z_axes;
}
else
{
result[0].xyz = y_axes;
result[1].xyz = z_axes;
}
return result;
}
Binary file not shown.
+1 -1
View File
@@ -6,7 +6,7 @@ EditorBuildSettings:
serializedVersion: 2
m_Scenes:
- enabled: 1
path: Assets/vfx-graph-gs/Main.unity
path: Assets/vfx-graph-gs/Scenes/Main.unity
guid: 09fad7c6f4d48844d9510f9903fca619
m_configObjects:
com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3}
+18 -4
View File
@@ -1,8 +1,13 @@
# TODO
- [ ] Rewrite SH Array to use interleaved RGB rather than contiguous data per
channel
- [ ] Switch to using ByteAddressBuffers instead of loops in CalculateSH.hlsl
- [ ] Account for the fact that a larger minor axis "hardens" splat edges
- Maybe shift the alpha gradient, or incorporate into shader
- [ ] Rework SplatBinder system to collect all splat objects in the scene and
combine their buffers
- [ ] Write shader to calculate Gaussians at runtime
- Texture lookups are slow on mobile
- [ ] ~~Write shader that prevents pixel overdraw~~
- ~~Applies cumulative alpha,while drawing back to front, and writes to the
Z-buffer after a certain threshold~~
- [ ] Optimize CalculateAxes.hlsl
- [ ] Allow splat data buffers to be accessible by other VFX Graphs
- [ ] Support SOGS format
@@ -11,3 +16,12 @@
- [ ] Add support for ASCII PLY data
- [ ] Fix the header parsing logic in SplatImporter.cs
- [ ] Add more thorough checks in SplatDataBinder.cs
# DONE
- [x] Rewrite SH Array to use interleaved RGB rather than contiguous data per
channel
- [x] Switch to using ByteAddressBuffers instead of loops in CalculateSH.hlsl
- Used StructuredBuffer\<float3\> instead
# NOTES
- Does VFX Graph calculate the Update and Render blocks before applying Z-test?