This commit is contained in:
2026-11-24 15:51:02 +01:00
parent cca4d73e41
commit f4aa17114a
22092 changed files with 5042406 additions and 0 deletions
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 379c170f122332c4a851ec87e0665acd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 0fdcdf6eccd273c48a0249108b1d5ea8
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2f81617d9a8055b4988b3fa9da4d6f7b
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 96a11cdd9228a404e80c3ad6f570ee7f
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 032782e1f08483c43be39072b4b33372
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 0f586d6c782a7694d9934712cd84c5ca
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: d3b7b6909a352a343b9d185ce09678e4
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,896 @@
{
"m_SGVersion": 3,
"m_Type": "UnityEditor.ShaderGraph.GraphData",
"m_ObjectId": "6ca61cbcfae4470dad83e3760f7c5050",
"m_Properties": [
{
"m_Id": "3eea43880af6878e8f39c9b818465c6e"
},
{
"m_Id": "e8febd9393f60b8ca723ec06111edb24"
},
{
"m_Id": "83a09f85ae0fdc85a8cee46af63bf184"
}
],
"m_Keywords": [],
"m_Dropdowns": [],
"m_CategoryData": [
{
"m_Id": "ffe04c9a01f04f7698bbbeb5c6b2f37d"
}
],
"m_Nodes": [
{
"m_Id": "bce226ed39a60489860b786cb56dcd51"
},
{
"m_Id": "04ed7310b6f2bd8bae715cf02a62af33"
},
{
"m_Id": "c9864dfb0cdc4d84bd74c47ea196f203"
},
{
"m_Id": "8e82de0a48c1608490733d1c2faa9264"
},
{
"m_Id": "30bd9a06e150728885e8efc5b35b86dd"
},
{
"m_Id": "59715a0d8289e18f9c6e71cd69dcd94c"
},
{
"m_Id": "f9cf3cf2ba7af588871f6a3519413687"
}
],
"m_GroupDatas": [],
"m_StickyNoteDatas": [
{
"m_Id": "b6d3a32422bc4f9fb9b571a87433ee44"
},
{
"m_Id": "443d1153937146799c497b7f2aab1206"
}
],
"m_Edges": [
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "04ed7310b6f2bd8bae715cf02a62af33"
},
"m_SlotId": 1
},
"m_InputSlot": {
"m_Node": {
"m_Id": "c9864dfb0cdc4d84bd74c47ea196f203"
},
"m_SlotId": 3
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "30bd9a06e150728885e8efc5b35b86dd"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "59715a0d8289e18f9c6e71cd69dcd94c"
},
"m_SlotId": 5
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "59715a0d8289e18f9c6e71cd69dcd94c"
},
"m_SlotId": 1
},
"m_InputSlot": {
"m_Node": {
"m_Id": "c9864dfb0cdc4d84bd74c47ea196f203"
},
"m_SlotId": 2
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "8e82de0a48c1608490733d1c2faa9264"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "04ed7310b6f2bd8bae715cf02a62af33"
},
"m_SlotId": 5
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "bce226ed39a60489860b786cb56dcd51"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "f9cf3cf2ba7af588871f6a3519413687"
},
"m_SlotId": 5
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "f9cf3cf2ba7af588871f6a3519413687"
},
"m_SlotId": 1
},
"m_InputSlot": {
"m_Node": {
"m_Id": "c9864dfb0cdc4d84bd74c47ea196f203"
},
"m_SlotId": 1
}
}
],
"m_VertexContext": {
"m_Position": {
"x": 459.0,
"y": 8.0
},
"m_Blocks": []
},
"m_FragmentContext": {
"m_Position": {
"x": 459.0,
"y": 208.0
},
"m_Blocks": []
},
"m_PreviewData": {
"serializedMesh": {
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
"m_Guid": ""
},
"preventRotation": false
},
"m_Path": "Terrain/Components/Hex",
"m_GraphPrecision": 0,
"m_PreviewMode": 1,
"m_OutputNode": {
"m_Id": "c9864dfb0cdc4d84bd74c47ea196f203"
},
"m_SubDatas": [],
"m_ActiveTargets": []
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode",
"m_ObjectId": "04ed7310b6f2bd8bae715cf02a62af33",
"m_Group": {
"m_Id": ""
},
"m_Name": "Hash_Tchou_2_3 (Custom Function)",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 182.00003051757813,
"y": 126.00000762939453,
"width": 250.5,
"height": 94.0000228881836
}
},
"m_Slots": [
{
"m_Id": "71dd96241ddee4829841864bc36c16ab"
},
{
"m_Id": "69af73888cd3338d9fa4eb50643a6d30"
}
],
"synonyms": [],
"m_Precision": 1,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SourceType": 0,
"m_FunctionName": "Hash_Tchou_2_3",
"m_FunctionSource": "e7257ce6f0bb79b4e8d1d6c14ae3610c",
"m_FunctionSourceUsePragmas": true,
"m_FunctionBody": "Enter function body here..."
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot",
"m_ObjectId": "17cfbac2172abd8ab750cbc85629594e",
"m_Id": 0,
"m_DisplayName": "R Seed Coord",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0
},
"m_Labels": [
"X",
"Y"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
"m_ObjectId": "30bd9a06e150728885e8efc5b35b86dd",
"m_Group": {
"m_Id": ""
},
"m_Name": "Property",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 32.00000762939453,
"y": 73.0,
"width": 150.0,
"height": 34.0
}
},
"m_Slots": [
{
"m_Id": "30d9e7ae59a8e281bd8bc0fe5100f8d5"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_Property": {
"m_Id": "e8febd9393f60b8ca723ec06111edb24"
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot",
"m_ObjectId": "30d9e7ae59a8e281bd8bc0fe5100f8d5",
"m_Id": 0,
"m_DisplayName": "G Seed Coord",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0
},
"m_Labels": [
"X",
"Y"
]
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.Internal.Vector2ShaderProperty",
"m_ObjectId": "3eea43880af6878e8f39c9b818465c6e",
"m_Guid": {
"m_GuidSerialized": "bf4858ac-0b17-4f0b-a488-8884dce0c4a7"
},
"m_Name": "R Seed Coord",
"m_DefaultRefNameVersion": 0,
"m_RefNameGeneratedByDisplayName": "",
"m_DefaultReferenceName": "Vector2_7FAF7845",
"m_OverrideReferenceName": "",
"m_GeneratePropertyBlock": true,
"m_UseCustomSlotLabel": false,
"m_CustomSlotLabel": "",
"m_DismissedVersion": 0,
"m_Precision": 0,
"overrideHLSLDeclaration": false,
"hlslDeclarationOverride": 0,
"m_Hidden": false,
"m_PerRendererData": false,
"m_customAttributes": [],
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "3fb4aa6f02817f8d857714d780e0069b",
"m_Id": 1,
"m_DisplayName": "random3",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "random3",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot",
"m_ObjectId": "41298a61fad0228aac4a382505c4ef62",
"m_Id": 0,
"m_DisplayName": "B Seed Coord",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0
},
"m_Labels": [
"X",
"Y"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.StickyNoteData",
"m_ObjectId": "443d1153937146799c497b7f2aab1206",
"m_Title": "Fast Hash Function",
"m_Content": "Designed by Chris Tchou, this hash function is as fast and efficient as we can make it.",
"m_TextSize": 0,
"m_Theme": 0,
"m_Position": {
"serializedVersion": "2",
"x": 205.00001525878907,
"y": -164.00001525878907,
"width": 213.2250213623047,
"height": 100.0
},
"m_Group": {
"m_Id": ""
}
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode",
"m_ObjectId": "59715a0d8289e18f9c6e71cd69dcd94c",
"m_Group": {
"m_Id": ""
},
"m_Name": "Hash_Tchou_2_3 (Custom Function)",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 182.00003051757813,
"y": 33.00000762939453,
"width": 250.5,
"height": 94.00000762939453
}
},
"m_Slots": [
{
"m_Id": "bbdbf3b871336c8fb662e246ebd0332b"
},
{
"m_Id": "3fb4aa6f02817f8d857714d780e0069b"
}
],
"synonyms": [],
"m_Precision": 1,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SourceType": 0,
"m_FunctionName": "Hash_Tchou_2_3",
"m_FunctionSource": "e7257ce6f0bb79b4e8d1d6c14ae3610c",
"m_FunctionSourceUsePragmas": true,
"m_FunctionBody": "Enter function body here..."
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "69af73888cd3338d9fa4eb50643a6d30",
"m_Id": 1,
"m_DisplayName": "random3",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "random3",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot",
"m_ObjectId": "71dd96241ddee4829841864bc36c16ab",
"m_Id": 5,
"m_DisplayName": "randomSeedCoord",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "randomSeedCoord",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0
},
"m_Labels": [
"X",
"Y"
]
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.Internal.Vector2ShaderProperty",
"m_ObjectId": "83a09f85ae0fdc85a8cee46af63bf184",
"m_Guid": {
"m_GuidSerialized": "e949691b-753c-4d00-80b2-aef3acf3e042"
},
"m_Name": "B Seed Coord",
"m_DefaultRefNameVersion": 0,
"m_RefNameGeneratedByDisplayName": "",
"m_DefaultReferenceName": "Vector2_EE4DA59B",
"m_OverrideReferenceName": "",
"m_GeneratePropertyBlock": true,
"m_UseCustomSlotLabel": false,
"m_CustomSlotLabel": "",
"m_DismissedVersion": 0,
"m_Precision": 0,
"overrideHLSLDeclaration": false,
"hlslDeclarationOverride": 0,
"m_Hidden": false,
"m_PerRendererData": false,
"m_customAttributes": [],
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
"m_ObjectId": "8e82de0a48c1608490733d1c2faa9264",
"m_Group": {
"m_Id": ""
},
"m_Name": "Property",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 33.000003814697269,
"y": 166.00001525878907,
"width": 149.00001525878907,
"height": 34.0
}
},
"m_Slots": [
{
"m_Id": "41298a61fad0228aac4a382505c4ef62"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_Property": {
"m_Id": "83a09f85ae0fdc85a8cee46af63bf184"
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "94d79781f02e1589a8d6a653d98896cc",
"m_Id": 1,
"m_DisplayName": "random3",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "random3",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.StickyNoteData",
"m_ObjectId": "b6d3a32422bc4f9fb9b571a87433ee44",
"m_Title": "GridRandom3",
"m_Content": "used for hex grid tiling, this node takes in the three sets of hex uv coordinates produced by the GetHexGridTriangle node and uses them to generate three random vec3 hash values. These values can then be passed into the random input of the RandomScaleOffsetUV node to create uv coordinates with random scale and offset values.",
"m_TextSize": 0,
"m_Theme": 0,
"m_Position": {
"serializedVersion": "2",
"x": 74.00000762939453,
"y": 255.50003051757813,
"width": 266.0000305175781,
"height": 144.25
},
"m_Group": {
"m_Id": ""
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot",
"m_ObjectId": "bbdbf3b871336c8fb662e246ebd0332b",
"m_Id": 5,
"m_DisplayName": "randomSeedCoord",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "randomSeedCoord",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0
},
"m_Labels": [
"X",
"Y"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
"m_ObjectId": "bce226ed39a60489860b786cb56dcd51",
"m_Group": {
"m_Id": ""
},
"m_Name": "Property",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 33.00000762939453,
"y": -21.000001907348634,
"width": 149.0,
"height": 34.0
}
},
"m_Slots": [
{
"m_Id": "17cfbac2172abd8ab750cbc85629594e"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_Property": {
"m_Id": "3eea43880af6878e8f39c9b818465c6e"
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "c6103d172cb33e83a8fffdb01f4bced6",
"m_Id": 2,
"m_DisplayName": "G random3",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Grandom3",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SubGraphOutputNode",
"m_ObjectId": "c9864dfb0cdc4d84bd74c47ea196f203",
"m_Group": {
"m_Id": ""
},
"m_Name": "Output",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 456.5000305175781,
"y": 8.999998092651368,
"width": 113.00003051757813,
"height": 125.0
}
},
"m_Slots": [
{
"m_Id": "e43a4eaecbba4d838d460ba925587bdb"
},
{
"m_Id": "c6103d172cb33e83a8fffdb01f4bced6"
},
{
"m_Id": "dde4c976be40a38ab02ba1a253395f53"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"IsFirstSlotValid": true
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector2MaterialSlot",
"m_ObjectId": "d15f72c75e6aa28baa1ed0ab95228168",
"m_Id": 5,
"m_DisplayName": "randomSeedCoord",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "randomSeedCoord",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0
},
"m_Labels": [
"X",
"Y"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "dde4c976be40a38ab02ba1a253395f53",
"m_Id": 3,
"m_DisplayName": "B random3",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Brandom3",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
"m_ObjectId": "e43a4eaecbba4d838d460ba925587bdb",
"m_Id": 1,
"m_DisplayName": "R random3",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Rrandom3",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"m_Labels": [
"X",
"Y",
"Z"
]
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.Internal.Vector2ShaderProperty",
"m_ObjectId": "e8febd9393f60b8ca723ec06111edb24",
"m_Guid": {
"m_GuidSerialized": "32ff142d-e6ae-4eac-b653-078766467f6b"
},
"m_Name": "G Seed Coord",
"m_DefaultRefNameVersion": 0,
"m_RefNameGeneratedByDisplayName": "",
"m_DefaultReferenceName": "Vector2_DEB39B39",
"m_OverrideReferenceName": "",
"m_GeneratePropertyBlock": true,
"m_UseCustomSlotLabel": false,
"m_CustomSlotLabel": "",
"m_DismissedVersion": 0,
"m_Precision": 0,
"overrideHLSLDeclaration": false,
"hlslDeclarationOverride": 0,
"m_Hidden": false,
"m_PerRendererData": false,
"m_customAttributes": [],
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
}
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode",
"m_ObjectId": "f9cf3cf2ba7af588871f6a3519413687",
"m_Group": {
"m_Id": ""
},
"m_Name": "Hash_Tchou_2_3 (Custom Function)",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 182.00003051757813,
"y": -61.00001907348633,
"width": 250.5,
"height": 94.0
}
},
"m_Slots": [
{
"m_Id": "d15f72c75e6aa28baa1ed0ab95228168"
},
{
"m_Id": "94d79781f02e1589a8d6a653d98896cc"
}
],
"synonyms": [],
"m_Precision": 1,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_SourceType": 0,
"m_FunctionName": "Hash_Tchou_2_3",
"m_FunctionSource": "e7257ce6f0bb79b4e8d1d6c14ae3610c",
"m_FunctionSourceUsePragmas": true,
"m_FunctionBody": "Enter function body here..."
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.CategoryData",
"m_ObjectId": "ffe04c9a01f04f7698bbbeb5c6b2f37d",
"m_Name": "",
"m_ChildObjectList": [
{
"m_Id": "3eea43880af6878e8f39c9b818465c6e"
},
{
"m_Id": "e8febd9393f60b8ca723ec06111edb24"
},
{
"m_Id": "83a09f85ae0fdc85a8cee46af63bf184"
}
]
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 1b0eafcb4ede63a4a9bd5a34e934c420
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,158 @@
void Hash_Tchou_3_3_uint(uint3 v, out uint3 o)
{
// 16 alu (3 mul)
v.y ^= v.x + v.z; // 2 issue: v.x + v.z == v.y --- result is always zero in this plane
v.y = v.y * 134775813; // 1 (1 mul)
v.z += v.x ^ v.y; // 2
v.y += v.x ^ v.z; // 2
v.x += v.y * v.z; // 2 (1 mul)
v.x = v.x * 0x27d4eb2du; // 1 (1 mul)
v.x ^= v.x << 16; // 2
v.z ^= v.x << 3; // 2
v.y += v.z << 3; // 2
o = v;
}
void Hash_Tchou_3_3_float(float3 i, out float3 o)
{
uint3 r, v = (uint3) (int3) round(i);
Hash_Tchou_3_3_uint(v, r);
o = r * (1.0 / float(0xffffffff));
}
void Hash_Tchou_2_1_uint(uint2 v, out uint o)
{
v.y ^= 1103515245U; // 1
v.x *= v.y; // 1 mul
v.x ^= v.x >> 3u; // 2
v.x *= 0x27d4eb2du; // 1 mul
v.x ^= v.x >> 15u; // 2
o = v.x;
}
void Hash_Tchou_2_1_float(float2 i, out float o)
{
uint r;
uint2 v = (uint2) (int2) round(i);
Hash_Tchou_2_1_uint(v, r);
o = r * (1.0 / float(0xffffffff));
}
void Hash_Tchou_2_1_half(half2 i, out half o)
{
uint r;
uint2 v = (uint2) (int2) round(i);
Hash_Tchou_2_1_uint(v, r);
o = r * (1.0 / float(0xffffffff));
}
void Hash_Tchou_2_3_uint(uint2 q, out uint3 o)
{
// 13 ALU (3 mul)
uint3 v = uint3(q, q.x ^ q.y); // TODO can we do without this?
v.x *= v.y * v.z; // 2 (1 mul)
v.x *= 0x27d4eb2du; // 1 (1 mul)
v.x ^= v.x >> 4u; // 2
v.y += v.z ^ v.x; // 2
v.y ^= v.y >> 15u; // 2
v.y *= 0x27d4eb2du; // 1 (1 mul)
v.z += v.x ^ v.y; // 2
v.x += v.z; // 1
o = v;
}
void Hash_Tchou_2_3_float(float2 i, out float3 o)
{
uint3 r;
uint2 v = (uint2) (int2) round(i);
Hash_Tchou_2_3_uint(v, r);
o = r * (1.0 / float(0xffffffff));
}
void Hash_PCG_3_3_uint(uint3 v, out uint3 o)
{
// 16 alu (7 mul)
v = v * 1664525u + 1013904223u; // LCG (numerical recipes)
v.x += v.y*v.z;
v.y += v.z*v.x;
v.z += v.x*v.y;
v ^= v >> 16u;
v.x += v.y*v.z;
v.y += v.z*v.x;
v.z += v.x*v.y;
o = v;
}
void Hash_PCG_2_3_uint(uint2 v, out uint3 o)
{
Hash_PCG_3_3_uint(uint3(v, v.x ^ v.y), o);
}
void Hash_PCG_3_3_float(float3 i, out float3 o)
{
uint3 r, v = (uint3) (int3) round(i);
Hash_PCG_3_3_uint(v, r);
o = r * (1.0 / float(0xffffffff));
}
void Hash_PCG_2_3_float(float2 i, out float3 o)
{
uint2 v = (uint2) (int2) round(i);
uint3 r;
Hash_PCG_2_3_uint(v, r);
o = r * (1.0 / float(0xffffffff));
}
void Hash_LegacySine_2_1_float(float2 i, out float o)
{
float angle = dot(i, float2(12.9898, 78.233));
#if defined(SHADER_API_MOBILE) && (defined(SHADER_API_GLES) || defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN))
// 'sin()' has bad precision on Mali GPUs for inputs > 10000
angle = fmod(angle, TWO_PI); // Avoid large inputs to sin()
#endif
o = frac(sin(angle)*43758.5453);
}
void Hash_LegacySine_2_1_half(half2 i, out half o)
{
half angle = dot(i, half2(12.9898, 78.233));
#if defined(SHADER_API_MOBILE) && (defined(SHADER_API_GLES) || defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN))
// 'sin()' has bad precision on Mali GPUs for inputs > 10000
angle = fmod(angle, TWO_PI); // Avoid large inputs to sin()
#endif
o = frac(sin(angle)*43758.5453);
}
void Hash_BetterSine_2_1_float(float2 i, out float o)
{
float angle = dot(i, float2(12.9898, 78.233) / 1000.0f);
#if defined(SHADER_API_MOBILE) && (defined(SHADER_API_GLES) || defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN))
// 'sin()' has bad precision on Mali GPUs for inputs > 10000
angle = fmod(angle, TWO_PI); // Avoid large inputs to sin()
#endif
o = frac(sin(angle)*43758.5453);
}
void Hash_BetterSine_2_1_half(half2 i, out half o)
{
float angle = dot(i, half2(12.9898, 78.233) / 1000.0f);
#if defined(SHADER_API_MOBILE) && (defined(SHADER_API_GLES) || defined(SHADER_API_GLES3) || defined(SHADER_API_VULKAN))
// 'sin()' has bad precision on Mali GPUs for inputs > 10000
angle = fmod(angle, TWO_PI); // Avoid large inputs to sin()
#endif
o = frac(sin(angle)*43758.5453);
}
void Hash_LegacySine_2_2_float(float2 i, out float2 o)
{
float2x2 m = float2x2(15.27, 47.63, 99.41, 89.98);
o = frac(sin(mul(i, m)));
}
void Hash_LegacySine_2_2_half(half2 i, out half2 o)
{
half2x2 m = half2x2(15.27, 47.63, 99.41, 89.98);
o = frac(sin(mul(i, m)));
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e7257ce6f0bb79b4e8d1d6c14ae3610c
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: d5801faf9d6798d4a8499851bbf3e156
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: ad899d50c85fa394b94a02a0ebd470bb
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 10df88abe2711df47b0293cf7c1cf86a
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 66175d8de092f174e9d7b7f22c0cdea3
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: e8d16f3d043e6c6418d9bd187538d765
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2d4088fe74723844aa363f7a22f3f0f2
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: d7b0d2961bca5ed47ae572358cd4b6b5
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 54a53ae4fb0ae2940a1651cc84a0f48f
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 7e1956b6ca120774ab6decf5cdef1c1a
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: cfa581a550b53284bb1a9828d8a0aad7
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 3a3e889009ac53f4097c06b073a5a29a
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,423 @@
// UV coordinates for the three corners of a triangle (r,g,b)
struct TriangleUV
{
float2 r;
float2 g;
float2 b;
};
// float4 value, sampled from each of the three corners of a triangle (r,g,b)
struct TriangleFloat4
{
float4 r, g, b;
};
//
struct TrianglePoint
{
TriangleUV vertexCoords; // triangle vertices (in UV space)
float3 weights; // barycentric weights (relative to the vertices)
};
TrianglePoint GetGridTriangle(float2 uv)
{
// this function assumes your UV space is tessellated into triangles
// in a unit-square tiling pattern like so:
//
// uv (0, 1) uv (1, 1)
// c _____________ d
// |\ |
// | \ |
// | \ |
// | \ |
// | \ |
// | \ |
// |____________\|
// a b
// uv (0, 0) uv (1, 0)
//
// this function determines the triangle to which the uv point belongs
//
// and returns the integer uv coordinates of the triangle vertices in Rcoord/Gcoord/Bcoord
// as well as the barycentric coordinate weights of the uv point, in RGBweights
//
// this method ensures that RGBweights is continuous in UV space
// and that coords returned are constant except when the corresponding weight is zero
// in order to do so, it assigns RGB to vertices in a 3 tile repeating pattern
// The pattern is organized like so (each tile numbered with tile type):
//
// : : : : :
// B---G---B---R---G ...
// | 1 | 2 | 0 | 1 |
// G---B---R---G---B ...
// | 2 | 0 | 1 | 2 |
// B---R---G---B---R ...
// | 0 | 1 | 2 | 0 |
// R---G---B---R---G ...
// (0,0)
//
float2 f = frac(uv); // subtile / local uv coordinates in [0,1]
float2 a = floor(uv); // coord of vertex 'a' in the tile
float diag = (f.x + f.y) - 1.0f; // [-1, 1] diagonal ramp from uv (0,0) to (1,1)
float triFlip = 0.0f; // lower triangle
if (diag > 0.0f)
{
f = 1.0f - f.yx; // in upper triangle, b and c weights are swapped and inverted
triFlip = 1.0f; // upper triangle
}
float3 w = float3(abs(diag), f.xy); // vertex weights in abc(lower) or dbc(upper) order
// tile type (mod 3) determines how to permute RGB vertex assignments around
float tileType = a.x - a.y;
// calculate permutation matrix
float3 p = step((2.0f / 3.0f), frac((float3(0.0f, 1.0f, 2.0f) + tileType) * (1.0f / 3.0f) + (0.5f / 3.0f)));
float3 pFlip = p * triFlip;
// type p pFlip
// 0 [0, 0, 1] [0, 0, f]
// 1 [0, 1, 0] [0, f, 0]
// 2 [1, 0, 0] [f, 0, 0]
TrianglePoint tri;
tri.vertexCoords.r = a + pFlip.zz + p.xy;
tri.vertexCoords.g = a + pFlip.yy + p.zx;
tri.vertexCoords.b = a + pFlip.xx + p.yz;
// permute weights via matrix multiply
tri.weights.r = dot(p.zxy, w.xyz);
tri.weights.g = dot(p.yzx, w.xyz);
tri.weights.b = dot(p.xyz, w.xyz);
/*
// more understandable permutation (maybe faster?)
tileType = round(mod(tileType, 3.0f));
if (tileType == 0.0f)
{
rgbWeights = w.xyz;
rCoord = triFlip.xx; // a or d
gCoord = vec2(1.0f, 0.0f); // b
bCoord = vec2(0.0f, 1.0f); // c
}
else if (tileType == 1.0f)
{
rgbWeights = w.yzx;
rCoord = vec2(0.0f, 1.0f); // c
gCoord = triFlip.xx; // a or d
bCoord = vec2(1.0f, 0.0f); // b
}
else // (tileType == 2.0f)
{
rgbWeights = w.zxy;
rCoord = vec2(1.0f, 0.0f); // b
gCoord = vec2(0.0f, 1.0f); // c
bCoord = triFlip.xx; // a or d
}
rCoord = Rcoord + a;
gCoord = Gcoord + a;
bCoord = Bcoord + a;
*/
return tri;
}
void GetGridTriangle_float(float2 uv, out float2 uvR, out float2 uvG, out float2 uvB, out float3 weights)
{
TrianglePoint p = GetGridTriangle(uv);
uvR = p.vertexCoords.r;
uvG = p.vertexCoords.g;
uvB = p.vertexCoords.b;
weights = p.weights;
}
void GetGridTriangle_half(half2 uv, out half2 uvR, out half2 uvG, out half2 uvB, out half3 weights)
{
TrianglePoint p = GetGridTriangle(uv);
uvR = p.vertexCoords.r;
uvG = p.vertexCoords.g;
uvB = p.vertexCoords.b;
weights = p.weights;
}
float2 UVToHexGridUV(float2 uv, float hexSize)
{
// sqrt32 is the height (altitude) of an equilateral triangle with side length 1.0
float sqrt32 = sqrt(3.0f) / 2.0f;
float2 hexUV;
hexUV.y = uv.y * (1.0f / sqrt32);
hexUV.x = uv.x - uv.y * (0.5f / sqrt32);
hexUV /= hexSize;
return hexUV;
}
float2 HexGridUVToUV(float2 uv, float hexSize)
{
// sqrt32 is the height (altitude) of an equilateral triangle with side length 1.0
float sqrt32 = sqrt(3.0f) / 2.0f;
uv *= hexSize;
uv.x += uv.y * 0.5f;
uv.y *= sqrt32;
return uv;
}
TriangleUV TriangleHexGridUVsToUV(TriangleUV uv, float hexSize)
{
// sqrt32 is the height (altitude) of an equilateral triangle with side length 1.0
float sqrt32 = sqrt(3.0f) / 2.0f;
uv.r *= hexSize;
uv.g *= hexSize;
uv.b *= hexSize;
uv.r.x += uv.r.y * 0.5f;
uv.g.x += uv.g.y * 0.5f;
uv.b.x += uv.b.y * 0.5f;
uv.r.y *= sqrt32;
uv.g.y *= sqrt32;
uv.b.y *= sqrt32;
return uv;
}
TrianglePoint GetHexGridTriangle(float2 uv, float hexSize, bool returnHexGridUVs)
{
// this is the same as the above function, but for a regular hexagonal grid
// all it does is convert the uv space to a tiled hexagon space UV, then call the function above
// this transform places hexagon centers at integer coordinates by skewing the UV space
float2 hexUV = UVToHexGridUV(uv, hexSize);
TrianglePoint tri = GetGridTriangle(hexUV);
// default coords are unique integer coords (from the skewed triangle space)
// this will correct them to return original uv space coords
if (!returnHexGridUVs)
{
tri.vertexCoords = TriangleHexGridUVsToUV(tri.vertexCoords, hexSize);
}
return tri;
}
void GetHexGridTriangle_float(float2 uv, float hexSize, bool returnHexGridUVs, out float2 uvR, out float2 uvG, out float2 uvB, out float3 weights)
{
TrianglePoint p = GetHexGridTriangle(uv, hexSize, returnHexGridUVs);
uvR = p.vertexCoords.r;
uvG = p.vertexCoords.g;
uvB = p.vertexCoords.b;
weights = p.weights;
}
void GetHexGridTriangle_half(half2 uv, float hexSize, bool returnHexGridUVs, out half2 uvR, out half2 uvG, out half2 uvB, out half3 weights)
{
TrianglePoint p = GetHexGridTriangle(uv, hexSize, returnHexGridUVs);
uvR = p.vertexCoords.r;
uvG = p.vertexCoords.g;
uvB = p.vertexCoords.b;
weights = p.weights;
}
float3 BlumBlumShub3(float3 v)
{
return frac(v * v * 251.0f); // *v * 251.0f);
}
// optimized for good random results when sampled on an integer grid
float3 GridRandom3(float2 p)
{
float3 q = float3(
dot(p, float2(0.894549f, 0.293639f)),
dot(p, float2(0.442711f, -0.703029f)),
dot(p, float2(0.335439f, 0.735791f)));
q = frac(q);
q += q.yzx * q.zxy;
q = frac(q * 251.419329184f);
// additional randomization, if necessary for extremely large grids
// q = BlumBlumShub3(q);
return q;
}
void GridRandom3_float(float2 p, out float3 random3)
{
random3 = GridRandom3(p);
}
float ApplyDetailContrast(float weight, float detail, float detailContrast)
{
float result = max(0.01f * weight, detailContrast * (weight + detail) + 1.0f - (detail + detailContrast));
return result;
}
float2 RandomTransformProjectedUV(float3 worldPosition, float2 hashCoord, float3 projDirection)
{
float2 worldXZ = worldPosition.xz;
// if we assume worldXZ is correct, and projDirection is the normal, we can approximate world position
float worldY = -worldXZ.x * projDirection.x / projDirection.y +
-worldXZ.y * projDirection.z / projDirection.y;
float3 worldPos = float3(worldXZ.x, worldY, worldXZ.y);
float3 hash = GridRandom3(hashCoord);
// random rotation
float2 rot = float2(1.0f, 0.0f);
// construct projection matrix
float3 projF = normalize(projDirection); // projection direction
float3 projU = normalize(cross(projF, float3(rot.x, 0.0f, rot.y))); // U direction is defined by rotation
float3 projV = cross(projU, projF); // V direction (don't have to normalize)
float scale = lerp(0.8f, 1.2f, hash.z);
float2 uv;
uv.x = dot(projU, worldPos) * scale;
uv.y = dot(projV, worldPos) * scale;
// randomize uv offset
uv += hash.xy * 10.0f;
return uv;
}
void RandomTransformProjectedUV_float(float3 worldPosition, float2 hashCoord, float3 projDirection, out float2 outUV)
{
outUV = RandomTransformProjectedUV(worldPosition, hashCoord, projDirection);
}
void RandomTransformProjectedUV_half(half3 worldPosition, half2 hashCoord, half3 projDirection, out half2 outUV)
{
outUV = RandomTransformProjectedUV(worldPosition, hashCoord, projDirection);
}
// random3 should be random numbers between 0 and 1, used to drive the transform
// the values should remain constant in areas where you wish to have the same random transform
float2 RandomScaleOffsetUV(float2 uv, float scaleMin, float scaleMax, float3 random3)
{
// randomize scale
float scale = lerp(scaleMin, scaleMax, random3.z);
uv *= scale;
// randomize uv offset
uv += random3.xy;
return uv;
}
void RandomScaleOffsetUV_float(float2 uv, float2 scaleRange, float3 random3, out float2 outUV)
{
outUV = RandomScaleOffsetUV(uv, scaleRange.x, scaleRange.y, random3);
}
// random3 should be random numbers between 0 and 1, used to drive the transform
// the values should remain constant in areas where you wish to have the same random transform
float2 RandomScaleOffsetRotateUV(float2 uv, float scaleMin, float scaleMax, float rotationMinDegreees, float rotationMaxDegrees, float3 random3)
{
// randomize scale
float scale = lerp(scaleMin, scaleMax, random3.z);
// randomize uv rotation
random3.z = frac(random3.z * 16.0f); // TODO: generate another random number (here we're just using the low bits of random3.z, so it's somewhat correlated with scale)
float degrees = lerp(rotationMinDegreees, rotationMaxDegrees, random3.z);
float radians = degrees * (2.0f * 3.14159265f) / 360.0f;
float rx = cos(radians) * scale;
float ry = sin(radians) * scale;
float2 rot = float2(rx, ry);
uv = float2(dot(uv, rot), dot(uv, float2(-rot.y, rot.x)));
// randomize uv offset
uv += random3.xy;
return uv;
}
void RandomScaleOffsetRotateUV_float(float2 uv, float2 scaleRange, float2 rotationRangeDegrees, float3 random3, out float2 outUV)
{
outUV = RandomScaleOffsetRotateUV(uv, scaleRange.x, scaleRange.y, rotationRangeDegrees.x, rotationRangeDegrees.y, random3);
}
TriangleFloat4 SampleTriangleTextures(TEXTURE2D_PARAM(textureName, samplerName), TriangleUV uv)
{
TriangleFloat4 result;
result.r = SAMPLE_TEXTURE2D(textureName, samplerName, uv.r);
result.g = SAMPLE_TEXTURE2D(textureName, samplerName, uv.g);
result.b = SAMPLE_TEXTURE2D(textureName, samplerName, uv.b);
return result;
}
float4 BlendWithTriangleWeights(float3 triWeights, TriangleFloat4 values)
{
return (triWeights.r * values.r +
triWeights.g * values.g +
triWeights.b * values.b);
}
float4 SelectNearestVertexValue(float3 triWeights, TriangleFloat4 values)
{
triWeights = pow(triWeights, 40.0f);
triWeights = triWeights / dot(triWeights, float3(1.0f, 1.0f, 1.0f));
return BlendWithTriangleWeights(triWeights, values);
}
TriangleUV TriangleCoordsToUV(TriangleUV triCoords, float4 coordToUVScaleOffset)
{
TriangleUV uv;
uv.r = triCoords.r * coordToUVScaleOffset.xy + coordToUVScaleOffset.zw;
uv.g = triCoords.g * coordToUVScaleOffset.xy + coordToUVScaleOffset.zw;
uv.b = triCoords.b * coordToUVScaleOffset.xy + coordToUVScaleOffset.zw;
return uv;
}
float4 SampleTextureRandomizedHexGrid(TEXTURE2D_PARAM(textureName, samplerName), float2 uv, float hexSize, float edgeContrast)
{
// we want UVs in hexGrid UV space, as they are integer and more stable as hash random seeds
TrianglePoint tri = GetHexGridTriangle(uv, hexSize, true);
// randomize transform at each vertex (identified by coord)
TriangleUV triUV;
triUV.r = RandomScaleOffsetUV(uv, 0.8f, 1.2f, GridRandom3(tri.vertexCoords.r));
triUV.g = RandomScaleOffsetUV(uv, 0.8f, 1.2f, GridRandom3(tri.vertexCoords.g));
triUV.b = RandomScaleOffsetUV(uv, 0.8f, 1.2f, GridRandom3(tri.vertexCoords.b));
// (optional) contrast enhance the blend -- should ideally turn this off at distance to avoid aliasing
tri.weights = pow(tri.weights, edgeContrast);
// normalize weights. Not necessary if detail texture and contrast enhance are disabled.
tri.weights = tri.weights / dot(tri.weights, 1.0f);
// sample material for each triangle corner
TriangleFloat4 triValues = SampleTriangleTextures(TEXTURE2D_ARGS(textureName, samplerName), triUV);
// blend the material samples based on the weights
float4 result = BlendWithTriangleWeights(tri.weights, triValues);
return result;
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5d933689cc9357c409e6fd213c05c330
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 645cb67d4ee7bb045ba21ff0572bc0ba
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: a0207129b6dee0942890a69406252dee
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 5036b43125cb15748a07e3e63eabc9f9
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 671b6efa728df2e45aee86abcda6ea0d
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 86be371b521b28944bd459719092a487
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 83125cb207ddd9f4fb34608388f1c37b
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: c7475368deaf11041afa7d68416d20bf
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 98a93f817dde18f448addd8192566ebe
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: bacfacfac3ab7564fae3291fd01d665c
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: a1c7cbf6ad550224eac543789f5af94d
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2998cd83066949c488a74c64671cbdfe
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 057d9767d3d5f0f47b180e312044b2a3
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 0f389d201b7756242a7466e69e173f96
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: a756e4ed44bca8b41aa2c5aba5ce354b
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 7fce60cc7d5b7754fa316fc20e055722
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 81cbf1b78401b6543af6f7ce3461df32
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4ce8f05f2887fde4eb632b2b135b3427
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: a7fde0b1bc6aa924b97c6e633ce82cad
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: f120f0973abddcc4ba564a35dbacfa16
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: c1a894fb19736964eb4a67e503e2d669
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}