Archived
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d635eeadd2 | ||
|
|
e987949600 | ||
|
|
7ee4755a6a | ||
|
|
dd11842558 | ||
|
|
9e6b1592ef | ||
|
|
4d861c50dd | ||
|
|
7978a33921 |
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4c7a03a44f1e434eb0e7deeafc7b4d2
|
||||
guid: 5c5c09c79ba995b4cbb07fc6eecd341b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -1,18 +1,5 @@
|
||||
%YAML 1.1
|
||||
%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
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
@@ -20,8 +7,8 @@ Material:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Point URP GPU
|
||||
m_Shader: {fileID: -6465566751694194690, guid: edb00fc61da38e141a5047af96ae1a0a,
|
||||
m_Name: Fractal URP
|
||||
m_Shader: {fileID: -6465566751694194690, guid: 2ccc118ffa0f0574ba86592258e86a9e,
|
||||
type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
@@ -62,6 +49,7 @@ Material:
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- Vector1_8EEC20FB: 0.5
|
||||
- _AlphaClip: 0
|
||||
- _Blend: 0
|
||||
- _BumpScale: 1
|
||||
@@ -84,7 +72,21 @@ Material:
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- Vector3_32FB817D: {r: 1, g: 1, b: 0, a: 0}
|
||||
- _BaseColor: {r: 1, g: 1, b: 0, 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}
|
||||
--- !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
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8aefffdd80e5d2749a29b66e8618da01
|
||||
guid: 8f3914ac4291e664ba60ae208ae66460
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edb00fc61da38e141a5047af96ae1a0a
|
||||
guid: 2ccc118ffa0f0574ba86592258e86a9e
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
@@ -1,24 +0,0 @@
|
||||
#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,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52ba3338a3c5fd040985e2d7cd13ae29
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,78 +0,0 @@
|
||||
%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,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 584eab0d393b59e40ac387043a54b24f
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,35 +0,0 @@
|
||||
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"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 777e5d31099aed84eab73d2aff7dcfca
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,78 +0,0 @@
|
||||
%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}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c4aff419950b8d489cd03e743b1cfdd
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,31 +0,0 @@
|
||||
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"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e470d4aed9c37a448b5bccf749811b9d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because one or more lines are too long
@@ -1,91 +0,0 @@
|
||||
%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}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe43f72b38287ef4ea811bd1e2d4981b
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
@@ -1,95 +0,0 @@
|
||||
%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}
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d73a635284aa0ca4eb9cc40879b3267d
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -121,7 +121,7 @@ NavMeshSettings:
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &75389714
|
||||
--- !u!1 &197491472
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -129,49 +129,107 @@ GameObject:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 75389716}
|
||||
- component: {fileID: 75389717}
|
||||
- component: {fileID: 197491476}
|
||||
- component: {fileID: 197491473}
|
||||
m_Layer: 0
|
||||
m_Name: Graph
|
||||
m_Name: Fractal
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &75389716
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 75389714}
|
||||
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: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &75389717
|
||||
--- !u!114 &197491473
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 75389714}
|
||||
m_GameObject: {fileID: 197491472}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e99d61420a0d1f459f961121d6fbe77, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: bef3764eec961e04db4297ce68f82391, 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
|
||||
depth: 8
|
||||
mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
||||
leafMesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
material: {fileID: 2100000, guid: 8f3914ac4291e664ba60ae208ae66460, type: 2}
|
||||
gradientA:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0.764151, g: 0.18413278, b: 0, a: 0.3137255}
|
||||
key1: {r: 1, g: 1, b: 0, a: 0.3529412}
|
||||
key2: {r: 0, g: 0, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 65535
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
gradientB:
|
||||
serializedVersion: 2
|
||||
key0: {r: 0.40392157, g: 0.14109339, b: 0, a: 0.54901963}
|
||||
key1: {r: 0, g: 0.6320754, b: 0, a: 0.627451}
|
||||
key2: {r: 1, g: 1, b: 0, a: 0}
|
||||
key3: {r: 0, g: 0, b: 0, a: 0}
|
||||
key4: {r: 0, g: 0, b: 0, a: 0}
|
||||
key5: {r: 0, g: 0, b: 0, a: 0}
|
||||
key6: {r: 0, g: 0, b: 0, a: 0}
|
||||
key7: {r: 0, g: 0, b: 0, a: 0}
|
||||
ctime0: 0
|
||||
ctime1: 65535
|
||||
ctime2: 65535
|
||||
ctime3: 0
|
||||
ctime4: 0
|
||||
ctime5: 0
|
||||
ctime6: 0
|
||||
ctime7: 0
|
||||
atime0: 0
|
||||
atime1: 65535
|
||||
atime2: 0
|
||||
atime3: 0
|
||||
atime4: 0
|
||||
atime5: 0
|
||||
atime6: 0
|
||||
atime7: 0
|
||||
m_Mode: 0
|
||||
m_NumColorKeys: 2
|
||||
m_NumAlphaKeys: 2
|
||||
leafColorA: {r: 0.45882356, g: 0.97647065, b: 0.29803923, a: 0.49803922}
|
||||
leafColorB: {r: 0.21568629, g: 0.4901961, b: 0.13333334, a: 0.9019608}
|
||||
maxSagAngleA: 15
|
||||
maxSagAngleB: 25
|
||||
--- !u!4 &197491476
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 197491472}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0.17364816, w: 0.9848078}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 20}
|
||||
--- !u!1 &705507993
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -341,8 +399,8 @@ Transform:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_LocalRotation: {x: -0.32403755, y: -0.3351304, z: 0.123971656, w: -0.87596714}
|
||||
m_LocalPosition: {x: -1.7640238, y: 2.0069275, z: -2.0079021}
|
||||
m_LocalRotation: {x: -0.20025373, y: -0.15736002, z: 0.032605395, w: -0.96647465}
|
||||
m_LocalPosition: {x: -0.7724853, y: 1.44468, z: -2.6019344}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
@@ -471,7 +529,7 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 1243679486}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
@@ -617,7 +675,7 @@ Transform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1844483589
|
||||
GameObject:
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
using Unity.Burst;
|
||||
using Unity.Collections;
|
||||
using Unity.Jobs;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
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 scale;
|
||||
public float deltaTime;
|
||||
|
||||
[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 += part.spinVelocity * deltaTime;
|
||||
|
||||
|
||||
float3 upAxis =
|
||||
mul(mul(parent.worldRotation, part.rotation), up());
|
||||
float3 sagAxis = cross(up(), upAxis);
|
||||
|
||||
float sagMagnitude = length(sagAxis);
|
||||
quaternion baseRotation;
|
||||
if (sagMagnitude > 0f)
|
||||
{
|
||||
sagAxis /= sagMagnitude;
|
||||
quaternion sagRotation =
|
||||
quaternion.AxisAngle(sagAxis, part.maxSagAngle * sagMagnitude);
|
||||
baseRotation = mul(sagRotation, parent.worldRotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
baseRotation = parent.worldRotation;
|
||||
}
|
||||
|
||||
part.worldRotation = mul(baseRotation,
|
||||
mul(part.rotation, quaternion.RotateY(part.spinAngle))
|
||||
);
|
||||
|
||||
part.worldPosition =
|
||||
parent.worldPosition +
|
||||
mul(part.worldRotation, float3(0f, 1.5f * scale, 0f));
|
||||
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 worldPosition;
|
||||
public quaternion rotation, worldRotation;
|
||||
public float maxSagAngle, spinAngle, spinVelocity;
|
||||
}
|
||||
|
||||
NativeArray<FractalPart>[] parts;
|
||||
|
||||
NativeArray<float3x4>[] matrices;
|
||||
|
||||
[SerializeField, Range(3, 8)]
|
||||
int depth = 4;
|
||||
|
||||
[SerializeField]
|
||||
Mesh mesh = default, leafMesh = default;
|
||||
|
||||
[SerializeField]
|
||||
Material material = default;
|
||||
|
||||
[SerializeField]
|
||||
Gradient gradientA = default, gradientB = default;
|
||||
|
||||
[SerializeField]
|
||||
Color leafColorA = default, leafColorB = default;
|
||||
|
||||
[SerializeField, Range(0f, 90f)]
|
||||
float maxSagAngleA = 15f, maxSagAngleB = 25f;
|
||||
|
||||
[SerializeField, Range(0f, 90f)]
|
||||
float spinSpeedA = 20f, spinSpeedB = 25f;
|
||||
|
||||
[SerializeField, Range(0f, 1f)]
|
||||
float reverseSpinChance = 0.25f;
|
||||
|
||||
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()
|
||||
{
|
||||
maxSagAngle = radians(Random.Range(maxSagAngleA, maxSagAngleB)),
|
||||
rotation = rotations[childIndex],
|
||||
spinVelocity =
|
||||
(Random.value < reverseSpinChance ? -1f : 1f) *
|
||||
radians(Random.Range(spinSpeedA, spinSpeedB))
|
||||
};
|
||||
}
|
||||
|
||||
ComputeBuffer[] matricesBuffers;
|
||||
|
||||
Vector4[] sequenceNumbers;
|
||||
|
||||
static readonly int colorAId = Shader.PropertyToID("_ColorA");
|
||||
static readonly int colorBId = Shader.PropertyToID("_ColorB");
|
||||
static readonly int matricesId = Shader.PropertyToID("_Matrices");
|
||||
static readonly int sequenceNumbersId = Shader.PropertyToID("_SequenceNumbers");
|
||||
|
||||
static MaterialPropertyBlock propertyBlock;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
parts = new NativeArray<FractalPart>[depth];
|
||||
matrices = new NativeArray<float3x4>[depth];
|
||||
matricesBuffers = new ComputeBuffer[depth];
|
||||
sequenceNumbers = new Vector4[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);
|
||||
sequenceNumbers[i] = new Vector4(Random.value, Random.value, Random.value, Random.value);
|
||||
}
|
||||
|
||||
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;
|
||||
sequenceNumbers = null;
|
||||
}
|
||||
|
||||
void OnValidate()
|
||||
{
|
||||
if (parts != null && enabled)
|
||||
{
|
||||
OnDisable();
|
||||
OnEnable();
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float deltaTime = Time.deltaTime;
|
||||
FractalPart rootPart = parts[0][0];
|
||||
rootPart.spinAngle += rootPart.spinVelocity * deltaTime;
|
||||
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
|
||||
{
|
||||
deltaTime = deltaTime,
|
||||
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));
|
||||
int leafIndex = matricesBuffers.Length - 1;
|
||||
for (int i = 0; i < matricesBuffers.Length; i++)
|
||||
{
|
||||
Mesh instanceMesh;
|
||||
Color colorA, colorB;
|
||||
if (i == leafIndex)
|
||||
{
|
||||
colorA = leafColorA;
|
||||
colorB = leafColorB;
|
||||
instanceMesh = leafMesh;
|
||||
}
|
||||
else
|
||||
{
|
||||
colorA = gradientA.Evaluate(i / (matricesBuffers.Length - 2f));
|
||||
colorB = gradientB.Evaluate(i / (matricesBuffers.Length - 2f));
|
||||
instanceMesh = mesh;
|
||||
}
|
||||
propertyBlock.SetColor(colorAId, colorA);
|
||||
propertyBlock.SetColor(colorBId, colorB);
|
||||
ComputeBuffer buffer = matricesBuffers[i];
|
||||
buffer.SetData(matrices[i]);
|
||||
float gradientInterpolator = i / (matricesBuffers.Length - 1f);
|
||||
propertyBlock.SetColor(colorAId, gradientA.Evaluate(gradientInterpolator));
|
||||
propertyBlock.SetColor(colorBId, gradientB.Evaluate(gradientInterpolator));
|
||||
propertyBlock.SetBuffer(matricesId, buffer);
|
||||
propertyBlock.SetVector(sequenceNumbersId, sequenceNumbers[i]);
|
||||
Graphics.DrawMeshInstancedProcedural(instanceMesh, 0, material, bounds, buffer.count, propertyBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 14cd06bfa92d53e4ebc0cde4a0e39db8
|
||||
guid: bef3764eec961e04db4297ce68f82391
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -1,155 +0,0 @@
|
||||
#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)
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7f7fcb3b4a90614b80aa341489318e7
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
currentAPIMask: 4
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,94 +0,0 @@
|
||||
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,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5d4ebe0e863dfd49b58925b59880bf7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,110 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e99d61420a0d1f459f961121d6fbe77
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,123 +0,0 @@
|
||||
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,44 @@
|
||||
#if defined(UNITY_PROCEDURAL_INSTANCING_ENABLED)
|
||||
StructuredBuffer<float3x4> _Matrices;
|
||||
#endif
|
||||
|
||||
float4 _ColorA, _ColorB;
|
||||
|
||||
float4 _SequenceNumbers;
|
||||
|
||||
float4 GetFractalColor () {
|
||||
#if defined(UNITY_PROCEDURAL_INSTANCING_ENABLED)
|
||||
float4 color;
|
||||
color.rgb = lerp(
|
||||
_ColorA.rgb, _ColorB.rgb,
|
||||
frac(unity_InstanceID * _SequenceNumbers.x + _SequenceNumbers.y)
|
||||
);
|
||||
color.a = lerp(
|
||||
_ColorA.a, _ColorB.a,
|
||||
frac(unity_InstanceID * _SequenceNumbers.z + _SequenceNumbers.w)
|
||||
);
|
||||
return color;
|
||||
#else
|
||||
return _ColorA;
|
||||
#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 float4 FractalColor) {
|
||||
Out = In;
|
||||
FractalColor = GetFractalColor();
|
||||
}
|
||||
|
||||
void ShaderGraphFunction_half (half3 In, out half3 Out, out half4 FractalColor) {
|
||||
Out = In;
|
||||
FractalColor = GetFractalColor();
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc209e68d98853d44a1454b74031fae0
|
||||
guid: 0ed85852d1001bf44b1fef32640df23b
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"com.unity.burst": "1.4.4",
|
||||
"com.unity.render-pipelines.universal": "7.5.3",
|
||||
"com.unity.textmeshpro": "2.1.3",
|
||||
"com.unity.modules.ai": "1.0.0",
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
{
|
||||
"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": {
|
||||
"version": "7.5.3",
|
||||
"depth": 1,
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"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,7 +584,8 @@ PlayerSettings:
|
||||
webGLWasmStreaming: 0
|
||||
scriptingDefineSymbols: {}
|
||||
platformArchitecture: {}
|
||||
scriptingBackend: {}
|
||||
scriptingBackend:
|
||||
Standalone: 0
|
||||
il2cppCompilerConfiguration: {}
|
||||
managedStrippingLevel: {}
|
||||
incrementalIl2cppBuild: {}
|
||||
|
||||
Reference in New Issue
Block a user