Misc configs
This commit is contained in:
@@ -12,8 +12,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3}
|
||||
m_Name: Mobile_RPAsset
|
||||
m_EditorClassIdentifier:
|
||||
k_AssetVersion: 12
|
||||
k_AssetPreviousVersion: 12
|
||||
k_AssetVersion: 13
|
||||
k_AssetPreviousVersion: 13
|
||||
m_RendererType: 1
|
||||
m_RendererData: {fileID: 0}
|
||||
m_RendererDataList:
|
||||
@@ -53,6 +53,7 @@ MonoBehaviour:
|
||||
m_AdditionalLightsShadowResolutionTierHigh: 1024
|
||||
m_ReflectionProbeBlending: 1
|
||||
m_ReflectionProbeBoxProjection: 1
|
||||
m_ReflectionProbeAtlas: 1
|
||||
m_ShadowDistance: 50
|
||||
m_ShadowCascadeCount: 1
|
||||
m_Cascade2Split: 0.25
|
||||
@@ -78,11 +79,11 @@ MonoBehaviour:
|
||||
m_UseAdaptivePerformance: 1
|
||||
m_ColorGradingMode: 0
|
||||
m_ColorGradingLutSize: 32
|
||||
m_AllowPostProcessAlphaOutput: 0
|
||||
m_UseFastSRGBLinearConversion: 1
|
||||
m_SupportDataDrivenLensFlare: 1
|
||||
m_SupportScreenSpaceLensFlare: 1
|
||||
m_GPUResidentDrawerMode: 0
|
||||
m_UseLegacyLightmaps: 0
|
||||
m_SmallMeshScreenPercentage: 0
|
||||
m_GPUResidentDrawerEnableOcclusionCullingInCameras: 0
|
||||
m_ShadowType: 1
|
||||
@@ -109,6 +110,7 @@ MonoBehaviour:
|
||||
m_PrefilterDebugKeywords: 1
|
||||
m_PrefilterWriteRenderingLayers: 1
|
||||
m_PrefilterHDROutput: 1
|
||||
m_PrefilterAlphaOutput: 0
|
||||
m_PrefilterSSAODepthNormals: 1
|
||||
m_PrefilterSSAOSourceDepthLow: 1
|
||||
m_PrefilterSSAOSourceDepthMedium: 0
|
||||
@@ -126,8 +128,14 @@ MonoBehaviour:
|
||||
m_PrefilterSoftShadowsQualityHigh: 1
|
||||
m_PrefilterSoftShadows: 0
|
||||
m_PrefilterScreenCoord: 1
|
||||
m_PrefilterScreenSpaceIrradiance: 0
|
||||
m_PrefilterNativeRenderPass: 1
|
||||
m_PrefilterUseLegacyLightmaps: 0
|
||||
m_PrefilterBicubicLightmapSampling: 0
|
||||
m_PrefilterReflectionProbeRotation: 0
|
||||
m_PrefilterReflectionProbeBlending: 0
|
||||
m_PrefilterReflectionProbeBoxProjection: 0
|
||||
m_PrefilterReflectionProbeAtlas: 0
|
||||
m_ShaderVariantLogLevel: 0
|
||||
m_ShadowCascades: 0
|
||||
m_Textures:
|
||||
|
||||
@@ -169,7 +169,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Float.m_Array.Array.data[1].m_Value
|
||||
value: 1
|
||||
value: 1.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -973084862543737302, guid: 25c54d8c074f08447ab1c822a6a052fa, type: 3}
|
||||
propertyPath: m_PropertySheet.m_Gradient.m_Array.Array.data[0].m_Name
|
||||
|
||||
@@ -3,27 +3,15 @@ using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
using UnityEngine.VFX;
|
||||
using UnityEngine.VFX.Utility;
|
||||
using UnityEditor;
|
||||
using UnityEditor.AssetImporters;
|
||||
using UnityEditor.Experimental;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using UnityEditor.Rendering.LookDev;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VectorGraphics;
|
||||
using Unity.VisualScripting;
|
||||
using System.Collections;
|
||||
using Unity.Collections;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
using UnityEngine.Playables;
|
||||
using Unity.Android.Gradle.Manifest;
|
||||
using UnityEngine.Timeline;
|
||||
using Unity.Jobs;
|
||||
using System.Xml.Schema;
|
||||
using Unity.Android.Gradle;
|
||||
|
||||
namespace SplatVfx.Editor
|
||||
{
|
||||
@@ -285,6 +273,10 @@ namespace SplatVfx.Editor
|
||||
splatData.OpacityArray[totalElemsRead + i] = splatDataNative.opacity[i];
|
||||
splatData.ScaleArray[totalElemsRead + i] = splatDataNative.scale[i];
|
||||
splatData.RotationArray[totalElemsRead + i] = new quaternion(splatDataNative.rotation[i]);
|
||||
for (int j = 0; j < 45; j++)
|
||||
{
|
||||
splatData.SHArray[(totalElemsRead + i) * 45 + j] = splatDataNative.sh[i * 45 + j];
|
||||
}
|
||||
}
|
||||
|
||||
totalElemsRead += numElemsRead;
|
||||
@@ -336,7 +328,7 @@ namespace SplatVfx.Editor
|
||||
|
||||
for (int j = 0; j < 45; j++)
|
||||
{
|
||||
splatDataNative.sh[elemIx + j] = chunkBytes[start + headerData.ElementByteOffsets[(int)DataEnum.f_rest_0 + j]];
|
||||
splatDataNative.sh[elemIx * 45 + j] = chunkBytes.ReinterpretLoad<float>(start + headerData.ElementByteOffsets[(int)DataEnum.f_rest_0 + j]);
|
||||
}
|
||||
|
||||
float opacity = chunkBytes.ReinterpretLoad<float>(start + headerData.ElementByteOffsets[(int)DataEnum.opacity]);
|
||||
@@ -363,128 +355,6 @@ namespace SplatVfx.Editor
|
||||
}
|
||||
}
|
||||
|
||||
SplatData ImportAsSplatData((string format, int num_element, List<(string, string)> properties) header_info, byte[] binaryData)
|
||||
{
|
||||
var splatData = ScriptableObject.CreateInstance<SplatData>();
|
||||
|
||||
var stream = new MemoryStream(binaryData);
|
||||
var reader = new BinaryReader(stream);
|
||||
|
||||
splatData.PositionArray = new Vector3[header_info.num_element];
|
||||
splatData.ScaleArray = new Vector3[header_info.num_element];
|
||||
splatData.RotationArray = new Quaternion[header_info.num_element];
|
||||
splatData.ColorArray = new Color[header_info.num_element];
|
||||
splatData.OpacityArray = new float[header_info.num_element];
|
||||
splatData.SHArray = new float[header_info.num_element * 45];
|
||||
|
||||
for (int i = 0; i < header_info.num_element; i++)
|
||||
{
|
||||
foreach ((string name, string dtype) property in header_info.properties)
|
||||
{
|
||||
float val = reader.ReadSingle();
|
||||
|
||||
switch (property.name)
|
||||
{
|
||||
case "x":
|
||||
splatData.PositionArray[i].x = val;
|
||||
|
||||
break;
|
||||
|
||||
case "y":
|
||||
splatData.PositionArray[i].y = val;
|
||||
|
||||
break;
|
||||
|
||||
case "z":
|
||||
splatData.PositionArray[i].z = val;
|
||||
|
||||
break;
|
||||
|
||||
case "opacity":
|
||||
splatData.OpacityArray[i] = 1 / (1 + math.exp(-val));
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
if (property.name.StartsWith("f_dc"))
|
||||
{
|
||||
switch (property.name[5])
|
||||
{
|
||||
case '0':
|
||||
splatData.ColorArray[i].r = 0.5f + val * SH_C0;
|
||||
|
||||
break;
|
||||
|
||||
case '1':
|
||||
splatData.ColorArray[i].g = 0.5f + val * SH_C0;
|
||||
|
||||
break;
|
||||
|
||||
case '2':
|
||||
splatData.ColorArray[i].b = 0.5f + val * SH_C0;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else if (property.name.StartsWith("scale"))
|
||||
{
|
||||
switch (property.name[6])
|
||||
{
|
||||
case '0':
|
||||
splatData.ScaleArray[i].x = math.exp(val);
|
||||
|
||||
break;
|
||||
|
||||
case '1':
|
||||
splatData.ScaleArray[i].y = math.exp(val);
|
||||
|
||||
break;
|
||||
|
||||
case '2':
|
||||
splatData.ScaleArray[i].z = math.exp(val);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else if (property.name.StartsWith("rot"))
|
||||
{
|
||||
switch (property.name[4])
|
||||
{
|
||||
case '0':
|
||||
splatData.RotationArray[i].w = val;
|
||||
|
||||
break;
|
||||
|
||||
case '1':
|
||||
splatData.RotationArray[i].x = val;
|
||||
|
||||
break;
|
||||
|
||||
case '2':
|
||||
splatData.RotationArray[i].y = val;
|
||||
|
||||
break;
|
||||
|
||||
case '3':
|
||||
splatData.RotationArray[i].z = val;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
splatData.ReleaseGpuResources();
|
||||
|
||||
return splatData;
|
||||
}
|
||||
|
||||
// struct ReadData
|
||||
// {
|
||||
// public float px, py, pz;
|
||||
|
||||
+1396
-683
File diff suppressed because it is too large
Load Diff
@@ -1,57 +1,63 @@
|
||||
#define sh(i) (float3)SHBuffer.Load3(Index * 45 + (i - 1) * 15)
|
||||
float3 CalculateSHColor(uint Index, uint Degrees, float4x4 DirClr, StructuredBuffer<float> SHBuffer) {
|
||||
const float SH_C0 = 0.28209479177387814f;
|
||||
const float SH_C1 = 0.4886025119029199f;
|
||||
const float SH_C2[] = {
|
||||
1.0925484305920792f,
|
||||
-1.0925484305920792f,
|
||||
0.31539156525252005f,
|
||||
-1.0925484305920792f,
|
||||
0.5462742152960396f
|
||||
};
|
||||
const float SH_C3[] = {
|
||||
-0.5900435899266435f,
|
||||
2.890611442640554f,
|
||||
-0.4570457994644658f,
|
||||
0.3731763325901154f,
|
||||
-0.4570457994644658f,
|
||||
1.445305721320277f,
|
||||
-0.5900435899266435f
|
||||
};
|
||||
|
||||
const float SH_C0 = 0.28209479177387814f;
|
||||
const float SH_C1 = 0.4886025119029199f;
|
||||
const float SH_C2[] = {
|
||||
1.0925484305920792f,
|
||||
-1.0925484305920792f,
|
||||
0.31539156525252005f,
|
||||
-1.0925484305920792f,
|
||||
0.5462742152960396f
|
||||
};
|
||||
const float SH_C3[] = {
|
||||
-0.5900435899266435f,
|
||||
2.890611442640554f,
|
||||
-0.4570457994644658f,
|
||||
0.3731763325901154f,
|
||||
-0.4570457994644658f,
|
||||
1.445305721320277f,
|
||||
-0.5900435899266435f
|
||||
};
|
||||
|
||||
// float3 CalculateSHColor(uint Index, uint Degrees, float3 Direction, StructuredBuffer<float3> SHBuffer) {
|
||||
float3 CalculateSHColor(uint Index, uint Degrees, float4x4 DirClr, ByteAddressBuffer SHBuffer) {
|
||||
float3 dir = DirClr[0].xyz;
|
||||
float3 result = DirClr[1].xyz;
|
||||
|
||||
float3 sh[16];
|
||||
|
||||
for (int i = 1; i < 16; i++)
|
||||
{
|
||||
sh[i].x = SHBuffer[(Index * 45 + (i - 1) * 3) * 4];
|
||||
sh[i].y = SHBuffer[(Index * 45 + (i - 1) * 3) * 4 + 1];
|
||||
sh[i].z = SHBuffer[(Index * 45 + (i - 1) * 3) * 4 + 2];
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user