Archived
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef00dc22b3 | ||
|
|
2f409b3606 | ||
|
|
a64346ee62 | ||
|
|
8f4b9e2ae2 | ||
|
|
6f6894c29c |
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 5c5c09c79ba995b4cbb07fc6eecd341b
|
guid: a4c7a03a44f1e434eb0e7deeafc7b4d2
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
#if defined(UNITY_PROCEDURAL_INSTANCING_ENABLED)
|
||||||
|
StructuredBuffer<float3> _Positions;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
float _Step;
|
||||||
|
|
||||||
|
void ConfigureProcedural()
|
||||||
|
{
|
||||||
|
#if defined(UNITY_PROCEDURAL_INSTANCING_ENABLED)
|
||||||
|
float3 position = _Positions[unity_InstanceID];
|
||||||
|
|
||||||
|
unity_ObjectToWorld = 0.0;
|
||||||
|
unity_ObjectToWorld._m03_m13_m23_m33 = float4(position, 1.0);
|
||||||
|
unity_ObjectToWorld._m00_m11_m22 = _Step;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShaderGraphFunction_float (float3 In, out float3 Out) {
|
||||||
|
Out = In;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShaderGraphFunction_half (half3 In, out half3 Out) {
|
||||||
|
Out = In;
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 0ed85852d1001bf44b1fef32640df23b
|
guid: 52ba3338a3c5fd040985e2d7cd13ae29
|
||||||
ShaderImporter:
|
ShaderImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
defaultTextures: []
|
defaultTextures: []
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Point Surface GPU
|
||||||
|
m_Shader: {fileID: 4800000, guid: 777e5d31099aed84eab73d2aff7dcfca, type: 3}
|
||||||
|
m_ShaderKeywords:
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: -1
|
||||||
|
stringTagMap: {}
|
||||||
|
disabledShaderPasses: []
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- _BumpMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailAlbedoMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailMask:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailNormalMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _EmissionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MainTex:
|
||||||
|
m_Texture: {fileID: 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}
|
||||||
|
m_Floats:
|
||||||
|
- _BumpScale: 1
|
||||||
|
- _Cutoff: 0.5
|
||||||
|
- _DetailNormalMapScale: 1
|
||||||
|
- _DstBlend: 0
|
||||||
|
- _GlossMapScale: 1
|
||||||
|
- _Glossiness: 0.5
|
||||||
|
- _GlossyReflections: 1
|
||||||
|
- _Metallic: 0
|
||||||
|
- _Mode: 0
|
||||||
|
- _OcclusionStrength: 1
|
||||||
|
- _Parallax: 0.02
|
||||||
|
- _Smoothness: 0.5
|
||||||
|
- _SmoothnessTextureChannel: 0
|
||||||
|
- _SpecularHighlights: 1
|
||||||
|
- _SrcBlend: 1
|
||||||
|
- _UVSec: 0
|
||||||
|
- _ZWrite: 1
|
||||||
|
m_Colors:
|
||||||
|
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 8f3914ac4291e664ba60ae208ae66460
|
guid: 584eab0d393b59e40ac387043a54b24f
|
||||||
NativeFormatImporter:
|
NativeFormatImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
mainObjectFileID: 0
|
mainObjectFileID: 0
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
Shader "Graph/Point Surface GPU"
|
||||||
|
{
|
||||||
|
Properties
|
||||||
|
{
|
||||||
|
_Smoothness("Smoothness", Range(0, 1)) = 0.5
|
||||||
|
}
|
||||||
|
|
||||||
|
SubShader
|
||||||
|
{
|
||||||
|
CGPROGRAM
|
||||||
|
#pragma surface ConfigureSurface Standard fullforwardshadows addshadow
|
||||||
|
#pragma instancing_options assumeuniformscaling procedural:ConfigureProcedural
|
||||||
|
#pragma editor_sync_compilation
|
||||||
|
#pragma target 4.5
|
||||||
|
|
||||||
|
#include "Point GPU.hlsl"
|
||||||
|
|
||||||
|
struct Input
|
||||||
|
{
|
||||||
|
float3 worldPos;
|
||||||
|
};
|
||||||
|
|
||||||
|
float _Smoothness;
|
||||||
|
|
||||||
|
void ConfigureSurface(Input input, inout SurfaceOutputStandard surface)
|
||||||
|
{
|
||||||
|
surface.Albedo = saturate(input.worldPos * 0.5 + 0.5);
|
||||||
|
surface.Smoothness = _Smoothness;
|
||||||
|
}
|
||||||
|
|
||||||
|
ENDCG
|
||||||
|
}
|
||||||
|
|
||||||
|
FallBack "Diffuse"
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 777e5d31099aed84eab73d2aff7dcfca
|
||||||
|
ShaderImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultTextures: []
|
||||||
|
nonModifiableTextures: []
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Point Surface
|
||||||
|
m_Shader: {fileID: 4800000, guid: dc209e68d98853d44a1454b74031fae0, type: 3}
|
||||||
|
m_ShaderKeywords:
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: -1
|
||||||
|
stringTagMap: {}
|
||||||
|
disabledShaderPasses: []
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- _BumpMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailAlbedoMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailMask:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailNormalMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _EmissionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MainTex:
|
||||||
|
m_Texture: {fileID: 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}
|
||||||
|
m_Floats:
|
||||||
|
- _BumpScale: 1
|
||||||
|
- _Cutoff: 0.5
|
||||||
|
- _DetailNormalMapScale: 1
|
||||||
|
- _DstBlend: 0
|
||||||
|
- _GlossMapScale: 1
|
||||||
|
- _Glossiness: 0.5
|
||||||
|
- _GlossyReflections: 1
|
||||||
|
- _Metallic: 0
|
||||||
|
- _Mode: 0
|
||||||
|
- _OcclusionStrength: 1
|
||||||
|
- _Parallax: 0.02
|
||||||
|
- _Smoothness: 0.5
|
||||||
|
- _SmoothnessTextureChannel: 0
|
||||||
|
- _SpecularHighlights: 1
|
||||||
|
- _SrcBlend: 1
|
||||||
|
- _UVSec: 0
|
||||||
|
- _ZWrite: 1
|
||||||
|
m_Colors:
|
||||||
|
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9c4aff419950b8d489cd03e743b1cfdd
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
Shader "Graph/Point Surface"
|
||||||
|
{
|
||||||
|
Properties
|
||||||
|
{
|
||||||
|
_Smoothness("Smoothness", Range(0, 1)) = 0.5
|
||||||
|
}
|
||||||
|
|
||||||
|
SubShader
|
||||||
|
{
|
||||||
|
CGPROGRAM
|
||||||
|
#pragma surface ConfigureSurface Standard fullforwardshadows
|
||||||
|
#pragma target 3.0
|
||||||
|
|
||||||
|
struct Input
|
||||||
|
{
|
||||||
|
float3 worldPos;
|
||||||
|
};
|
||||||
|
|
||||||
|
float _Smoothness;
|
||||||
|
|
||||||
|
void ConfigureSurface(Input input, inout SurfaceOutputStandard surface)
|
||||||
|
{
|
||||||
|
surface.Albedo = saturate(input.worldPos * 0.5 + 0.5);
|
||||||
|
surface.Smoothness = _Smoothness;
|
||||||
|
}
|
||||||
|
|
||||||
|
ENDCG
|
||||||
|
}
|
||||||
|
|
||||||
|
FallBack "Diffuse"
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dc209e68d98853d44a1454b74031fae0
|
||||||
|
ShaderImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultTextures: []
|
||||||
|
nonModifiableTextures: []
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,5 +1,18 @@
|
|||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &-3089080242542461839
|
||||||
|
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: 2
|
||||||
--- !u!21 &2100000
|
--- !u!21 &2100000
|
||||||
Material:
|
Material:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
@@ -7,8 +20,8 @@ Material:
|
|||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: Fractal URP
|
m_Name: Point URP GPU
|
||||||
m_Shader: {fileID: -6465566751694194690, guid: 2ccc118ffa0f0574ba86592258e86a9e,
|
m_Shader: {fileID: -6465566751694194690, guid: edb00fc61da38e141a5047af96ae1a0a,
|
||||||
type: 3}
|
type: 3}
|
||||||
m_ShaderKeywords:
|
m_ShaderKeywords:
|
||||||
m_LightmapFlags: 4
|
m_LightmapFlags: 4
|
||||||
@@ -49,7 +62,6 @@ Material:
|
|||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
m_Floats:
|
m_Floats:
|
||||||
- Vector1_8EEC20FB: 0.5
|
|
||||||
- _AlphaClip: 0
|
- _AlphaClip: 0
|
||||||
- _Blend: 0
|
- _Blend: 0
|
||||||
- _BumpScale: 1
|
- _BumpScale: 1
|
||||||
@@ -72,21 +84,7 @@ Material:
|
|||||||
- _WorkflowMode: 1
|
- _WorkflowMode: 1
|
||||||
- _ZWrite: 1
|
- _ZWrite: 1
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- Vector3_32FB817D: {r: 1, g: 1, b: 0, a: 0}
|
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
- _BaseColor: {r: 1, g: 1, b: 0, a: 1}
|
|
||||||
- _Color: {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}
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||||
--- !u!114 &8940294238544827188
|
|
||||||
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: 2
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e470d4aed9c37a448b5bccf749811b9d
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 2ccc118ffa0f0574ba86592258e86a9e
|
guid: edb00fc61da38e141a5047af96ae1a0a
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &-7663591078679327442
|
||||||
|
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: 2
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Point URP
|
||||||
|
m_Shader: {fileID: -6465566751694194690, guid: fe43f72b38287ef4ea811bd1e2d4981b,
|
||||||
|
type: 3}
|
||||||
|
m_ShaderKeywords:
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 1
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: -1
|
||||||
|
stringTagMap: {}
|
||||||
|
disabledShaderPasses: []
|
||||||
|
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}
|
||||||
|
- _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}
|
||||||
|
- _SpecGlossMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Floats:
|
||||||
|
- Vector1_5DB27E09: 0.5
|
||||||
|
- _AlphaClip: 0
|
||||||
|
- _Blend: 0
|
||||||
|
- _BumpScale: 1
|
||||||
|
- _Cull: 2
|
||||||
|
- _Cutoff: 0.5
|
||||||
|
- _DstBlend: 0
|
||||||
|
- _EnvironmentReflections: 1
|
||||||
|
- _GlossMapScale: 0
|
||||||
|
- _Glossiness: 0
|
||||||
|
- _GlossyReflections: 0
|
||||||
|
- _Metallic: 0
|
||||||
|
- _OcclusionStrength: 1
|
||||||
|
- _QueueOffset: 0
|
||||||
|
- _ReceiveShadows: 1
|
||||||
|
- _Smoothness: 0.5
|
||||||
|
- _SmoothnessTextureChannel: 0
|
||||||
|
- _SpecularHighlights: 1
|
||||||
|
- _SrcBlend: 1
|
||||||
|
- _Surface: 0
|
||||||
|
- _WorkflowMode: 1
|
||||||
|
- _ZWrite: 1
|
||||||
|
m_Colors:
|
||||||
|
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8aefffdd80e5d2749a29b66e8618da01
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fe43f72b38287ef4ea811bd1e2d4981b
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &5221897554875366702
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 5221897554875366738}
|
||||||
|
- component: {fileID: 5221897554875366737}
|
||||||
|
- component: {fileID: 5221897554875366736}
|
||||||
|
- component: {fileID: 5221897554875366703}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Point
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &5221897554875366738
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5221897554875366702}
|
||||||
|
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_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!33 &5221897554875366737
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5221897554875366702}
|
||||||
|
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!23 &5221897554875366736
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5221897554875366702}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 2100000, guid: 8aefffdd80e5d2749a29b66e8618da01, 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_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!65 &5221897554875366703
|
||||||
|
BoxCollider:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5221897554875366702}
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IsTrigger: 0
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Size: {x: 1, y: 1, z: 1}
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d73a635284aa0ca4eb9cc40879b3267d
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -121,7 +121,7 @@ NavMeshSettings:
|
|||||||
debug:
|
debug:
|
||||||
m_Flags: 0
|
m_Flags: 0
|
||||||
m_NavMeshData: {fileID: 0}
|
m_NavMeshData: {fileID: 0}
|
||||||
--- !u!1 &197491472
|
--- !u!1 &75389714
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
@@ -129,44 +129,49 @@ GameObject:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 197491476}
|
- component: {fileID: 75389716}
|
||||||
- component: {fileID: 197491473}
|
- component: {fileID: 75389717}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Fractal
|
m_Name: Graph
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 1
|
||||||
--- !u!114 &197491473
|
--- !u!4 &75389716
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 197491472}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: bef3764eec961e04db4297ce68f82391, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
depth: 8
|
|
||||||
mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
material: {fileID: 2100000, guid: 8f3914ac4291e664ba60ae208ae66460, type: 2}
|
|
||||||
--- !u!4 &197491476
|
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 197491472}
|
m_GameObject: {fileID: 75389714}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 4
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &75389717
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 75389714}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 4e99d61420a0d1f459f961121d6fbe77, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
computeShader: {fileID: 7200000, guid: c7f7fcb3b4a90614b80aa341489318e7, type: 3}
|
||||||
|
material: {fileID: 2100000, guid: e470d4aed9c37a448b5bccf749811b9d, type: 2}
|
||||||
|
mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
resolution: 1000
|
||||||
|
function: 4
|
||||||
|
transitionMode: 1
|
||||||
|
functionDuration: 1
|
||||||
|
transitionDuration: 1
|
||||||
--- !u!1 &705507993
|
--- !u!1 &705507993
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -336,8 +341,8 @@ Transform:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 963194225}
|
m_GameObject: {fileID: 963194225}
|
||||||
m_LocalRotation: {x: -0.20025373, y: -0.15736002, z: 0.032605395, w: -0.96647465}
|
m_LocalRotation: {x: -0.32403755, y: -0.3351304, z: 0.123971656, w: -0.87596714}
|
||||||
m_LocalPosition: {x: -0.7724853, y: 1.44468, z: -2.6019344}
|
m_LocalPosition: {x: -1.7640238, y: 2.0069275, z: -2.0079021}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
@@ -466,7 +471,7 @@ RectTransform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 1243679486}
|
- {fileID: 1243679486}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 3
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
@@ -612,7 +617,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 3
|
m_RootOrder: 4
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1844483589
|
--- !u!1 &1844483589
|
||||||
GameObject:
|
GameObject:
|
||||||
|
|||||||
@@ -1,184 +0,0 @@
|
|||||||
using Unity.Burst;
|
|
||||||
using Unity.Collections;
|
|
||||||
using Unity.Jobs;
|
|
||||||
using Unity.Mathematics;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
using static Unity.Mathematics.math;
|
|
||||||
using quaternion = Unity.Mathematics.quaternion;
|
|
||||||
|
|
||||||
public class Fractal : MonoBehaviour
|
|
||||||
{
|
|
||||||
[BurstCompile(FloatPrecision.Standard, FloatMode.Fast, CompileSynchronously = true)]
|
|
||||||
private struct UpdateFractalLevelJob : IJobFor
|
|
||||||
{
|
|
||||||
public float spinAngleDelta;
|
|
||||||
public float scale;
|
|
||||||
|
|
||||||
[ReadOnly]
|
|
||||||
public NativeArray<FractalPart> parents;
|
|
||||||
|
|
||||||
public NativeArray<FractalPart> parts;
|
|
||||||
|
|
||||||
[WriteOnly]
|
|
||||||
public NativeArray<float3x4> matrices;
|
|
||||||
|
|
||||||
public void Execute(int i)
|
|
||||||
{
|
|
||||||
var parent = parents[i / 5];
|
|
||||||
var part = parts[i];
|
|
||||||
part.spinAngle += spinAngleDelta;
|
|
||||||
part.worldRotation = mul(parent.worldRotation,
|
|
||||||
mul(part.rotation, quaternion.RotateY(part.spinAngle))
|
|
||||||
);
|
|
||||||
part.worldPosition =
|
|
||||||
parent.worldPosition +
|
|
||||||
mul(parent.worldRotation, 1.5f * scale * part.direction);
|
|
||||||
parts[i] = part;
|
|
||||||
|
|
||||||
float3x3 r = float3x3(part.worldRotation) * scale;
|
|
||||||
matrices[i] = float3x4(r.c0, r.c1, r.c2, part.worldPosition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private struct FractalPart
|
|
||||||
{
|
|
||||||
public float3 direction, worldPosition;
|
|
||||||
public quaternion rotation, worldRotation;
|
|
||||||
public float spinAngle;
|
|
||||||
}
|
|
||||||
|
|
||||||
NativeArray<FractalPart>[] parts;
|
|
||||||
|
|
||||||
NativeArray<float3x4>[] matrices;
|
|
||||||
|
|
||||||
[SerializeField, Range(1, 8)]
|
|
||||||
int depth = 4;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
Mesh mesh = default;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
Material material = default;
|
|
||||||
|
|
||||||
static float3[] directions =
|
|
||||||
{
|
|
||||||
up(), right(), left(), forward(), back()
|
|
||||||
};
|
|
||||||
|
|
||||||
static quaternion[] rotations =
|
|
||||||
{
|
|
||||||
quaternion.identity,
|
|
||||||
quaternion.RotateZ(-0.5f * PI), quaternion.RotateZ(0.5f * PI),
|
|
||||||
quaternion.RotateX(0.5f * PI), quaternion.RotateX(-0.5f * PI)
|
|
||||||
};
|
|
||||||
|
|
||||||
private FractalPart CreatePart(int childIndex)
|
|
||||||
{
|
|
||||||
return new FractalPart()
|
|
||||||
{
|
|
||||||
direction = directions[childIndex],
|
|
||||||
rotation = rotations[childIndex]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
ComputeBuffer[] matricesBuffers;
|
|
||||||
|
|
||||||
static readonly int matricesId = Shader.PropertyToID("_Matrices");
|
|
||||||
|
|
||||||
static MaterialPropertyBlock propertyBlock;
|
|
||||||
|
|
||||||
private void OnEnable()
|
|
||||||
{
|
|
||||||
parts = new NativeArray<FractalPart>[depth];
|
|
||||||
matrices = new NativeArray<float3x4>[depth];
|
|
||||||
matricesBuffers = new ComputeBuffer[depth];
|
|
||||||
int stride = 12 * 4;
|
|
||||||
for (int i = 0, length = 1; i < parts.Length; i++, length *= 5)
|
|
||||||
{
|
|
||||||
parts[i] = new NativeArray<FractalPart>(length, Allocator.Persistent);
|
|
||||||
matrices[i] = new NativeArray<float3x4>(length, Allocator.Persistent);
|
|
||||||
matricesBuffers[i] = new ComputeBuffer(length, stride);
|
|
||||||
}
|
|
||||||
|
|
||||||
parts[0][0] = CreatePart(0);
|
|
||||||
for (int li = 1; li < parts.Length; li++)
|
|
||||||
{
|
|
||||||
NativeArray<FractalPart> levelParts = parts[li];
|
|
||||||
for (int fpi = 0; fpi < levelParts.Length; fpi += 5)
|
|
||||||
{
|
|
||||||
for (int ci = 0; ci < 5; ci++)
|
|
||||||
{
|
|
||||||
levelParts[fpi + ci] = CreatePart(ci);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (propertyBlock == null)
|
|
||||||
{
|
|
||||||
propertyBlock = new MaterialPropertyBlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDisable()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < matricesBuffers.Length; i++)
|
|
||||||
{
|
|
||||||
matricesBuffers[i].Release();
|
|
||||||
parts[i].Dispose();
|
|
||||||
matrices[i].Dispose();
|
|
||||||
}
|
|
||||||
parts = null;
|
|
||||||
matrices = null;
|
|
||||||
matricesBuffers = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnValidate()
|
|
||||||
{
|
|
||||||
if (parts != null && enabled)
|
|
||||||
{
|
|
||||||
OnDisable();
|
|
||||||
OnEnable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Update()
|
|
||||||
{
|
|
||||||
float spinAngleDelta = 0.125f * PI * Time.deltaTime;
|
|
||||||
FractalPart rootPart = parts[0][0];
|
|
||||||
rootPart.spinAngle += spinAngleDelta;
|
|
||||||
rootPart.worldRotation = mul(transform.rotation,
|
|
||||||
mul(rootPart.rotation, quaternion.RotateY(rootPart.spinAngle))
|
|
||||||
);
|
|
||||||
rootPart.worldPosition = transform.position;
|
|
||||||
parts[0][0] = rootPart;
|
|
||||||
float objectScale = transform.lossyScale.x;
|
|
||||||
float3x3 r = float3x3(rootPart.worldRotation) * objectScale;
|
|
||||||
matrices[0][0] = float3x4(r.c0, r.c1, r.c2, rootPart.worldPosition);
|
|
||||||
|
|
||||||
float scale = objectScale;
|
|
||||||
JobHandle jobHandle = default;
|
|
||||||
for (int li = 1; li < parts.Length; li++)
|
|
||||||
{
|
|
||||||
scale *= 0.5f;
|
|
||||||
jobHandle = new UpdateFractalLevelJob
|
|
||||||
{
|
|
||||||
spinAngleDelta = spinAngleDelta,
|
|
||||||
scale = scale,
|
|
||||||
parents = parts[li - 1],
|
|
||||||
parts = parts[li],
|
|
||||||
matrices = matrices[li]
|
|
||||||
}.ScheduleParallel(parts[li].Length, 5, jobHandle);
|
|
||||||
}
|
|
||||||
jobHandle.Complete();
|
|
||||||
|
|
||||||
var bounds = new Bounds(rootPart.worldPosition, float3(3f * objectScale));
|
|
||||||
for (int i = 0; i < matricesBuffers.Length; i++)
|
|
||||||
{
|
|
||||||
ComputeBuffer buffer = matricesBuffers[i];
|
|
||||||
buffer.SetData(matrices[i]);
|
|
||||||
propertyBlock.SetBuffer(matricesId, buffer);
|
|
||||||
Graphics.DrawMeshInstancedProcedural(mesh, 0, material, bounds, buffer.count, propertyBlock);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
#pragma kernel WaveKernel
|
||||||
|
#pragma kernel WaveToMultiWaveKernel
|
||||||
|
#pragma kernel WaveToRippleKernel
|
||||||
|
#pragma kernel WaveToSphereKernel
|
||||||
|
#pragma kernel WaveToTorusKernel
|
||||||
|
|
||||||
|
#pragma kernel MultiWaveToWaveKernel
|
||||||
|
#pragma kernel MultiWaveKernel
|
||||||
|
#pragma kernel MultiWaveToRippleKernel
|
||||||
|
#pragma kernel MultiWaveToSphereKernel
|
||||||
|
#pragma kernel MultiWaveToTorusKernel
|
||||||
|
|
||||||
|
#pragma kernel RippleToWaveKernel
|
||||||
|
#pragma kernel RippleToMultiWaveKernel
|
||||||
|
#pragma kernel RippleKernel
|
||||||
|
#pragma kernel RippleToSphereKernel
|
||||||
|
#pragma kernel RippleToTorusKernel
|
||||||
|
|
||||||
|
#pragma kernel SphereToWaveKernel
|
||||||
|
#pragma kernel SphereToMultiWaveKernel
|
||||||
|
#pragma kernel SphereToRippleKernel
|
||||||
|
#pragma kernel SphereKernel
|
||||||
|
#pragma kernel SphereToTorusKernel
|
||||||
|
|
||||||
|
#pragma kernel TorusToWaveKernel
|
||||||
|
#pragma kernel TorusToMultiWaveKernel
|
||||||
|
#pragma kernel TorusToRippleKernel
|
||||||
|
#pragma kernel TorusToSphereKernel
|
||||||
|
#pragma kernel TorusKernel
|
||||||
|
|
||||||
|
RWStructuredBuffer<float3> _Positions;
|
||||||
|
|
||||||
|
uint _Resolution;
|
||||||
|
|
||||||
|
float _Step;
|
||||||
|
float _Time;
|
||||||
|
float _TransitionProgress;
|
||||||
|
|
||||||
|
float2 GetUV(uint3 id)
|
||||||
|
{
|
||||||
|
return (id.xy + 0.5) * _Step - 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetPositions(uint3 id, float3 positions)
|
||||||
|
{
|
||||||
|
if (id.x < _Resolution && id.y < _Resolution)
|
||||||
|
{
|
||||||
|
_Positions[id.x + id.y * _Resolution] = positions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define PI 3.14159265358979323846
|
||||||
|
|
||||||
|
float3 Wave(float u, float v, float t)
|
||||||
|
{
|
||||||
|
float3 p;
|
||||||
|
p.x = u;
|
||||||
|
p.y = sin(PI * (u + v + t));
|
||||||
|
p.z = v;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
float3 MultiWave(float u, float v, float t)
|
||||||
|
{
|
||||||
|
float3 p;
|
||||||
|
p.x = u;
|
||||||
|
p.y = sin(PI * (u + 0.5 * t));
|
||||||
|
p.y += 0.5 * sin(2.0 * PI * (v + t));
|
||||||
|
p.y += sin(PI * (u + v + 0.25 * t));
|
||||||
|
p.y *= 1.0 / 2.5;
|
||||||
|
p.z = v;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
float3 Ripple(float u, float v, float t)
|
||||||
|
{
|
||||||
|
float d = sqrt(u * u + v * v);
|
||||||
|
float3 p;
|
||||||
|
p.x = u;
|
||||||
|
p.y = sin(PI * (4.0 * d - t));
|
||||||
|
p.y /= 1.0 + 10.0 * d;
|
||||||
|
p.z = v;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
float3 Sphere(float u, float v, float t)
|
||||||
|
{
|
||||||
|
float r = 0.9 + 0.1 * sin(PI * (6.0 * u + 4.0 * v + t));
|
||||||
|
float s = r * cos(0.5 * PI * v);
|
||||||
|
float3 p;
|
||||||
|
p.x = s * sin(PI * u);
|
||||||
|
p.y = r * sin(0.5 * PI * v);
|
||||||
|
p.z = s * cos(PI * u);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
float3 Torus(float u, float v, float t)
|
||||||
|
{
|
||||||
|
float r1 = 0.7 + 0.1 * sin(PI * (6.0 * u + 0.5 * t));
|
||||||
|
float r2 = 0.15 + 0.05 * sin(PI * (8.0 * u + 4.0 * v + 2.0 * t));
|
||||||
|
float s = r1 + r2 * cos(PI * v);
|
||||||
|
float3 p;
|
||||||
|
p.x = s * sin(PI * u);
|
||||||
|
p.y = r2 * sin(PI * v);
|
||||||
|
p.z = s * cos(PI * u);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define KERNEL_FUNCTION(function) \
|
||||||
|
[numthreads(8, 8, 1)] \
|
||||||
|
void function##Kernel(uint3 id : SV_DISPATCHTHREADID) \
|
||||||
|
{ \
|
||||||
|
float2 uv = GetUV(id); \
|
||||||
|
SetPositions(id, function(uv.x, uv.y, _Time)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
KERNEL_FUNCTION(Wave)
|
||||||
|
KERNEL_FUNCTION(MultiWave)
|
||||||
|
KERNEL_FUNCTION(Ripple)
|
||||||
|
KERNEL_FUNCTION(Sphere)
|
||||||
|
KERNEL_FUNCTION(Torus)
|
||||||
|
|
||||||
|
#define KERNEL_MOPH_FUNCTION(functionA, functionB) \
|
||||||
|
[numthreads(8, 8, 1)] \
|
||||||
|
void functionA##To##functionB##Kernel(uint3 id : SV_DISPATCHTHREADID) \
|
||||||
|
{ \
|
||||||
|
float2 uv = GetUV(id); \
|
||||||
|
float3 position = lerp(functionA(uv.x, uv.y, _Time), functionB(uv.x, uv.y, _Time), _TransitionProgress); \
|
||||||
|
SetPositions(id, position); \
|
||||||
|
}
|
||||||
|
|
||||||
|
KERNEL_MOPH_FUNCTION(Wave, MultiWave)
|
||||||
|
KERNEL_MOPH_FUNCTION(Wave, Ripple)
|
||||||
|
KERNEL_MOPH_FUNCTION(Wave, Sphere)
|
||||||
|
KERNEL_MOPH_FUNCTION(Wave, Torus)
|
||||||
|
|
||||||
|
KERNEL_MOPH_FUNCTION(MultiWave, Wave)
|
||||||
|
KERNEL_MOPH_FUNCTION(MultiWave, Ripple)
|
||||||
|
KERNEL_MOPH_FUNCTION(MultiWave, Sphere)
|
||||||
|
KERNEL_MOPH_FUNCTION(MultiWave, Torus)
|
||||||
|
|
||||||
|
KERNEL_MOPH_FUNCTION(Ripple, Wave)
|
||||||
|
KERNEL_MOPH_FUNCTION(Ripple, MultiWave)
|
||||||
|
KERNEL_MOPH_FUNCTION(Ripple, Sphere)
|
||||||
|
KERNEL_MOPH_FUNCTION(Ripple, Torus)
|
||||||
|
|
||||||
|
KERNEL_MOPH_FUNCTION(Sphere, Wave)
|
||||||
|
KERNEL_MOPH_FUNCTION(Sphere, MultiWave)
|
||||||
|
KERNEL_MOPH_FUNCTION(Sphere, Ripple)
|
||||||
|
KERNEL_MOPH_FUNCTION(Sphere, Torus)
|
||||||
|
|
||||||
|
KERNEL_MOPH_FUNCTION(Torus, Wave)
|
||||||
|
KERNEL_MOPH_FUNCTION(Torus, MultiWave)
|
||||||
|
KERNEL_MOPH_FUNCTION(Torus, Ripple)
|
||||||
|
KERNEL_MOPH_FUNCTION(Torus, Sphere)
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c7f7fcb3b4a90614b80aa341489318e7
|
||||||
|
ComputeShaderImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
currentAPIMask: 4
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using static UnityEngine.Mathf;
|
||||||
|
|
||||||
|
public static class FunctionLibrary
|
||||||
|
{
|
||||||
|
public delegate Vector3 Function(float u, float v, float t);
|
||||||
|
|
||||||
|
public enum FunctionName { Wave, MultiWave, Ripple, Sphere, Torus }
|
||||||
|
|
||||||
|
private static Function[] functions = { Wave, MultiWave, Ripple, Sphere, Torus };
|
||||||
|
|
||||||
|
public static int functionCount => functions.Length;
|
||||||
|
|
||||||
|
public static Function GetFunction(FunctionName name)
|
||||||
|
{
|
||||||
|
return functions[(int)name];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FunctionName GetNextFunctionName(FunctionName name)
|
||||||
|
{
|
||||||
|
return (int)name < functions.Length - 1 ? name + 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FunctionName GetRandomFunctionName()
|
||||||
|
{
|
||||||
|
return (FunctionName)Random.Range(0, functions.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FunctionName GetRandomFunctionNameOtherThan(FunctionName name)
|
||||||
|
{
|
||||||
|
var choice = (FunctionName)Random.Range(1, functions.Length);
|
||||||
|
return choice == name ? 0 : choice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector3 Wave(float u, float v, float t)
|
||||||
|
{
|
||||||
|
Vector3 p;
|
||||||
|
p.x = u;
|
||||||
|
p.y = Sin(PI * (u + v + t));
|
||||||
|
p.z = v;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector3 MultiWave(float u, float v, float t)
|
||||||
|
{
|
||||||
|
Vector3 p;
|
||||||
|
p.x = u;
|
||||||
|
p.y = Sin(PI * (u + 0.5f * t));
|
||||||
|
p.y += 0.5f * Sin(2f * PI * (v + t));
|
||||||
|
p.y += Sin(PI * (u + v + 0.25f * t));
|
||||||
|
p.y *= 1f / 2.5f;
|
||||||
|
p.z = v;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector3 Ripple(float u, float v, float t)
|
||||||
|
{
|
||||||
|
var d = Sqrt(u * u + v * v);
|
||||||
|
Vector3 p;
|
||||||
|
p.x = u;
|
||||||
|
p.y = Sin(PI * (4f * d - t));
|
||||||
|
p.y /= 1f + 10f * d;
|
||||||
|
p.z = v;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector3 Sphere(float u, float v, float t)
|
||||||
|
{
|
||||||
|
float r = 0.9f + 0.1f * Sin(PI * (6f * u + 4f * v + t));
|
||||||
|
float s = r * Cos(0.5f * PI * v);
|
||||||
|
Vector3 p;
|
||||||
|
p.x = s * Sin(PI * u);
|
||||||
|
p.y = r * Sin(0.5f * PI * v);
|
||||||
|
p.z = s * Cos(PI * u);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector3 Torus(float u, float v, float t)
|
||||||
|
{
|
||||||
|
float r1 = 0.7f + 0.1f * Sin(PI * (6f * u + 0.5f * t));
|
||||||
|
float r2 = 0.15f + 0.05f * Sin(PI * (8f * u + 4f * v + 2f * t));
|
||||||
|
float s = r1 + r2 * Cos(PI * v);
|
||||||
|
Vector3 p;
|
||||||
|
p.x = s * Sin(PI * u);
|
||||||
|
p.y = r2 * Sin(PI * v);
|
||||||
|
p.z = s * Cos(PI * u);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector3 Morph(float u, float v, float t, Function from, Function to, float progress)
|
||||||
|
{
|
||||||
|
return Vector3.LerpUnclamped(from(u, v, t), to(u, v, t), SmoothStep(0.0f, 1.0f, progress));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: bef3764eec961e04db4297ce68f82391
|
guid: e5d4ebe0e863dfd49b58925b59880bf7
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class GPUGraph : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
ComputeShader computeShader = default;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
Material material = default;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
Mesh mesh = default;
|
||||||
|
|
||||||
|
const int maxResolution = 1000;
|
||||||
|
|
||||||
|
[SerializeField, Range(10, maxResolution)]
|
||||||
|
int resolution = 10;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
FunctionLibrary.FunctionName function = default;
|
||||||
|
|
||||||
|
public enum TransitionMode { Normal, Cycle, Random }
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
TransitionMode transitionMode = TransitionMode.Normal;
|
||||||
|
|
||||||
|
[SerializeField, Min(0.0f)]
|
||||||
|
float functionDuration = 1.0f;
|
||||||
|
|
||||||
|
[SerializeField, Min(0.0f)]
|
||||||
|
float transitionDuration = 1.0f;
|
||||||
|
|
||||||
|
float duration = 0.0f;
|
||||||
|
|
||||||
|
bool transitioning;
|
||||||
|
|
||||||
|
FunctionLibrary.FunctionName transitionFunction;
|
||||||
|
|
||||||
|
ComputeBuffer positionsBuffer;
|
||||||
|
|
||||||
|
static readonly int positionsId = Shader.PropertyToID("_Positions");
|
||||||
|
static readonly int resolutionId = Shader.PropertyToID("_Resolution");
|
||||||
|
static readonly int stepId = Shader.PropertyToID("_Step");
|
||||||
|
static readonly int timeId = Shader.PropertyToID("_Time");
|
||||||
|
static readonly int transitionProgressId = Shader.PropertyToID("_TransitionProgress");
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
positionsBuffer = new ComputeBuffer(maxResolution * maxResolution, 3 * 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
positionsBuffer.Release();
|
||||||
|
positionsBuffer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
duration += Time.deltaTime;
|
||||||
|
if (transitioning)
|
||||||
|
{
|
||||||
|
if (duration >= transitionDuration)
|
||||||
|
{
|
||||||
|
duration -= transitionDuration;
|
||||||
|
transitioning = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (duration >= functionDuration)
|
||||||
|
{
|
||||||
|
duration -= functionDuration;
|
||||||
|
transitioning = true;
|
||||||
|
transitionFunction = function;
|
||||||
|
PickNextFunction();
|
||||||
|
}
|
||||||
|
UpdateFunctionOnGPU();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PickNextFunction()
|
||||||
|
{
|
||||||
|
if (transitionMode == TransitionMode.Normal) return;
|
||||||
|
function = transitionMode == TransitionMode.Cycle ?
|
||||||
|
FunctionLibrary.GetNextFunctionName(function) :
|
||||||
|
FunctionLibrary.GetRandomFunctionNameOtherThan(function);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateFunctionOnGPU()
|
||||||
|
{
|
||||||
|
var step = 2f / resolution;
|
||||||
|
computeShader.SetInt(resolutionId, resolution);
|
||||||
|
computeShader.SetFloat(stepId, step);
|
||||||
|
computeShader.SetFloat(timeId, Time.time);
|
||||||
|
if (transitioning)
|
||||||
|
{
|
||||||
|
computeShader.SetFloat(transitionProgressId, Mathf.SmoothStep(0f, 1f, duration / transitionDuration));
|
||||||
|
}
|
||||||
|
|
||||||
|
var kernelIndex = (int)function +
|
||||||
|
(int)(transitioning ? transitionFunction : function) * FunctionLibrary.functionCount;
|
||||||
|
computeShader.SetBuffer(kernelIndex, positionsId, positionsBuffer);
|
||||||
|
|
||||||
|
var groups = Mathf.CeilToInt(resolution / 8f);
|
||||||
|
computeShader.Dispatch(kernelIndex, groups, groups, 1);
|
||||||
|
|
||||||
|
material.SetBuffer(positionsId, positionsBuffer);
|
||||||
|
material.SetFloat(stepId, step);
|
||||||
|
var bounds = new Bounds(Vector3.zero, Vector3.one * (2f + 2f / resolution));
|
||||||
|
Graphics.DrawMeshInstancedProcedural(mesh, 0, material, bounds, resolution * resolution);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4e99d61420a0d1f459f961121d6fbe77
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class Graph : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
Transform pointPrefab = default;
|
||||||
|
|
||||||
|
[SerializeField, Range(10, 200)]
|
||||||
|
int resolution = 10;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
FunctionLibrary.FunctionName function = default;
|
||||||
|
|
||||||
|
public enum TransitionMode { Normal, Cycle, Random }
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
TransitionMode transitionMode = TransitionMode.Normal;
|
||||||
|
|
||||||
|
[SerializeField, Min(0.0f)]
|
||||||
|
float functionDuration = 1.0f;
|
||||||
|
|
||||||
|
[SerializeField, Min(0.0f)]
|
||||||
|
float transitionDuration = 1.0f;
|
||||||
|
|
||||||
|
Transform[] points;
|
||||||
|
|
||||||
|
float duration = 0.0f;
|
||||||
|
|
||||||
|
bool transitioning;
|
||||||
|
|
||||||
|
FunctionLibrary.FunctionName transitionFunction;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
var step = 2f / resolution;
|
||||||
|
var scale = Vector3.one * step;
|
||||||
|
points = new Transform[resolution * resolution];
|
||||||
|
for (int i = 0; i < points.Length; i++)
|
||||||
|
{
|
||||||
|
Transform point = Instantiate(pointPrefab);
|
||||||
|
point.localScale = scale;
|
||||||
|
point.SetParent(transform, false);
|
||||||
|
points[i] = point;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
duration += Time.deltaTime;
|
||||||
|
if (transitioning)
|
||||||
|
{
|
||||||
|
if (duration >= transitionDuration)
|
||||||
|
{
|
||||||
|
duration -= transitionDuration;
|
||||||
|
transitioning = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (duration >= functionDuration)
|
||||||
|
{
|
||||||
|
duration -= functionDuration;
|
||||||
|
transitioning = true;
|
||||||
|
transitionFunction = function;
|
||||||
|
PickNextFunction();
|
||||||
|
}
|
||||||
|
if (transitioning)
|
||||||
|
{
|
||||||
|
UpdateFunctionTransition();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UpdateFunction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PickNextFunction()
|
||||||
|
{
|
||||||
|
if (transitionMode == TransitionMode.Normal) return;
|
||||||
|
function = transitionMode == TransitionMode.Cycle ?
|
||||||
|
FunctionLibrary.GetNextFunctionName(function) :
|
||||||
|
FunctionLibrary.GetRandomFunctionNameOtherThan(function);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateFunction()
|
||||||
|
{
|
||||||
|
FunctionLibrary.Function f = FunctionLibrary.GetFunction(function);
|
||||||
|
var time = Time.time;
|
||||||
|
var step = 2.0f / resolution;
|
||||||
|
var v = 0.5f * step - 1f;
|
||||||
|
for (int i = 0, x = 0, z = 0; i < points.Length; i++, x++)
|
||||||
|
{
|
||||||
|
if (x == resolution)
|
||||||
|
{
|
||||||
|
x = 0;
|
||||||
|
z += 1;
|
||||||
|
v = (z + 0.5f) * step - 1f;
|
||||||
|
}
|
||||||
|
float u = (x + 0.5f) * step - 1f;
|
||||||
|
points[i].localPosition = f(u, v, time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateFunctionTransition()
|
||||||
|
{
|
||||||
|
FunctionLibrary.Function
|
||||||
|
from = FunctionLibrary.GetFunction(transitionFunction),
|
||||||
|
to = FunctionLibrary.GetFunction(function);
|
||||||
|
float progress = duration / transitionDuration;
|
||||||
|
float time = Time.time;
|
||||||
|
float step = 2f / resolution;
|
||||||
|
float v = 0.5f * step - 1f;
|
||||||
|
for (int i = 0, x = 0, z = 0; i < points.Length; i++, x++)
|
||||||
|
{
|
||||||
|
if (x == resolution)
|
||||||
|
{
|
||||||
|
x = 0;
|
||||||
|
z += 1;
|
||||||
|
v = (z + 0.5f) * step - 1f;
|
||||||
|
}
|
||||||
|
float u = (x + 0.5f) * step - 1f;
|
||||||
|
points[i].localPosition = FunctionLibrary.Morph(u, v, time, from, to, progress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 14cd06bfa92d53e4ebc0cde4a0e39db8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#if defined(UNITY_PROCEDURAL_INSTANCING_ENABLED)
|
|
||||||
StructuredBuffer<float3x4> _Matrices;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void ConfigureProcedural () {
|
|
||||||
#if defined(UNITY_PROCEDURAL_INSTANCING_ENABLED)
|
|
||||||
float3x4 m = _Matrices[unity_InstanceID];
|
|
||||||
unity_ObjectToWorld._m00_m01_m02_m03 = m._m00_m01_m02_m03;
|
|
||||||
unity_ObjectToWorld._m10_m11_m12_m13 = m._m10_m11_m12_m13;
|
|
||||||
unity_ObjectToWorld._m20_m21_m22_m23 = m._m20_m21_m22_m23;
|
|
||||||
unity_ObjectToWorld._m30_m31_m32_m33 = float4(0.0, 0.0, 0.0, 1.0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShaderGraphFunction_float (float3 In, out float3 Out) {
|
|
||||||
Out = In;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShaderGraphFunction_half (half3 In, out half3 Out) {
|
|
||||||
Out = In;
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.burst": "1.4.4",
|
|
||||||
"com.unity.render-pipelines.universal": "7.5.3",
|
"com.unity.render-pipelines.universal": "7.5.3",
|
||||||
"com.unity.textmeshpro": "2.1.3",
|
"com.unity.textmeshpro": "2.1.3",
|
||||||
"com.unity.modules.ai": "1.0.0",
|
"com.unity.modules.ai": "1.0.0",
|
||||||
|
|||||||
@@ -1,21 +1,5 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.burst": {
|
|
||||||
"version": "1.4.4",
|
|
||||||
"depth": 0,
|
|
||||||
"source": "registry",
|
|
||||||
"dependencies": {
|
|
||||||
"com.unity.mathematics": "1.2.1"
|
|
||||||
},
|
|
||||||
"url": "https://packages.unity.cn"
|
|
||||||
},
|
|
||||||
"com.unity.mathematics": {
|
|
||||||
"version": "1.2.1",
|
|
||||||
"depth": 1,
|
|
||||||
"source": "registry",
|
|
||||||
"dependencies": {},
|
|
||||||
"url": "https://packages.unity.cn"
|
|
||||||
},
|
|
||||||
"com.unity.render-pipelines.core": {
|
"com.unity.render-pipelines.core": {
|
||||||
"version": "7.5.3",
|
"version": "7.5.3",
|
||||||
"depth": 1,
|
"depth": 1,
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"MonoBehaviour": {
|
|
||||||
"Version": 3,
|
|
||||||
"EnableBurstCompilation": true,
|
|
||||||
"EnableOptimisations": true,
|
|
||||||
"EnableSafetyChecks": false,
|
|
||||||
"EnableDebugInAllBuilds": false,
|
|
||||||
"UsePlatformSDKLinker": false,
|
|
||||||
"CpuMinTargetX32": 0,
|
|
||||||
"CpuMaxTargetX32": 0,
|
|
||||||
"CpuMinTargetX64": 0,
|
|
||||||
"CpuMaxTargetX64": 0,
|
|
||||||
"CpuTargetsX32": 6,
|
|
||||||
"CpuTargetsX64": 72
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -584,8 +584,7 @@ PlayerSettings:
|
|||||||
webGLWasmStreaming: 0
|
webGLWasmStreaming: 0
|
||||||
scriptingDefineSymbols: {}
|
scriptingDefineSymbols: {}
|
||||||
platformArchitecture: {}
|
platformArchitecture: {}
|
||||||
scriptingBackend:
|
scriptingBackend: {}
|
||||||
Standalone: 0
|
|
||||||
il2cppCompilerConfiguration: {}
|
il2cppCompilerConfiguration: {}
|
||||||
managedStrippingLevel: {}
|
managedStrippingLevel: {}
|
||||||
incrementalIl2cppBuild: {}
|
incrementalIl2cppBuild: {}
|
||||||
|
|||||||
Reference in New Issue
Block a user