diff --git a/Assets/VoxelProjectSeries/Data.meta b/Assets/VoxelProjectSeries/Data.meta index 8e39a89..77f4e46 100644 --- a/Assets/VoxelProjectSeries/Data.meta +++ b/Assets/VoxelProjectSeries/Data.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6b9e7d241ee864a4abb1053544f45744 +guid: ada79e4b6e36a61459c6d955e7e501a6 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/VoxelProjectSeries/Data/Container.cs b/Assets/VoxelProjectSeries/Data/Container.cs index 3d8891e..1c7535f 100644 --- a/Assets/VoxelProjectSeries/Data/Container.cs +++ b/Assets/VoxelProjectSeries/Data/Container.cs @@ -3,7 +3,7 @@ using Unity.Mathematics; using UnityEngine; -namespace PixelReyn.VoxelSeries.Part2 +namespace PixelReyn.VoxelSeries.Part3 { [RequireComponent(typeof(MeshFilter))] @@ -33,13 +33,6 @@ public void ClearData() data.Clear(); } - private void ConfigureComponents() - { - meshFilter = GetComponent(); - meshRenderer = GetComponent(); - meshCollider = GetComponent(); - } - public void GenerateMesh() { meshData.ClearData(); @@ -51,17 +44,27 @@ public void GenerateMesh() Vector3[] faceVertices = new Vector3[4]; Vector2[] faceUVs = new Vector2[4]; + VoxelColor voxelColor; + Color voxelColorAlpha; + Vector2 voxelSmoothness; + foreach (KeyValuePair kvp in data) { + //Only check on solid blocks if (!kvp.Value.isSolid) continue; blockPos = kvp.Key; block = kvp.Value; + voxelColor = WorldManager.Instance.WorldColors[block.ID - 1]; + voxelColorAlpha = voxelColor.color; + voxelColorAlpha.a = 1; + voxelSmoothness = new Vector2(voxelColor.metallic, voxelColor.smoothness); //Iterate over each face direction for (int i = 0; i < 6; i++) { + //Check if there's a solid block against this face if (this[blockPos + voxelFaceChecks[i]].isSolid) continue; @@ -78,13 +81,19 @@ public void GenerateMesh() { meshData.vertices.Add(faceVertices[voxelTris[i, j]]); meshData.UVs.Add(faceUVs[voxelTris[i, j]]); + meshData.colors.Add(voxelColorAlpha); + meshData.UVs2.Add(voxelSmoothness); meshData.triangles.Add(counter++); + } } + } } + + public void UploadMesh() { meshData.UploadMesh(); @@ -93,10 +102,15 @@ public void UploadMesh() ConfigureComponents(); meshFilter.mesh = meshData.mesh; - if (meshData.vertices.Count > 3) meshCollider.sharedMesh = meshData.mesh; + } + private void ConfigureComponents() + { + meshFilter = GetComponent(); + meshRenderer = GetComponent(); + meshCollider = GetComponent(); } public Voxel this[Vector3 index] @@ -128,7 +142,8 @@ public struct MeshData public List vertices; public List triangles; public List UVs; - + public List UVs2; + public List colors; public bool Initialized; public void ClearData() @@ -138,6 +153,8 @@ public void ClearData() vertices = new List(); triangles = new List(); UVs = new List(); + UVs2 = new List(); + colors = new List(); Initialized = true; mesh = new Mesh(); @@ -147,17 +164,20 @@ public void ClearData() vertices.Clear(); triangles.Clear(); UVs.Clear(); + UVs2.Clear(); + colors.Clear(); mesh.Clear(); } } - public void UploadMesh(bool sharedVertices = false) { mesh.SetVertices(vertices); mesh.SetTriangles(triangles, 0, false); + mesh.SetColors(colors); mesh.SetUVs(0, UVs); + mesh.SetUVs(2, UVs2); mesh.Optimize(); @@ -170,9 +190,7 @@ public void UploadMesh(bool sharedVertices = false) } #endregion - - #region Voxel Statics - + #region Static Variables static readonly Vector3[] voxelVertices = new Vector3[8] { new Vector3(0,0,0),//0 @@ -185,6 +203,7 @@ public void UploadMesh(bool sharedVertices = false) new Vector3(0,1,1),//6 new Vector3(1,1,1),//7 }; + static readonly Vector3[] voxelFaceChecks = new Vector3[6] { new Vector3(0,0,-1),//back @@ -222,7 +241,7 @@ public void UploadMesh(bool sharedVertices = false) {0,1,2,1,3,2}, {0,2,3,0,3,1}, }; - #endregion } + } \ No newline at end of file diff --git a/Assets/VoxelProjectSeries/Data/Container.cs.meta b/Assets/VoxelProjectSeries/Data/Container.cs.meta index 714713e..423b4ad 100644 --- a/Assets/VoxelProjectSeries/Data/Container.cs.meta +++ b/Assets/VoxelProjectSeries/Data/Container.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 566e7a097454e3f4f997b29cc0b50209 +guid: 219f2feeae69489439241ebd6a30961b MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/VoxelProjectSeries/Data/Voxel.cs b/Assets/VoxelProjectSeries/Data/Voxel.cs index 7f48680..fbb3001 100644 --- a/Assets/VoxelProjectSeries/Data/Voxel.cs +++ b/Assets/VoxelProjectSeries/Data/Voxel.cs @@ -1,11 +1,10 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -namespace PixelReyn.VoxelSeries.Part2 +namespace PixelReyn.VoxelSeries.Part3 { public struct Voxel { - //Convert to single float and access via accessors... public byte ID; public bool isSolid diff --git a/Assets/VoxelProjectSeries/Data/Voxel.cs.meta b/Assets/VoxelProjectSeries/Data/Voxel.cs.meta index c0755e5..5b61c9b 100644 --- a/Assets/VoxelProjectSeries/Data/Voxel.cs.meta +++ b/Assets/VoxelProjectSeries/Data/Voxel.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 77246b96a654cbd44aee5bca1c1d6024 +guid: 05bb20fe90fec854e8b63e1e4f7fa7e6 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/VoxelProjectSeries/Data/VoxelColor.cs b/Assets/VoxelProjectSeries/Data/VoxelColor.cs new file mode 100644 index 0000000..3615cda --- /dev/null +++ b/Assets/VoxelProjectSeries/Data/VoxelColor.cs @@ -0,0 +1,14 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace PixelReyn.VoxelSeries.Part3 +{ + [System.Serializable] + public class VoxelColor + { + public Color color; + public float metallic; + public float smoothness; + } +} \ No newline at end of file diff --git a/Assets/VoxelProjectSeries/Data/VoxelColor.cs.meta b/Assets/VoxelProjectSeries/Data/VoxelColor.cs.meta new file mode 100644 index 0000000..5abb735 --- /dev/null +++ b/Assets/VoxelProjectSeries/Data/VoxelColor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 21531c8a289767248b0b245d5a852f9f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VoxelProjectSeries/Managers.meta b/Assets/VoxelProjectSeries/Managers.meta index 6f4b8ef..00db1b7 100644 --- a/Assets/VoxelProjectSeries/Managers.meta +++ b/Assets/VoxelProjectSeries/Managers.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7cd07b6081705c94080f75c1be172a4c +guid: 1fca3603f517d904cac351c32f674b1f folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/VoxelProjectSeries/Managers/WorldManager.cs b/Assets/VoxelProjectSeries/Managers/WorldManager.cs index b943738..681a82a 100644 --- a/Assets/VoxelProjectSeries/Managers/WorldManager.cs +++ b/Assets/VoxelProjectSeries/Managers/WorldManager.cs @@ -2,18 +2,26 @@ using System.Collections.Generic; using UnityEngine; -namespace PixelReyn.VoxelSeries.Part2 +namespace PixelReyn.VoxelSeries.Part3 { public class WorldManager : MonoBehaviour { public Material worldMaterial; - + public VoxelColor[] WorldColors; private Container container; - - // Start is called before the first frame update void Start() { + if(_instance != null) + { + if (_instance != this) + Destroy(this); + } + else + { + _instance = this; + } + GameObject cont = new GameObject("Container"); cont.transform.parent = transform; container = cont.AddComponent(); @@ -31,16 +39,20 @@ void Start() } } - container.GenerateMesh(); container.UploadMesh(); } - // Update is called once per frame - void Update() - { + private static WorldManager _instance; + public static WorldManager Instance + { + get + { + if (_instance == null) + _instance = FindObjectOfType(); + return _instance; + } } - } } \ No newline at end of file diff --git a/Assets/VoxelProjectSeries/Managers/WorldManager.cs.meta b/Assets/VoxelProjectSeries/Managers/WorldManager.cs.meta index 44adf1b..b3c809e 100644 --- a/Assets/VoxelProjectSeries/Managers/WorldManager.cs.meta +++ b/Assets/VoxelProjectSeries/Managers/WorldManager.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 35997360c8b74f543b623a3524b58bc9 +guid: e0e65ef4e51bde8429033f2ff79c2aa4 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/VoxelProjectSeries/Scenes.meta b/Assets/VoxelProjectSeries/Scenes.meta index 1815672..b283f5a 100644 --- a/Assets/VoxelProjectSeries/Scenes.meta +++ b/Assets/VoxelProjectSeries/Scenes.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f2b6f7de0d300be4d9664d00dd95b496 +guid: 05b7f521627baab4fb116ca03831fcd2 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/VoxelProjectSeries/Scenes/World.unity b/Assets/VoxelProjectSeries/Scenes/World.unity index 3ae7c15..05616d9 100644 --- a/Assets/VoxelProjectSeries/Scenes/World.unity +++ b/Assets/VoxelProjectSeries/Scenes/World.unity @@ -363,7 +363,11 @@ MonoBehaviour: m_GameObject: {fileID: 1755072223} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 35997360c8b74f543b623a3524b58bc9, type: 3} + m_Script: {fileID: 11500000, guid: e0e65ef4e51bde8429033f2ff79c2aa4, type: 3} m_Name: m_EditorClassIdentifier: - worldMaterial: {fileID: 2100000, guid: 4021f579d8ff00b4ca1a8c7d355362b3, type: 2} + worldMaterial: {fileID: 2100000, guid: d41578d92bc26b04bb2355aed476d2cb, type: 2} + WorldColors: + - color: {r: 0, g: 0.4834163, b: 0.9811321, a: 0} + metallic: 0.5 + smoothness: 1 diff --git a/Assets/VoxelProjectSeries/Scenes/World.unity.meta b/Assets/VoxelProjectSeries/Scenes/World.unity.meta index e1d7a7a..80c8ab5 100644 --- a/Assets/VoxelProjectSeries/Scenes/World.unity.meta +++ b/Assets/VoxelProjectSeries/Scenes/World.unity.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2eb08ffdbff9f8a44ba02b325147760b +guid: 585e920a0ed93f64e8b93df655b05926 DefaultImporter: externalObjects: {} userData: diff --git a/Assets/VoxelProjectSeries/Shaders.meta b/Assets/VoxelProjectSeries/Shaders.meta new file mode 100644 index 0000000..6e39f38 --- /dev/null +++ b/Assets/VoxelProjectSeries/Shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4ec40e0bfdb1d7a4b825bbc3cc19117d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VoxelProjectSeries/Shaders/VoxelVertexColor.shadergraph b/Assets/VoxelProjectSeries/Shaders/VoxelVertexColor.shadergraph new file mode 100644 index 0000000..823b321 --- /dev/null +++ b/Assets/VoxelProjectSeries/Shaders/VoxelVertexColor.shadergraph @@ -0,0 +1,957 @@ +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.GraphData", + "m_ObjectId": "1b0a381bf4fa4081a20a7ed1f9d1ca72", + "m_Properties": [], + "m_Keywords": [], + "m_Dropdowns": [], + "m_CategoryData": [ + { + "m_Id": "8b38983899c44dbd89c0fe57eb158af3" + } + ], + "m_Nodes": [ + { + "m_Id": "810a7815a872476882906d948c2e0606" + }, + { + "m_Id": "303512db22744a60b627d447a6ddc029" + }, + { + "m_Id": "01774734bb984ba98b1c39057d8f9564" + }, + { + "m_Id": "cc77c592a30f45d3a4bb1240d8a9fc3c" + }, + { + "m_Id": "cf5c4cf290274cada9ec45e23090c4e5" + }, + { + "m_Id": "c77967e96bf041ffbcf5427d794bf709" + }, + { + "m_Id": "3ec34c42fef047d4b986adc312717dd4" + }, + { + "m_Id": "a90d7d6eb6c84f62b3da90b48e88fd11" + }, + { + "m_Id": "2b96952f83264bb09bf44262260a635f" + }, + { + "m_Id": "4d6b732b2bc04aaaa42a8e4268741624" + }, + { + "m_Id": "c82f0b5effc542b297ab67f2cd8de7dc" + }, + { + "m_Id": "b84a7d4a2af64ef291c95a588b74578b" + } + ], + "m_GroupDatas": [], + "m_StickyNoteDatas": [], + "m_Edges": [ + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "4d6b732b2bc04aaaa42a8e4268741624" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "cc77c592a30f45d3a4bb1240d8a9fc3c" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "b84a7d4a2af64ef291c95a588b74578b" + }, + "m_SlotId": 1 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "c77967e96bf041ffbcf5427d794bf709" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "b84a7d4a2af64ef291c95a588b74578b" + }, + "m_SlotId": 2 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "3ec34c42fef047d4b986adc312717dd4" + }, + "m_SlotId": 0 + } + }, + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "c82f0b5effc542b297ab67f2cd8de7dc" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "b84a7d4a2af64ef291c95a588b74578b" + }, + "m_SlotId": 0 + } + } + ], + "m_VertexContext": { + "m_Position": { + "x": 0.0, + "y": 0.0 + }, + "m_Blocks": [ + { + "m_Id": "810a7815a872476882906d948c2e0606" + }, + { + "m_Id": "303512db22744a60b627d447a6ddc029" + }, + { + "m_Id": "01774734bb984ba98b1c39057d8f9564" + } + ] + }, + "m_FragmentContext": { + "m_Position": { + "x": 0.0, + "y": 200.0 + }, + "m_Blocks": [ + { + "m_Id": "cc77c592a30f45d3a4bb1240d8a9fc3c" + }, + { + "m_Id": "cf5c4cf290274cada9ec45e23090c4e5" + }, + { + "m_Id": "c77967e96bf041ffbcf5427d794bf709" + }, + { + "m_Id": "3ec34c42fef047d4b986adc312717dd4" + }, + { + "m_Id": "a90d7d6eb6c84f62b3da90b48e88fd11" + }, + { + "m_Id": "2b96952f83264bb09bf44262260a635f" + } + ] + }, + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "preventRotation": false + }, + "m_Path": "Shader Graphs", + "m_GraphPrecision": 1, + "m_PreviewMode": 2, + "m_OutputNode": { + "m_Id": "" + }, + "m_ActiveTargets": [ + { + "m_Id": "311a7730ba104a3db9b51b2784624093" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "01774734bb984ba98b1c39057d8f9564", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Tangent", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "3f539d3af8ef44428196b52c62dfd3fb" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Tangent" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "10b1ed513b95498a8b6ea7899d25a5d4", + "m_Id": 0, + "m_DisplayName": "Normal", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Normal", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "28bd759b914843ce9e62cb7ff6114ba6", + "m_Id": 4, + "m_DisplayName": "A", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "A", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "2b96952f83264bb09bf44262260a635f", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Occlusion", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "a41ac7ee834644eea3794299cc59d245" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Occlusion" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "303512db22744a60b627d447a6ddc029", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Normal", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "10b1ed513b95498a8b6ea7899d25a5d4" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Normal" +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget", + "m_ObjectId": "311a7730ba104a3db9b51b2784624093", + "m_ActiveSubTarget": { + "m_Id": "d8ca8037d99d467d96e37fe41dc5b0db" + }, + "m_AllowMaterialOverride": false, + "m_SurfaceType": 0, + "m_ZTestMode": 4, + "m_ZWriteControl": 0, + "m_AlphaMode": 0, + "m_RenderFace": 2, + "m_AlphaClip": false, + "m_CastShadows": true, + "m_ReceiveShadows": true, + "m_CustomEditorGUI": "", + "m_SupportVFX": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "33812e4c68ed44b1b08882d80329f0a5", + "m_Id": 2, + "m_DisplayName": "G", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "G", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "371ad3bd40ee43908680f316a487adef", + "m_Id": 0, + "m_DisplayName": "Normal (Tangent Space)", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "NormalTS", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 3 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "3ec34c42fef047d4b986adc312717dd4", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Smoothness", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "a0c6d066cb48432e89f8c86600a7db5f" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Smoothness" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot", + "m_ObjectId": "3f539d3af8ef44428196b52c62dfd3fb", + "m_Id": 0, + "m_DisplayName": "Tangent", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Tangent", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot", + "m_ObjectId": "43b5f2d482254001b0b200f13625cdb9", + "m_Id": 0, + "m_DisplayName": "In", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "In", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.VertexColorNode", + "m_ObjectId": "4d6b732b2bc04aaaa42a8e4268741624", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Vertex Color", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -815.9999389648438, + "y": 53.99998474121094, + "width": 118.0, + "height": 94.0 + } + }, + "m_Slots": [ + { + "m_Id": "584328dfc58944a4934df64d3dce4155" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 2, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "5275bb4d0a8a4ef5884bab77a61e8f2d", + "m_Id": 1, + "m_DisplayName": "R", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "R", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "584328dfc58944a4934df64d3dce4155", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 1.0, + "y": 1.0, + "z": 1.0, + "w": 1.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "810a7815a872476882906d948c2e0606", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Position", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "8cea9432d47e42b5ba28d0db631933cf" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Position" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "8b38983899c44dbd89c0fe57eb158af3", + "m_Name": "", + "m_ChildObjectList": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", + "m_ObjectId": "8cea9432d47e42b5ba28d0db631933cf", + "m_Id": 0, + "m_DisplayName": "Position", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Position", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "a0c6d066cb48432e89f8c86600a7db5f", + "m_Id": 0, + "m_DisplayName": "Smoothness", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Smoothness", + "m_StageCapability": 2, + "m_Value": 0.5, + "m_DefaultValue": 0.5, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "a41ac7ee834644eea3794299cc59d245", + "m_Id": 0, + "m_DisplayName": "Ambient Occlusion", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Occlusion", + "m_StageCapability": 2, + "m_Value": 1.0, + "m_DefaultValue": 1.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "a90d7d6eb6c84f62b3da90b48e88fd11", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Emission", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "dbe08f38826e4ca0bb214f278fa53cea" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Emission" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SplitNode", + "m_ObjectId": "b84a7d4a2af64ef291c95a588b74578b", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Split", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -627.54345703125, + "y": 293.65814208984377, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "43b5f2d482254001b0b200f13625cdb9" + }, + { + "m_Id": "5275bb4d0a8a4ef5884bab77a61e8f2d" + }, + { + "m_Id": "33812e4c68ed44b1b08882d80329f0a5" + }, + { + "m_Id": "f09f26e0c21c442d9d6da5302058e5bf" + }, + { + "m_Id": "28bd759b914843ce9e62cb7ff6114ba6" + } + ], + "synonyms": [ + "separate" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "c138c50a181843d18399748fce1ee1a3", + "m_Id": 0, + "m_DisplayName": "Metallic", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Metallic", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "c5083ca58565428d8313a071a0915183", + "m_Id": 0, + "m_DisplayName": "Base Color", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "BaseColor", + "m_StageCapability": 2, + "m_Value": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_ColorMode": 0, + "m_DefaultColor": { + "r": 0.5, + "g": 0.5, + "b": 0.5, + "a": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "c77967e96bf041ffbcf5427d794bf709", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Metallic", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "c138c50a181843d18399748fce1ee1a3" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Metallic" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.UVNode", + "m_ObjectId": "c82f0b5effc542b297ab67f2cd8de7dc", + "m_Group": { + "m_Id": "" + }, + "m_Name": "UV", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -815.9999389648438, + "y": 293.9999694824219, + "width": 145.0, + "height": 129.00006103515626 + } + }, + "m_Slots": [ + { + "m_Id": "f6c982f7118344688ee5e76c743e657b" + } + ], + "synonyms": [ + "texcoords", + "coords", + "coordinates" + ], + "m_Precision": 0, + "m_PreviewExpanded": false, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_OutputChannel": 2 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "cc77c592a30f45d3a4bb1240d8a9fc3c", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.BaseColor", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "c5083ca58565428d8313a071a0915183" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.BaseColor" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "cf5c4cf290274cada9ec45e23090c4e5", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.NormalTS", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "371ad3bd40ee43908680f316a487adef" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.NormalTS" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalLitSubTarget", + "m_ObjectId": "d8ca8037d99d467d96e37fe41dc5b0db", + "m_WorkflowMode": 1, + "m_NormalDropOffSpace": 0, + "m_ClearCoat": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "dbe08f38826e4ca0bb214f278fa53cea", + "m_Id": 0, + "m_DisplayName": "Emission", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Emission", + "m_StageCapability": 2, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_ColorMode": 1, + "m_DefaultColor": { + "r": 0.0, + "g": 0.0, + "b": 0.0, + "a": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "f09f26e0c21c442d9d6da5302058e5bf", + "m_Id": 3, + "m_DisplayName": "B", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "B", + "m_StageCapability": 3, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot", + "m_ObjectId": "f6c982f7118344688ee5e76c743e657b", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [] +} + diff --git a/Assets/VoxelProjectSeries/Shaders/VoxelVertexColor.shadergraph.meta b/Assets/VoxelProjectSeries/Shaders/VoxelVertexColor.shadergraph.meta new file mode 100644 index 0000000..334606e --- /dev/null +++ b/Assets/VoxelProjectSeries/Shaders/VoxelVertexColor.shadergraph.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: ecbded47e5d9c6a46b6063ebd9eaa479 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} diff --git a/Assets/VoxelProjectSeries/WorldMaterial.mat b/Assets/VoxelProjectSeries/WorldMaterial.mat index 8d3b208..1c0b58f 100644 --- a/Assets/VoxelProjectSeries/WorldMaterial.mat +++ b/Assets/VoxelProjectSeries/WorldMaterial.mat @@ -8,14 +8,14 @@ Material: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: WorldMaterial - m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Shader: {fileID: -6465566751694194690, guid: ecbded47e5d9c6a46b6063ebd9eaa479, + type: 3} m_ShaderKeywords: m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 m_CustomRenderQueue: -1 - stringTagMap: - RenderType: Opaque + stringTagMap: {} disabledShaderPasses: [] m_SavedProperties: serializedVersion: 3 diff --git a/Assets/VoxelProjectSeries/WorldMaterial.mat.meta b/Assets/VoxelProjectSeries/WorldMaterial.mat.meta index d16eb32..b3383cb 100644 --- a/Assets/VoxelProjectSeries/WorldMaterial.mat.meta +++ b/Assets/VoxelProjectSeries/WorldMaterial.mat.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4021f579d8ff00b4ca1a8c7d355362b3 +guid: d41578d92bc26b04bb2355aed476d2cb NativeFormatImporter: externalObjects: {} mainObjectFileID: 2100000