Implement correct renderer

This commit is contained in:
2026-03-13 14:52:08 +08:00
parent 7c540bb6ad
commit cdfcc49f7f
24 changed files with 7680 additions and 11058 deletions
@@ -1,10 +0,0 @@
// Convert scaling vector to 4x4 transformation matrix
// Scaling values are applied to X, Y, Z axes (sxyz.x, sxyz.y, sxyz.z)
float CrossProduct(float2 u, float2 v) {
// Create diagonal scaling matrix
// s.x applied to X-axis
// s.y applied to Y-axis
// s.z applied to Z-axis
return u.x * v.y - u.y * v.x;
}
+3 -234
View File
@@ -119,120 +119,7 @@ NavMeshSettings:
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1 &4654394 --- !u!1001 &562634546
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4654395}
- component: {fileID: 4654398}
- component: {fileID: 4654397}
- component: {fileID: 4654396}
m_Layer: 0
m_Name: Quad
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4654395
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4654394}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: -1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1904087984}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!64 &4654396
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4654394}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 5
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &4654397
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4654394}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &4654398
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4654394}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1001 &49971200
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2 serializedVersion: 2
@@ -246,10 +133,6 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3} - target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.size 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_Vector3f.m_Array.Array.size
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3} - target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
@@ -260,25 +143,13 @@ PrefabInstance:
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Name propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Name
value: ScaleMultiplier value: ScaleMultiplier
objectReference: {fileID: 0} 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} - target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[0].m_Value propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[0].m_Value
value: 200000 value: 200000
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3} - target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Value propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Value
value: 179.5 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: -130.2
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Vector3f.m_Array.Array.data[0].m_Name
value: Pivot
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3} - target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[0].m_Overridden propertyPath: m_PropertySheet.m_Uint.m_Array.Array.data[0].m_Overridden
@@ -288,26 +159,6 @@ PrefabInstance:
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Overridden propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[0].m_Overridden
value: 1 value: 1
objectReference: {fileID: 0} 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_Vector3f.m_Array.Array.data[0].m_Value.x
value: 1.85
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Vector3f.m_Array.Array.data[0].m_Value.y
value: -1.19
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Vector3f.m_Array.Array.data[0].m_Value.z
value: -13.3
objectReference: {fileID: 0}
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_PropertySheet.m_Vector3f.m_Array.Array.data[0].m_Overridden
value: 1
objectReference: {fileID: 0}
- target: {fileID: -774367247743995920, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3} - target: {fileID: -774367247743995920, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_Enabled propertyPath: m_Enabled
value: 1 value: 1
@@ -360,47 +211,11 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: splat_45000 value: splat_45000
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8980549144392899874, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: [] m_AddedComponents: []
m_SourcePrefab: {fileID: -4216948427090074523, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3} m_SourcePrefab: {fileID: -4216948427090074523, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
--- !u!1 &262750850
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 262750851}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &262750851
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 262750850}
serializedVersion: 2
m_LocalRotation: {x: -0.09383813, y: 0.44299415, z: -0.1847652, w: 0.87224567}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2.32, y: 3.76, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1904087984}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 53.85, z: -23.92}
--- !u!1 &1826889287 --- !u!1 &1826889287
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -538,51 +353,6 @@ MonoBehaviour:
m_VarianceClampScale: 0.9 m_VarianceClampScale: 0.9
m_ContrastAdaptiveSharpening: 0 m_ContrastAdaptiveSharpening: 0
m_Version: 2 m_Version: 2
--- !u!1 &1904087983
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1904087984}
- component: {fileID: 1904087985}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1904087984
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1904087983}
serializedVersion: 2
m_LocalRotation: {x: -0.1847652, y: 0.87224567, z: 0.09383813, w: 0.44299415}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4654395}
m_Father: {fileID: 262750851}
m_LocalEulerAnglesHint: {x: 0, y: -768.2, z: 0}
--- !u!114 &1904087985
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1904087983}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8393160045a3abd48809f9ced6b0df58, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::TestLook
--- !u!1 &1911516430 --- !u!1 &1911516430
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -716,5 +486,4 @@ SceneRoots:
m_Roots: m_Roots:
- {fileID: 1826889290} - {fileID: 1826889290}
- {fileID: 1911516433} - {fileID: 1911516433}
- {fileID: 49971200} - {fileID: 562634546}
- {fileID: 262750851}
@@ -1,38 +0,0 @@
// Convert quaternion to 4x4 transformation matrix
// Quaternion is stored as (w, x, y, z) where w is the scalar part
float4x4 QuaternionToMatrix(float4 q) {
// Extract quaternion components
float w = q.w;
float x = q.x;
float y = q.y;
float z = q.z;
// Calculate matrix elements
float m00 = 1.0 - 2.0 * (y * y + z * z);
float m01 = 2.0 * (x * y - z * w);
float m02 = 2.0 * (x * z + y * w);
float m03 = 0.0;
float m10 = 2.0 * (x * y + z * w);
float m11 = 1.0 - 2.0 * (x * x + z * z);
float m12 = 2.0 * (y * z - x * w);
float m13 = 0.0;
float m20 = 2.0 * (x * z - y * w);
float m21 = 2.0 * (y * z + x * w);
float m22 = 1.0 - 2.0 * (x * x + y * y);
float m23 = 0.0;
float m30 = 0.0;
float m31 = 0.0;
float m32 = 0.0;
float m33 = 1.0;
// Return matrix
return float4x4(
m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23,
m30, m31, m32, m33
);
}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4b5d0ba5e774c6d4f8f8b361476e8f1b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -221,17 +221,17 @@ namespace SplatVfx.Editor
switch (property.name[6]) switch (property.name[6])
{ {
case '0': case '0':
splatData.ScaleArray[i].x = val; splatData.ScaleArray[i].x = math.exp(val);
break; break;
case '1': case '1':
splatData.ScaleArray[i].y = val; splatData.ScaleArray[i].y = math.exp(val);
break; break;
case '2': case '2':
splatData.ScaleArray[i].z = val; splatData.ScaleArray[i].z = math.exp(val);
break; break;
} }
@@ -242,22 +242,22 @@ namespace SplatVfx.Editor
switch (property.name[4]) switch (property.name[4])
{ {
case '0': case '0':
splatData.RotationArray[i].x = val; splatData.RotationArray[i].w = val;
break; break;
case '1': case '1':
splatData.RotationArray[i].y = val; splatData.RotationArray[i].x = val;
break; break;
case '2': case '2':
splatData.RotationArray[i].z = val; splatData.RotationArray[i].y = val;
break; break;
case '3': case '3':
splatData.RotationArray[i].w = val; splatData.RotationArray[i].z = val;
break; break;
} }
File diff suppressed because it is too large Load Diff
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bb92af38d2a022242b4dddcb954f789e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,49 @@
// Convert quaternion to 4x4 transformation matrix with non-uniform scaling
float4x4 CalculateAxes(float4 q, float3 s) {
// Extract quaternion components
float w = q.w;
float x = q.x;
float y = q.y;
float z = q.z;
// Calculate rotated basis vectors (columns of the matrix)
// This represents the quaternion rotation applied to the unit axes
float rx = w * x - w * z + y * z + x * y;
float ry = w * y + x * z + w * z + x * y;
float rz = x * x - y * y - z * z + w * w;
// More direct approach using the matrix formula
float m00 = 1.0 - 2.0 * (y * y + z * z);
float m01 = 2.0 * (x * y - z * w);
float m02 = 2.0 * (x * z + y * w);
float m10 = 2.0 * (x * y + z * w);
float m11 = 1.0 - 2.0 * (x * x + z * z);
float m12 = 2.0 * (y * z - x * w);
float m20 = 2.0 * (x * z - y * w);
float m21 = 2.0 * (y * z + x * w);
float m22 = 1.0 - 2.0 * (x * x + y * y);
// Apply scaling to each axis
// Each column of the matrix is the rotated axis scaled by the corresponding factor
float sx = s.x;
float sy = s.y;
float sz = s.z;
float m03 = 0.0;
float m13 = 0.0;
float m23 = 0.0;
float m30 = 0.0;
float m31 = 0.0;
float m32 = 0.0;
float m33 = 1.0;
// Return matrix with scaling
return float4x4(
m00 * sx, m01 * sy, m02 * sz, m03,
m10 * sx, m11 * sy, m12 * sz, m13,
m20 * sx, m21 * sy, m22 * sz, m23,
m30, m31, m32, m33
);
}
@@ -0,0 +1,44 @@
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);
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;
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f8f4610af7293684491e647c5387e5e4 guid: 6a36c7edf50aac44a8cdbd3388623256
ShaderIncludeImporter: ShaderIncludeImporter:
externalObjects: {} externalObjects: {}
userData: userData:
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 25c54d8c074f08447ab1c822a6a052fa
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 7aed4a49184670549a7848ee83952078, type: 3}