wip: Ray effect
This commit is contained in:
+139
@@ -0,0 +1,139 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 8
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Spotlight
|
||||||
|
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||||
|
m_Parent: {fileID: 0}
|
||||||
|
m_ModifiedSerializedProperties: 0
|
||||||
|
m_ValidKeywords: []
|
||||||
|
m_InvalidKeywords: []
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: -1
|
||||||
|
stringTagMap:
|
||||||
|
RenderType: Opaque
|
||||||
|
disabledShaderPasses:
|
||||||
|
- MOTIONVECTORS
|
||||||
|
m_LockedProperties:
|
||||||
|
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}
|
||||||
|
- _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}
|
||||||
|
- _SpecGlossMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_Lightmaps:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_LightmapsInd:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_ShadowMasks:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Ints: []
|
||||||
|
m_Floats:
|
||||||
|
- _AddPrecomputedVelocity: 0
|
||||||
|
- _AlphaClip: 0
|
||||||
|
- _AlphaToMask: 0
|
||||||
|
- _Blend: 0
|
||||||
|
- _BlendModePreserveSpecular: 1
|
||||||
|
- _BumpScale: 1
|
||||||
|
- _ClearCoatMask: 0
|
||||||
|
- _ClearCoatSmoothness: 0
|
||||||
|
- _Cull: 2
|
||||||
|
- _Cutoff: 0.5
|
||||||
|
- _DetailAlbedoMapScale: 1
|
||||||
|
- _DetailNormalMapScale: 1
|
||||||
|
- _DstBlend: 0
|
||||||
|
- _DstBlendAlpha: 0
|
||||||
|
- _EnvironmentReflections: 1
|
||||||
|
- _GlossMapScale: 1
|
||||||
|
- _Glossiness: 0.5
|
||||||
|
- _GlossyReflections: 1
|
||||||
|
- _Metallic: 0
|
||||||
|
- _Mode: 0
|
||||||
|
- _OcclusionStrength: 1
|
||||||
|
- _Parallax: 0.02
|
||||||
|
- _QueueOffset: 0
|
||||||
|
- _ReceiveShadows: 1
|
||||||
|
- _Smoothness: 0.5
|
||||||
|
- _SmoothnessTextureChannel: 0
|
||||||
|
- _SpecularHighlights: 1
|
||||||
|
- _SrcBlend: 1
|
||||||
|
- _SrcBlendAlpha: 1
|
||||||
|
- _Surface: 0
|
||||||
|
- _UVSec: 0
|
||||||
|
- _WorkflowMode: 1
|
||||||
|
- _XRMotionVectorsPass: 1
|
||||||
|
- _ZWrite: 1
|
||||||
|
m_Colors:
|
||||||
|
- _BaseColor: {r: 0.9063317, g: 0.9063317, b: 0.9063317, a: 1}
|
||||||
|
- _Color: {r: 0.9063317, g: 0.9063317, b: 0.9063317, a: 1}
|
||||||
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||||
|
m_BuildTextureStacks: []
|
||||||
|
m_AllowLocking: 1
|
||||||
|
--- !u!114 &5560504017958588519
|
||||||
|
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: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
|
||||||
|
version: 10
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b12d689a0c880ef4fbebb69ea59868fc
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 2100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f10beddbc674dc749b57d4941acf9978
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f7b5056c6f334304ea5edce4b4dcda35
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7e6083807050b0d4daf1f26a5d056e47
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &-5120607745848675954
|
||||||
|
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: 10
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 8
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: M_ray
|
||||||
|
m_Shader: {fileID: -6465566751694194690, guid: 41e1af50dce5647448137abb3f85e49b, type: 3}
|
||||||
|
m_Parent: {fileID: 0}
|
||||||
|
m_ModifiedSerializedProperties: 0
|
||||||
|
m_ValidKeywords: []
|
||||||
|
m_InvalidKeywords: []
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 1
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: -1
|
||||||
|
stringTagMap: {}
|
||||||
|
disabledShaderPasses:
|
||||||
|
- MOTIONVECTORS
|
||||||
|
m_LockedProperties:
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- unity_Lightmaps:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_LightmapsInd:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- unity_ShadowMasks:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Ints: []
|
||||||
|
m_Floats:
|
||||||
|
- _Debug: 0
|
||||||
|
- _Demo: 0
|
||||||
|
- _IgnoreAtten: 1
|
||||||
|
- _Noise: 0.7
|
||||||
|
- _QueueControl: 0
|
||||||
|
- _QueueOffset: 0
|
||||||
|
- _Stop: 1
|
||||||
|
m_Colors:
|
||||||
|
- _Color: {r: 11.984315, g: 8.690491, b: 3.2428153, a: 0.07058824}
|
||||||
|
- _Direction: {r: 0, g: 0, b: 1, a: 0}
|
||||||
|
- _Size: {r: 1, g: 1, b: 0, a: 0}
|
||||||
|
m_BuildTextureStacks: []
|
||||||
|
m_AllowLocking: 1
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7a2872c815b96384cac52984da09c06e
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 2100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &2541733693143394657
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 688462554248565909}
|
||||||
|
- component: {fileID: 3502526413762748772}
|
||||||
|
- component: {fileID: 3666808908055770611}
|
||||||
|
- component: {fileID: 1386704396112132862}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Ray
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &688462554248565909
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2541733693143394657}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 4, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!33 &3502526413762748772
|
||||||
|
MeshFilter:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2541733693143394657}
|
||||||
|
m_Mesh: {fileID: -3257882273320071057, guid: 13ea729820199da4cbb03c437c389ef1, type: 3}
|
||||||
|
--- !u!23 &3666808908055770611
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2541733693143394657}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_StaticShadowCaster: 0
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RayTraceProcedural: 0
|
||||||
|
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||||
|
m_RayTracingAccelStructBuildFlags: 1
|
||||||
|
m_SmallMeshCulling: 1
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 2100000, guid: 7a2872c815b96384cac52984da09c06e, 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
|
||||||
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
|
--- !u!114 &1386704396112132862
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2541733693143394657}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: cc3f4e6ebaca477438c280760d2d2f16, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
MeshFilter: {fileID: 3502526413762748772}
|
||||||
|
Renderer: {fileID: 3666808908055770611}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2db7add660a81a342a80b1ba7a331929
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 74b5d3f54ee10f84692707c4881343e9
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 41e1af50dce5647448137abb3f85e49b
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d4fd7a10734b9574bac9aa5ccdef0dfa
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
void Facing_float(float3 ObjectPos, float3 Origin, float3 InUp, uint Orthographic, out float3 FacingWorldPos, out float3 FacingObjectPos, out float3 Right, out float3 Up, out float3 Forward)
|
||||||
|
{
|
||||||
|
float3 origin = TransformObjectToWorld(float3(0, 0, 0));
|
||||||
|
float3 view = lerp(normalize(origin - _WorldSpaceCameraPos.xyz), GetViewForwardDir(), Orthographic);
|
||||||
|
|
||||||
|
Up = normalize(InUp);
|
||||||
|
Right = normalize(cross(Up, view));
|
||||||
|
Forward = cross(Right, Up);
|
||||||
|
|
||||||
|
FacingWorldPos = Origin;
|
||||||
|
FacingWorldPos += ObjectPos.x * length(TransformObjectToWorld(float3(1, 0, 0)) - origin) * Right;
|
||||||
|
FacingWorldPos += ObjectPos.y * length(TransformObjectToWorld(float3(0, 1, 0)) - origin) * Up;
|
||||||
|
FacingWorldPos += ObjectPos.z * length(TransformObjectToWorld(float3(0, 0, 1)) - origin) * Forward;
|
||||||
|
|
||||||
|
FacingObjectPos = TransformWorldToObject(FacingWorldPos);
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0f55a5eadf19c264990ae7ea0ef40e70
|
||||||
|
ShaderIncludeImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,252 @@
|
|||||||
|
//
|
||||||
|
// Noise Shader Library for Unity - https://github.com/keijiro/NoiseShader
|
||||||
|
//
|
||||||
|
// Original work (webgl-noise) Copyright (C) 2011 Ashima Arts.
|
||||||
|
// Translation and modification was made by Keijiro Takahashi.
|
||||||
|
//
|
||||||
|
// This shader is based on the webgl-noise GLSL shader. For further details
|
||||||
|
// of the original shader, please see the following description from the
|
||||||
|
// original source code.
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Description : Array and textureless GLSL 2D/3D/4D simplex
|
||||||
|
// noise functions.
|
||||||
|
// Author : Ian McEwan, Ashima Arts.
|
||||||
|
// Maintainer : ijm
|
||||||
|
// Lastmod : 20110822 (ijm)
|
||||||
|
// License : Copyright (C) 2011 Ashima Arts. All rights reserved.
|
||||||
|
// Distributed under the MIT License. See LICENSE file.
|
||||||
|
// https://github.com/ashima/webgl-noise
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef SimplexNoise3D_hlsl
|
||||||
|
#define SimplexNoise3D_hlsl
|
||||||
|
|
||||||
|
float3 mod289(float3 x)
|
||||||
|
{
|
||||||
|
return x - floor(x / 289.0) * 289.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 mod289(float4 x)
|
||||||
|
{
|
||||||
|
return x - floor(x / 289.0) * 289.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 permute(float4 x)
|
||||||
|
{
|
||||||
|
return mod289((x * 34.0 + 1.0) * x);
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 taylorInvSqrt(float4 r)
|
||||||
|
{
|
||||||
|
return 1.79284291400159 - r * 0.85373472095314;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Simplex noise
|
||||||
|
float SimplexNoise(float3 v)
|
||||||
|
{
|
||||||
|
const float2 C = float2(1.0 / 6.0, 1.0 / 3.0);
|
||||||
|
|
||||||
|
// First corner
|
||||||
|
float3 i = floor(v + dot(v, C.yyy));
|
||||||
|
float3 x0 = v - i + dot(i, C.xxx);
|
||||||
|
|
||||||
|
// Other corners
|
||||||
|
float3 g = step(x0.yzx, x0.xyz);
|
||||||
|
float3 l = 1.0 - g;
|
||||||
|
float3 i1 = min(g.xyz, l.zxy);
|
||||||
|
float3 i2 = max(g.xyz, l.zxy);
|
||||||
|
|
||||||
|
// x1 = x0 - i1 + 1.0 * C.xxx;
|
||||||
|
// x2 = x0 - i2 + 2.0 * C.xxx;
|
||||||
|
// x3 = x0 - 1.0 + 3.0 * C.xxx;
|
||||||
|
float3 x1 = x0 - i1 + C.xxx;
|
||||||
|
float3 x2 = x0 - i2 + C.yyy;
|
||||||
|
float3 x3 = x0 - 0.5;
|
||||||
|
|
||||||
|
// Permutations
|
||||||
|
i = mod289(i); // Avoid truncation effects in permutation
|
||||||
|
float4 p =
|
||||||
|
permute(permute(permute(i.z + float4(0.0, i1.z, i2.z, 1.0))
|
||||||
|
+ i.y + float4(0.0, i1.y, i2.y, 1.0))
|
||||||
|
+ i.x + float4(0.0, i1.x, i2.x, 1.0));
|
||||||
|
|
||||||
|
// Gradients: 7x7 points over a square, mapped onto an octahedron.
|
||||||
|
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
|
||||||
|
float4 j = p - 49.0 * floor(p / 49.0); // mod(p,7*7)
|
||||||
|
|
||||||
|
float4 x_ = floor(j / 7.0);
|
||||||
|
float4 y_ = floor(j - 7.0 * x_); // mod(j,N)
|
||||||
|
|
||||||
|
float4 x = (x_ * 2.0 + 0.5) / 7.0 - 1.0;
|
||||||
|
float4 y = (y_ * 2.0 + 0.5) / 7.0 - 1.0;
|
||||||
|
|
||||||
|
float4 h = 1.0 - abs(x) - abs(y);
|
||||||
|
|
||||||
|
float4 b0 = float4(x.xy, y.xy);
|
||||||
|
float4 b1 = float4(x.zw, y.zw);
|
||||||
|
|
||||||
|
//float4 s0 = float4(lessThan(b0, 0.0)) * 2.0 - 1.0;
|
||||||
|
//float4 s1 = float4(lessThan(b1, 0.0)) * 2.0 - 1.0;
|
||||||
|
float4 s0 = floor(b0) * 2.0 + 1.0;
|
||||||
|
float4 s1 = floor(b1) * 2.0 + 1.0;
|
||||||
|
float4 sh = -step(h, 0.0);
|
||||||
|
|
||||||
|
float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
|
||||||
|
float4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
|
||||||
|
|
||||||
|
float3 g0 = float3(a0.xy, h.x);
|
||||||
|
float3 g1 = float3(a0.zw, h.y);
|
||||||
|
float3 g2 = float3(a1.xy, h.z);
|
||||||
|
float3 g3 = float3(a1.zw, h.w);
|
||||||
|
|
||||||
|
// Normalise gradients
|
||||||
|
float4 norm = taylorInvSqrt(float4(dot(g0, g0), dot(g1, g1), dot(g2, g2), dot(g3, g3)));
|
||||||
|
g0 *= norm.x;
|
||||||
|
g1 *= norm.y;
|
||||||
|
g2 *= norm.z;
|
||||||
|
g3 *= norm.w;
|
||||||
|
|
||||||
|
// Mix final noise value
|
||||||
|
float4 m = max(0.6 - float4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);
|
||||||
|
m = m * m;
|
||||||
|
m = m * m;
|
||||||
|
|
||||||
|
float4 px = float4(dot(x0, g0), dot(x1, g1), dot(x2, g2), dot(x3, g3));
|
||||||
|
return 42.0 * dot(m, px);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Simplex noise with octaves
|
||||||
|
float SimplexNoise_Octaves(float3 inCoord, float scale, float3 speed, uint octaveNumber, float octaveScale, float octaveAttenuation, float time) {
|
||||||
|
|
||||||
|
float output = 0.0f;
|
||||||
|
float weight = 1.0f;
|
||||||
|
|
||||||
|
for (uint i = 0; i < octaveNumber; i++)
|
||||||
|
{
|
||||||
|
float3 coord = inCoord * scale + time * speed;
|
||||||
|
|
||||||
|
output += SimplexNoise(coord) * weight;
|
||||||
|
|
||||||
|
scale *= octaveScale;
|
||||||
|
weight *= 1.0f - octaveAttenuation;
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Simplex noise gradient
|
||||||
|
float4 SimplexNoiseGradient(float3 v)
|
||||||
|
{
|
||||||
|
const float2 C = float2(1.0 / 6.0, 1.0 / 3.0);
|
||||||
|
|
||||||
|
// First corner
|
||||||
|
float3 i = floor(v + dot(v, C.yyy));
|
||||||
|
float3 x0 = v - i + dot(i, C.xxx);
|
||||||
|
|
||||||
|
// Other corners
|
||||||
|
float3 g = step(x0.yzx, x0.xyz);
|
||||||
|
float3 l = 1.0 - g;
|
||||||
|
float3 i1 = min(g.xyz, l.zxy);
|
||||||
|
float3 i2 = max(g.xyz, l.zxy);
|
||||||
|
|
||||||
|
// x1 = x0 - i1 + 1.0 * C.xxx;
|
||||||
|
// x2 = x0 - i2 + 2.0 * C.xxx;
|
||||||
|
// x3 = x0 - 1.0 + 3.0 * C.xxx;
|
||||||
|
float3 x1 = x0 - i1 + C.xxx;
|
||||||
|
float3 x2 = x0 - i2 + C.yyy;
|
||||||
|
float3 x3 = x0 - 0.5;
|
||||||
|
|
||||||
|
// Permutations
|
||||||
|
i = mod289(i); // Avoid truncation effects in permutation
|
||||||
|
float4 p =
|
||||||
|
permute(permute(permute(i.z + float4(0.0, i1.z, i2.z, 1.0))
|
||||||
|
+ i.y + float4(0.0, i1.y, i2.y, 1.0))
|
||||||
|
+ i.x + float4(0.0, i1.x, i2.x, 1.0));
|
||||||
|
|
||||||
|
// Gradients: 7x7 points over a square, mapped onto an octahedron.
|
||||||
|
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
|
||||||
|
float4 j = p - 49.0 * floor(p / 49.0); // mod(p,7*7)
|
||||||
|
|
||||||
|
float4 x_ = floor(j / 7.0);
|
||||||
|
float4 y_ = floor(j - 7.0 * x_); // mod(j,N)
|
||||||
|
|
||||||
|
float4 x = (x_ * 2.0 + 0.5) / 7.0 - 1.0;
|
||||||
|
float4 y = (y_ * 2.0 + 0.5) / 7.0 - 1.0;
|
||||||
|
|
||||||
|
float4 h = 1.0 - abs(x) - abs(y);
|
||||||
|
|
||||||
|
float4 b0 = float4(x.xy, y.xy);
|
||||||
|
float4 b1 = float4(x.zw, y.zw);
|
||||||
|
|
||||||
|
//float4 s0 = float4(lessThan(b0, 0.0)) * 2.0 - 1.0;
|
||||||
|
//float4 s1 = float4(lessThan(b1, 0.0)) * 2.0 - 1.0;
|
||||||
|
float4 s0 = floor(b0) * 2.0 + 1.0;
|
||||||
|
float4 s1 = floor(b1) * 2.0 + 1.0;
|
||||||
|
float4 sh = -step(h, 0.0);
|
||||||
|
|
||||||
|
float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
|
||||||
|
float4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
|
||||||
|
|
||||||
|
float3 g0 = float3(a0.xy, h.x);
|
||||||
|
float3 g1 = float3(a0.zw, h.y);
|
||||||
|
float3 g2 = float3(a1.xy, h.z);
|
||||||
|
float3 g3 = float3(a1.zw, h.w);
|
||||||
|
|
||||||
|
// Normalise gradients
|
||||||
|
float4 norm = taylorInvSqrt(float4(dot(g0, g0), dot(g1, g1), dot(g2, g2), dot(g3, g3)));
|
||||||
|
g0 *= norm.x;
|
||||||
|
g1 *= norm.y;
|
||||||
|
g2 *= norm.z;
|
||||||
|
g3 *= norm.w;
|
||||||
|
|
||||||
|
// Compute noise and gradient at P
|
||||||
|
float4 m = max(0.6 - float4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);
|
||||||
|
float4 m2 = m * m;
|
||||||
|
float4 m3 = m2 * m;
|
||||||
|
float4 m4 = m2 * m2;
|
||||||
|
float3 grad =
|
||||||
|
-6.0 * m3.x * x0 * dot(x0, g0) + m4.x * g0 +
|
||||||
|
-6.0 * m3.y * x1 * dot(x1, g1) + m4.y * g1 +
|
||||||
|
-6.0 * m3.z * x2 * dot(x2, g2) + m4.z * g2 +
|
||||||
|
-6.0 * m3.w * x3 * dot(x3, g3) + m4.w * g3;
|
||||||
|
float4 px = float4(dot(x0, g0), dot(x1, g1), dot(x2, g2), dot(x3, g3));
|
||||||
|
return 42.0 * float4(grad, dot(m4, px));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Simplex noise gradient with octaves
|
||||||
|
float4 SimplexNoiseGradient_Octaves(float3 inCoord, float scale, float3 speed, uint octaveNumber, float octaveScale, float octaveAttenuation, float time) {
|
||||||
|
|
||||||
|
float4 output = 0.0f;
|
||||||
|
float weight = 1.0f;
|
||||||
|
|
||||||
|
for (uint i = 0; i < octaveNumber; i++)
|
||||||
|
{
|
||||||
|
float3 coord = inCoord * scale + time * speed;
|
||||||
|
|
||||||
|
output += SimplexNoiseGradient(coord) * weight;
|
||||||
|
|
||||||
|
scale *= octaveScale;
|
||||||
|
weight *= 1.0f - octaveAttenuation;
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
float SimplexNoise01(float3 Position, float Size, float Amplitude)
|
||||||
|
{
|
||||||
|
return (SimplexNoiseGradient(Position / Size).x * .1 + .6) * Amplitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimplexNoise_float(float3 Position, float Size, float Amplitude, out float Noise)
|
||||||
|
{
|
||||||
|
Noise = (SimplexNoiseGradient(Position / Size).x * .1 + .6) * Amplitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimplexNoiseOctaves_float(float3 Position, float Size, float Octaves, float OctaveScale, float OctaveAttenuation, float Amplitude, out float Noise)
|
||||||
|
{
|
||||||
|
Noise = SimplexNoiseGradient_Octaves(Position, Size, 0, Octaves, OctaveScale, OctaveAttenuation, 0).x * Amplitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1fbe7b87c262a1c408c95cba41e8de7d
|
||||||
|
ShaderIncludeImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b07b1c5f4db7a6c4ca9fe729a345d251
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
@@ -0,0 +1,107 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 13ea729820199da4cbb03c437c389ef1
|
||||||
|
ModelImporter:
|
||||||
|
serializedVersion: 22200
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
materials:
|
||||||
|
materialImportMode: 2
|
||||||
|
materialName: 0
|
||||||
|
materialSearch: 1
|
||||||
|
materialLocation: 1
|
||||||
|
animations:
|
||||||
|
legacyGenerateAnimations: 4
|
||||||
|
bakeSimulation: 0
|
||||||
|
resampleCurves: 1
|
||||||
|
optimizeGameObjects: 0
|
||||||
|
removeConstantScaleCurves: 0
|
||||||
|
motionNodeName:
|
||||||
|
animationImportErrors:
|
||||||
|
animationImportWarnings:
|
||||||
|
animationRetargetingWarnings:
|
||||||
|
animationDoRetargetingWarnings: 0
|
||||||
|
importAnimatedCustomProperties: 0
|
||||||
|
importConstraints: 0
|
||||||
|
animationCompression: 1
|
||||||
|
animationRotationError: 0.5
|
||||||
|
animationPositionError: 0.5
|
||||||
|
animationScaleError: 0.5
|
||||||
|
animationWrapMode: 0
|
||||||
|
extraExposedTransformPaths: []
|
||||||
|
extraUserProperties: []
|
||||||
|
clipAnimations: []
|
||||||
|
isReadable: 0
|
||||||
|
meshes:
|
||||||
|
lODScreenPercentages: []
|
||||||
|
globalScale: 1
|
||||||
|
meshCompression: 0
|
||||||
|
addColliders: 0
|
||||||
|
useSRGBMaterialColor: 1
|
||||||
|
sortHierarchyByName: 1
|
||||||
|
importPhysicalCameras: 1
|
||||||
|
importVisibility: 1
|
||||||
|
importBlendShapes: 1
|
||||||
|
importCameras: 1
|
||||||
|
importLights: 1
|
||||||
|
nodeNameCollisionStrategy: 1
|
||||||
|
fileIdsGeneration: 2
|
||||||
|
swapUVChannels: 0
|
||||||
|
generateSecondaryUV: 0
|
||||||
|
useFileUnits: 1
|
||||||
|
keepQuads: 0
|
||||||
|
weldVertices: 1
|
||||||
|
bakeAxisConversion: 0
|
||||||
|
preserveHierarchy: 0
|
||||||
|
skinWeightsMode: 0
|
||||||
|
maxBonesPerVertex: 4
|
||||||
|
minBoneWeight: 0.001
|
||||||
|
optimizeBones: 1
|
||||||
|
meshOptimizationFlags: -1
|
||||||
|
indexFormat: 0
|
||||||
|
secondaryUVAngleDistortion: 8
|
||||||
|
secondaryUVAreaDistortion: 15.000001
|
||||||
|
secondaryUVHardAngle: 88
|
||||||
|
secondaryUVMarginMethod: 1
|
||||||
|
secondaryUVMinLightmapResolution: 40
|
||||||
|
secondaryUVMinObjectScale: 1
|
||||||
|
secondaryUVPackMargin: 4
|
||||||
|
useFileScale: 1
|
||||||
|
strictVertexDataChecks: 0
|
||||||
|
tangentSpace:
|
||||||
|
normalSmoothAngle: 60
|
||||||
|
normalImportMode: 0
|
||||||
|
tangentImportMode: 3
|
||||||
|
normalCalculationMode: 4
|
||||||
|
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
|
||||||
|
blendShapeNormalImportMode: 1
|
||||||
|
normalSmoothingSource: 0
|
||||||
|
referencedClips: []
|
||||||
|
importAnimation: 1
|
||||||
|
humanDescription:
|
||||||
|
serializedVersion: 3
|
||||||
|
human: []
|
||||||
|
skeleton: []
|
||||||
|
armTwist: 0.5
|
||||||
|
foreArmTwist: 0.5
|
||||||
|
upperLegTwist: 0.5
|
||||||
|
legTwist: 0.5
|
||||||
|
armStretch: 0.05
|
||||||
|
legStretch: 0.05
|
||||||
|
feetSpacing: 0
|
||||||
|
globalScale: 1
|
||||||
|
rootMotionBoneName:
|
||||||
|
hasTranslationDoF: 0
|
||||||
|
hasExtraRoot: 0
|
||||||
|
skeletonHasParents: 1
|
||||||
|
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||||
|
autoGenerateAvatarMappingIfUnspecified: 1
|
||||||
|
animationType: 2
|
||||||
|
humanoidOversampling: 1
|
||||||
|
avatarSetup: 0
|
||||||
|
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
|
||||||
|
importBlendShapeDeformPercent: 1
|
||||||
|
remapMaterialsIfMaterialImportModeIsNone: 0
|
||||||
|
additionalBone: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user