├── .gitattributes ├── .gitignore ├── CHANGELOG.md ├── CHANGELOG.md.meta ├── Documentation~ ├── DrivenDecals.md └── images │ ├── angleFadeNarrow.png │ ├── angleFadeWide.png │ ├── createDecalAsset.png │ ├── createDrivenDecalMenu.png │ ├── decalAssetPencilA.png │ ├── decalInspector.png │ ├── decalShadersList.png │ ├── decalsOnHat.png │ ├── defaultDecal.png │ ├── demonstration.png │ ├── pencilLetters.png │ ├── pencilLettersImport.png │ ├── pencilLettersMaterial.png │ ├── projectedDecal.png │ ├── projectedLetterA.png │ ├── projectedOnHat.png │ ├── selectDecalAsset.png │ ├── spawnerAfter.png │ ├── spawnerBefore.png │ ├── textureSet.png │ ├── unprojectedDecal.png │ ├── zFadePointTwo.png │ └── zFadeZero.png ├── Editor.meta ├── Editor ├── DecalAssetInspector.cs ├── DecalAssetInspector.cs.meta ├── DecalMenuItem.cs ├── DecalMenuItem.cs.meta ├── DecalMeshInspector.cs ├── DecalMeshInspector.cs.meta ├── Resources.meta ├── Resources │ ├── Materials.meta │ ├── Materials │ │ ├── EditorDecalOverlayBounds.mat │ │ ├── EditorDecalOverlayBounds.mat.meta │ │ ├── EditorDecalThumbnail.mat │ │ └── EditorDecalThumbnail.mat.meta │ ├── Shaders.meta │ └── Shaders │ │ ├── DecalOverlayBounds.shadergraph │ │ ├── DecalOverlayBounds.shadergraph.meta │ │ ├── DecalThumbnail.shadergraph │ │ └── DecalThumbnail.shadergraph.meta ├── SamDriver.DrivenDecals.Editor.asmdef └── SamDriver.DrivenDecals.Editor.asmdef.meta ├── LICENSE.md ├── LICENSE.md.meta ├── README.md ├── README.md.meta ├── Runtime.meta ├── Runtime ├── AssemblyInfo.cs ├── AssemblyInfo.cs.meta ├── DecalAsset.cs ├── DecalAsset.cs.meta ├── DecalMesh.cs ├── DecalMesh.cs.meta ├── MeshProjection.cs ├── MeshProjection.cs.meta ├── SamDriver.DrivenDecals.Runtime.asmdef ├── SamDriver.DrivenDecals.Runtime.asmdef.meta ├── Sample Decals.meta ├── Sample Decals │ ├── Fasteners.meta │ ├── Fasteners │ │ ├── Dimple in.asset │ │ ├── Dimple in.asset.meta │ │ ├── Dimple out.asset │ │ ├── Dimple out.asset.meta │ │ ├── Hex in indent.asset │ │ ├── Hex in indent.asset.meta │ │ ├── Hex.asset │ │ ├── Hex.asset.meta │ │ ├── Indent.asset │ │ ├── Indent.asset.meta │ │ ├── Material.meta │ │ ├── Material │ │ │ ├── Fasteners Decal Material.mat │ │ │ ├── Fasteners Decal Material.mat.meta │ │ │ ├── fasteners - DiffuseAlpha.png │ │ │ ├── fasteners - DiffuseAlpha.png.meta │ │ │ ├── fasteners - MSO.png │ │ │ ├── fasteners - MSO.png.meta │ │ │ ├── fasteners - Normal.png │ │ │ └── fasteners - Normal.png.meta │ │ ├── Nut in indent.asset │ │ ├── Nut in indent.asset.meta │ │ ├── Nut.asset │ │ ├── Nut.asset.meta │ │ ├── Screw and washer.asset │ │ ├── Screw and washer.asset.meta │ │ ├── Screw in indent.asset │ │ ├── Screw in indent.asset.meta │ │ ├── Screw.asset │ │ └── Screw.asset.meta │ ├── Simple.meta │ ├── Simple │ │ ├── Grid.asset │ │ ├── Grid.asset.meta │ │ ├── Material.meta │ │ ├── Material │ │ │ ├── Flat Decal Material.mat │ │ │ ├── Flat Decal Material.mat.meta │ │ │ ├── Grid Decal Material.mat │ │ │ ├── Grid Decal Material.mat.meta │ │ │ ├── Grid256.png │ │ │ ├── Grid256.png.meta │ │ │ ├── Unlit Grid Decal Material.mat │ │ │ └── Unlit Grid Decal Material.mat.meta │ │ ├── Unlit Grid.asset │ │ └── Unlit Grid.asset.meta │ ├── Sticky Notes.meta │ └── Sticky Notes │ │ ├── Code Note.asset │ │ ├── Code Note.asset.meta │ │ ├── Material.meta │ │ └── Material │ │ ├── Note Decal Material.mat │ │ ├── Note Decal Material.mat.meta │ │ ├── postit-code - DiffuseAlpha.png │ │ ├── postit-code - DiffuseAlpha.png.meta │ │ ├── postit-code - MSO.png │ │ ├── postit-code - MSO.png.meta │ │ ├── postit-code - Normal.png │ │ └── postit-code - Normal.png.meta ├── Sample Scripts.meta ├── Sample Scripts │ ├── DecalSpawner.cs │ └── DecalSpawner.cs.meta ├── Shaders.meta ├── Shaders │ ├── Decal Diffuse Emissive.shadergraph │ ├── Decal Diffuse Emissive.shadergraph.meta │ ├── Decal Diffuse Normal.shadergraph │ ├── Decal Diffuse Normal.shadergraph.meta │ ├── Decal Diffuse Unlit.shadergraph │ ├── Decal Diffuse Unlit.shadergraph.meta │ ├── Decal Diffuse.shadergraph │ ├── Decal Diffuse.shadergraph.meta │ ├── Decal Full PBR.shadergraph │ ├── Decal Full PBR.shadergraph.meta │ ├── Decal PBR Metallic Unity Style.shadergraph │ ├── Decal PBR Metallic Unity Style.shadergraph.meta │ ├── Decal PBR Specular Unity Style.shadergraph │ ├── Decal PBR Specular Unity Style.shadergraph.meta │ ├── Decal UV.shadersubgraph │ ├── Decal UV.shadersubgraph.meta │ ├── Decal Untextured Unlit.shadergraph │ ├── Decal Untextured Unlit.shadergraph.meta │ ├── Fade by angle.shadersubgraph │ ├── Fade by angle.shadersubgraph.meta │ ├── Fade near z bounds.shadersubgraph │ ├── Fade near z bounds.shadersubgraph.meta │ ├── Flip normal.shadersubgraph │ ├── Flip normal.shadersubgraph.meta │ ├── Offset in viewspace.shadersubgraph │ └── Offset in viewspace.shadersubgraph.meta ├── Util.meta └── Util │ ├── Dimension.cs │ ├── Dimension.cs.meta │ ├── DirectionToVertex.cs │ ├── DirectionToVertex.cs.meta │ ├── Edge.cs │ ├── Edge.cs.meta │ ├── Float2.cs │ ├── Float2.cs.meta │ ├── Float3.cs │ ├── Float3.cs.meta │ ├── RawMesh.cs │ ├── RawMesh.cs.meta │ ├── Square.cs │ ├── Square.cs.meta │ ├── Triangle.cs │ ├── Triangle.cs.meta │ ├── Vertex.cs │ └── Vertex.cs.meta ├── Tests.meta ├── Tests ├── Editor.meta └── Editor │ ├── DecalAssetTests.cs │ ├── DecalAssetTests.cs.meta │ ├── SamDriver.DrivenDecals.EditorTests.asmdef │ ├── SamDriver.DrivenDecals.EditorTests.asmdef.meta │ ├── TriangleTests.cs │ └── TriangleTests.cs.meta ├── package.json └── package.json.meta /.gitattributes: -------------------------------------------------------------------------------- 1 | # files to handle with git's Large File System (LFS) 2 | #*.png filter=lfs diff=lfs merge=lfs -text 3 | #*.unitypackage filter=lfs diff=lfs merge=lfs -text 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generic windows things to ignore 2 | 3 | # Windows thumbnail cache files 4 | Thumbs.db 5 | Thumbs.db:encryptable 6 | ehthumbs.db 7 | ehthumbs_vista.db 8 | 9 | # Dump file 10 | *.stackdump 11 | 12 | # Folder config file 13 | [Dd]esktop.ini 14 | 15 | # Recycle Bin used on file shares 16 | $RECYCLE.BIN/ 17 | 18 | # Windows Installer files 19 | *.cab 20 | *.msi 21 | *.msix 22 | *.msm 23 | *.msp 24 | 25 | # Windows shortcuts 26 | *.lnk 27 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | ## [0.8.0] - 2024-06-09 3 | ### Changed 4 | - Updated to work with Unity 2023.3 LTS. Specifically tested with Unity 2022.3.32f1 using Universal Render Pipeline 14.0.11. 5 | - No new features, so you'll not miss out on anything by using 0.7 if your project is using an older Unity or URP version. 6 | 7 | ## [0.7.0] - 2020-06-09 8 | ### Added 9 | - Thanks to [Kenny5](https://github.com/Kenny5) the decal system can now be added to a project through the Unity Package Manager system rather than manually downloading the .package file. See the [README](README.md) for updated installation instructions. 10 | - Tests for Triangle and DecalAsset. Code coverage is lower than it should be, but it's a start. 11 | 12 | ### Changed 13 | - Thanks to [Kenny5](https://github.com/Kenny5) many directories have been moved around to support Unity's package manager. 14 | - This changelog now uses [semantic version numbers](https://semver.org/) instead of just dates. Note that the major version number is still 0, indicating the project is in the initial development phase so even minor version increases may make breaking changes. I expect to move to 1.0.0 fairly soon. 15 | - Rearranged the documentation. The README is now far shorter with the bulk of documentation [moved to its own file](Documentation~/DrivenDecals.md). 16 | - Updated the 60 second introduction video to use the package manager method of installation. 17 | 18 | ### Fixed 19 | - `Triangle`'s `GeometryNormal` is now correctly normalized. 20 | 21 | ## [0.6.0] - 2020-05-19 22 | ### Changed 23 | - Significantly improved performance of generating the `RawMesh` in `MeshProjection` by avoiding garbage generation/collection. My test case went from 277ms to 26ms for that part of the process. 24 | - `MeshProjection` no longer automatically starts when instantiated, you should now call `Begin()` 25 | - Example `DecalSpawner` now passes hint to its generated decals that the projection process may take several frames to complete. That's important as the Unity jobs system allocates memory depending on how long it'll need to exist for. 26 | - Various bits of minor code tidying, removing unused `using` statements and so on. 27 | 28 | ## [0.5.0] - 2020-05-18 29 | ### Changed 30 | - Disabled a safety check so the ugly `UpToFiveTriangles` struct is no longer needed. Shouldn't have any externally visible effect. 31 | 32 | ## [0.4.0] - 2020-05-16 33 | ### Added 34 | - Option to "Auto-Repeat" projection of the `DecalMesh` which triggers the projection process whenever the selected decal is moved, rotated, or resized in the editor. 35 | 36 | ## [0.3.0] - 2020-05-14 37 | ### Added 38 | - Option to fade out a decal depending on the surface's angle to the decal's forward direction. Useful for hiding parts of the decal that are highly distorted by projection. 39 | - Option to adjust a decal's draw order, useful for selecting which overlapping decal should be drawn on top. 40 | 41 | ### Changed 42 | - Renamed `Decal` component to `DecalMesh`, making it clearer it has responsibility for mesh generation, and to free up the more general "Decal" name. 43 | - Various improvements to `README` 44 | 45 | ### Fixed 46 | - Normals on the decal mesh were being incorrectly affected by local scale. 47 | 48 | ## [0.2.0] - 2020-05-13 49 | ### Added 50 | - Rework most of the mesh projection system to use Unity's Job system. Projection is now faster, uses all available CPU cores, and can be extended over several frames. However there's still a block on the primary thread while the mesh itself is built. Generating decals during gameplay remains a bad idea. 51 | - Added `Decal`'s `GenerateProjectedMeshDelayed` which allows the projection process to take place over several frames. 52 | 53 | ### Changed 54 | - Renamed `Decal`'s `GenerateProjectedMesh` to `GenerateProjectedMeshImmediate` to indicate that it forces the projection to be completed during that method call. 55 | - Large changes to contents of `DrivenDecals/Util` to make them compatible with the Job system. All changes were to `internal` things. 56 | - Various improvements to `README` 57 | 58 | ## [0.1.0] - 2020-05-12 59 | Initial pre-release version. 60 | -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe0864006d5d23d46a3ef7cf09180013 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Documentation~/images/angleFadeNarrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/angleFadeNarrow.png -------------------------------------------------------------------------------- /Documentation~/images/angleFadeWide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/angleFadeWide.png -------------------------------------------------------------------------------- /Documentation~/images/createDecalAsset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/createDecalAsset.png -------------------------------------------------------------------------------- /Documentation~/images/createDrivenDecalMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/createDrivenDecalMenu.png -------------------------------------------------------------------------------- /Documentation~/images/decalAssetPencilA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/decalAssetPencilA.png -------------------------------------------------------------------------------- /Documentation~/images/decalInspector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/decalInspector.png -------------------------------------------------------------------------------- /Documentation~/images/decalShadersList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/decalShadersList.png -------------------------------------------------------------------------------- /Documentation~/images/decalsOnHat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/decalsOnHat.png -------------------------------------------------------------------------------- /Documentation~/images/defaultDecal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/defaultDecal.png -------------------------------------------------------------------------------- /Documentation~/images/demonstration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/demonstration.png -------------------------------------------------------------------------------- /Documentation~/images/pencilLetters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/pencilLetters.png -------------------------------------------------------------------------------- /Documentation~/images/pencilLettersImport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/pencilLettersImport.png -------------------------------------------------------------------------------- /Documentation~/images/pencilLettersMaterial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/pencilLettersMaterial.png -------------------------------------------------------------------------------- /Documentation~/images/projectedDecal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/projectedDecal.png -------------------------------------------------------------------------------- /Documentation~/images/projectedLetterA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/projectedLetterA.png -------------------------------------------------------------------------------- /Documentation~/images/projectedOnHat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/projectedOnHat.png -------------------------------------------------------------------------------- /Documentation~/images/selectDecalAsset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/selectDecalAsset.png -------------------------------------------------------------------------------- /Documentation~/images/spawnerAfter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/spawnerAfter.png -------------------------------------------------------------------------------- /Documentation~/images/spawnerBefore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/spawnerBefore.png -------------------------------------------------------------------------------- /Documentation~/images/textureSet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/textureSet.png -------------------------------------------------------------------------------- /Documentation~/images/unprojectedDecal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/unprojectedDecal.png -------------------------------------------------------------------------------- /Documentation~/images/zFadePointTwo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/zFadePointTwo.png -------------------------------------------------------------------------------- /Documentation~/images/zFadeZero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Documentation~/images/zFadeZero.png -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13a9c0dfdb05d144f94ef11f9e1f8393 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/DecalAssetInspector.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace SamDriver.Decal 6 | { 7 | [CustomEditor(typeof(DecalAsset))] 8 | [CanEditMultipleObjects] 9 | public class DecalAssetInspector : Editor 10 | { 11 | const string editorResourcesPath = "Packages/com.samdriver.driven-decals/Editor/Resources/"; 12 | static Material FetchEditorMaterial(string materialName) 13 | { 14 | var path = Path.Combine(editorResourcesPath, $"Materials/{materialName}.mat"); 15 | var material = AssetDatabase.LoadAssetAtPath(path); 16 | if (material == null) throw new FileNotFoundException($"Couldn't find material file at {path}"); 17 | return material; 18 | } 19 | 20 | Material _thumbnailMaterial; 21 | Material thumbnailMaterial 22 | { 23 | get 24 | { 25 | if (_thumbnailMaterial == null) 26 | { 27 | _thumbnailMaterial = FetchEditorMaterial("EditorDecalThumbnail"); 28 | } 29 | return _thumbnailMaterial; 30 | } 31 | } 32 | 33 | static string[] essentialMaterialProperties = new string[] { 34 | "_DiffuseAlpha", 35 | "_Bounds", 36 | }; 37 | static string[] supportedMaterialProperties = new string[] { 38 | "_Opacity", 39 | "_FlipU", 40 | "_FlipV", 41 | "_ZFadeStart", 42 | "_MinAngleFadeRadians", 43 | "_MaxAngleFadeRadians", 44 | }; 45 | 46 | static Color previewBackColour = Color.white; 47 | static float maxPreviewHeight = 520f; 48 | 49 | SerializedProperty material; 50 | SerializedProperty uMin, vMin, uMax, vMax; 51 | 52 | void OnEnable() 53 | { 54 | material = serializedObject.FindProperty(nameof(DecalAsset.Material)); 55 | 56 | // can't use nameof here as these properties aren't public 57 | uMin = serializedObject.FindProperty("uMin"); 58 | vMin = serializedObject.FindProperty("vMin"); 59 | uMax = serializedObject.FindProperty("uMax"); 60 | vMax = serializedObject.FindProperty("vMax"); 61 | } 62 | 63 | public override void OnInspectorGUI() 64 | { 65 | bool isEditingMultipleObjects = (targets != null && targets.Length > 1); 66 | serializedObject.Update(); 67 | 68 | MaterialPickerGUI(); 69 | 70 | if (!isEditingMultipleObjects) 71 | { 72 | PreviewSettingsGUI(); 73 | PreviewAndRegionSelectionGUI(); 74 | } 75 | 76 | serializedObject.ApplyModifiedProperties(); 77 | } 78 | 79 | void MaterialPickerGUI() 80 | { 81 | EditorGUILayout.PropertyField(material, new GUIContent("Material")); 82 | 83 | var selectedMaterial = (Material)material.objectReferenceValue; 84 | if (selectedMaterial == null) return; 85 | 86 | // warn about missing properties 87 | foreach (string propertyName in essentialMaterialProperties) 88 | { 89 | if (!selectedMaterial.HasProperty(propertyName)) 90 | { 91 | EditorGUILayout.HelpBox($"{selectedMaterial.name} doesn't have a {propertyName} property, which is required for use as a decal material.", 92 | MessageType.Error); 93 | } 94 | } 95 | foreach (string propertyName in supportedMaterialProperties) 96 | { 97 | if (!selectedMaterial.HasProperty(propertyName)) 98 | { 99 | EditorGUILayout.HelpBox($"{selectedMaterial.name} doesn't have a {propertyName} property, so some decal features may not function.", 100 | MessageType.Warning); 101 | } 102 | } 103 | } 104 | 105 | void PreviewSettingsGUI() 106 | { 107 | previewBackColour = EditorGUILayout.ColorField("Preview background:", previewBackColour); 108 | } 109 | 110 | void PreviewAndRegionSelectionGUI() 111 | { 112 | Texture2D previewTexture = ((DecalAsset) target).diffuseAlpha; 113 | if (previewTexture == null) { 114 | return; 115 | } 116 | 117 | using (new EditorGUILayout.HorizontalScope()) 118 | { 119 | float nudgeButtonSize = 20f; 120 | var nudgeButtonParams = new GUILayoutOption[] { GUILayout.Width(nudgeButtonSize), GUILayout.Height(nudgeButtonSize) }; 121 | using (new EditorGUILayout.VerticalScope(GUILayout.Width(nudgeButtonSize))) 122 | { 123 | if (GUILayout.RepeatButton("↑", nudgeButtonParams)) 124 | { 125 | vMax.floatValue += 1f / previewTexture.height; 126 | } 127 | if (GUILayout.RepeatButton("↓", nudgeButtonParams)) 128 | { 129 | vMax.floatValue -= 1f / previewTexture.height; 130 | } 131 | GUILayout.FlexibleSpace(); 132 | if (GUILayout.RepeatButton("↑", nudgeButtonParams)) 133 | { 134 | vMin.floatValue += 1f / previewTexture.height; 135 | } 136 | if (GUILayout.RepeatButton("↓", nudgeButtonParams)) 137 | { 138 | vMin.floatValue -= 1f / previewTexture.height; 139 | } 140 | GUILayout.Space(nudgeButtonSize + 4f); 141 | } 142 | 143 | using (new EditorGUILayout.VerticalScope(GUILayout.Width(nudgeButtonSize))) 144 | { 145 | // not great to be using hardcoded, but can't find an exposed property. 146 | float inspectorPaddingLeft = 18f; 147 | float inspectorPaddingRight = 6f; 148 | float availableWidth = EditorGUIUtility.currentViewWidth - nudgeButtonSize - inspectorPaddingLeft - inspectorPaddingRight; 149 | 150 | // make a region that matches ratio of texture and scales to fit availableWidth and maxPreviewHeight 151 | float widthOverHeight = (float)previewTexture.width / (float)previewTexture.height; 152 | float width = availableWidth; 153 | float height = Mathf.Min(maxPreviewHeight, availableWidth / widthOverHeight); 154 | width = Mathf.Min(availableWidth, height * widthOverHeight); 155 | 156 | // DrawPreviewTexture not available directly in *GUILayout, so separately reserve space then use it 157 | var previewRegion = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, 158 | new GUILayoutOption[] { GUILayout.Width(width), GUILayout.Height(height) } 159 | ); 160 | 161 | Vector4 bounds = ((DecalAsset) target).BoundsAsVector4; 162 | 163 | EditorGUI.DrawPreviewTexture(previewRegion, previewTexture); 164 | 165 | // TODO: Should be able to use `overlayBoundsMaterial` as custom material but 166 | // it keeps failing. So drawing rectangles over basic image instead. 167 | var fillColour = new Color(0f, 0f, 0f, 0.75f); 168 | 169 | // Area being used by this decal. 170 | float x = Mathf.Round(bounds.x * previewRegion.width); 171 | float y = Mathf.Round((1f - bounds.w) * previewRegion.height); 172 | float w = Mathf.Round((bounds.z - bounds.x) * previewRegion.width); 173 | float h = Mathf.Round((bounds.w - bounds.y) * previewRegion.height); 174 | 175 | // Above. 176 | EditorGUI.DrawRect( 177 | new Rect( 178 | previewRegion.x, 179 | previewRegion.y, 180 | previewRegion.width, 181 | y 182 | ), 183 | fillColour 184 | ); 185 | 186 | // Below. 187 | EditorGUI.DrawRect( 188 | new Rect( 189 | previewRegion.x, 190 | previewRegion.y + y + h, 191 | previewRegion.width, 192 | previewRegion.height - (y + h) 193 | ), 194 | fillColour 195 | ); 196 | 197 | // Left. 198 | EditorGUI.DrawRect( 199 | new Rect( 200 | previewRegion.x, 201 | previewRegion.y + y, 202 | x, 203 | h 204 | ), 205 | fillColour 206 | ); 207 | 208 | // Right. 209 | EditorGUI.DrawRect( 210 | new Rect( 211 | previewRegion.x + x + w, 212 | previewRegion.y + y, 213 | previewRegion.width - (x + w), 214 | h 215 | ), 216 | fillColour 217 | ); 218 | 219 | HandleMouse(previewRegion); 220 | 221 | using (new EditorGUILayout.HorizontalScope()) 222 | { 223 | if (GUILayout.RepeatButton("←", nudgeButtonParams)) 224 | { 225 | uMin.floatValue -= 1f / previewTexture.width; 226 | } 227 | if (GUILayout.RepeatButton("→", nudgeButtonParams)) 228 | { 229 | uMin.floatValue += 1f / previewTexture.width; 230 | } 231 | GUILayout.FlexibleSpace(); 232 | if (GUILayout.RepeatButton("←", nudgeButtonParams)) 233 | { 234 | uMax.floatValue -= 1f / previewTexture.width; 235 | } 236 | if (GUILayout.RepeatButton("→", nudgeButtonParams)) 237 | { 238 | uMax.floatValue += 1f / previewTexture.width; 239 | } 240 | } 241 | } 242 | } 243 | 244 | // use a small label size for these fields 245 | EditorGUIUtility.labelWidth = 40f; 246 | using (new EditorGUILayout.HorizontalScope()) 247 | { 248 | EditorGUILayout.DelayedFloatField(uMin, new GUIContent("uMin")); 249 | EditorGUILayout.DelayedFloatField(uMax, new GUIContent("uMax")); 250 | } 251 | using (new EditorGUILayout.HorizontalScope()) 252 | { 253 | EditorGUILayout.DelayedFloatField(vMin, new GUIContent("vMin")); 254 | EditorGUILayout.DelayedFloatField(vMax, new GUIContent("vMax")); 255 | } 256 | } 257 | 258 | Vector2 mouseStartOnTexture; 259 | bool isDraggingRegion = false; 260 | void HandleMouse(Rect region) 261 | { 262 | Event e = Event.current; 263 | if (!e.isMouse) return; 264 | 265 | Vector2 positionInRegion = e.mousePosition - region.min; 266 | if (e.type == EventType.MouseDown && e.button == 0) 267 | { 268 | // left mouse button down 269 | if (positionInRegion.x > 0f && positionInRegion.y > 0f && 270 | positionInRegion.x < region.width && positionInRegion.y < region.height) 271 | { 272 | mouseStartOnTexture = PositionOnTextureInUV(region, positionInRegion); 273 | isDraggingRegion = true; 274 | } 275 | } 276 | else if (isDraggingRegion && 277 | (e.type == EventType.MouseDrag || (e.type == EventType.MouseUp && e.button == 0))) 278 | { 279 | // drag or left mouse button up 280 | Vector2 positionOnTexture = PositionOnTextureInUV(region, positionInRegion); 281 | SetBoundsByCorners(mouseStartOnTexture, positionOnTexture); 282 | Repaint(); 283 | 284 | if (e.type == EventType.MouseUp) 285 | { 286 | isDraggingRegion = false; 287 | } 288 | } 289 | } 290 | 291 | void SetBoundsByCorners(Vector2 cornerA, Vector2 cornerB) 292 | { 293 | uMin.floatValue = Mathf.Min(cornerA.x, cornerB.x); 294 | vMin.floatValue = Mathf.Min(cornerA.y, cornerB.y); 295 | uMax.floatValue = Mathf.Max(cornerA.x, cornerB.x); 296 | vMax.floatValue = Mathf.Max(cornerA.y, cornerB.y); 297 | } 298 | 299 | Vector2 PositionOnTextureInUV(Rect displayRegion, Vector2 positionInRegion) 300 | { 301 | return new Vector2( 302 | positionInRegion.x / displayRegion.width, 303 | 1f - (positionInRegion.y / displayRegion.height) 304 | ); 305 | } 306 | 307 | /// 308 | /// RenderStaticPreview is poorly documented. Nonetheless this produces a nice 309 | /// square thumbnail preview of the decal. 310 | /// 311 | public override Texture2D RenderStaticPreview(string assetPath, UnityEngine.Object[] subAssets, 312 | int width, int height) 313 | { 314 | DecalAsset decalAsset = (DecalAsset)target; 315 | if (decalAsset == null || !decalAsset.HasDiffuseAlphaTexture) 316 | { 317 | return null; 318 | } 319 | 320 | PreviewRenderUtility utility = new PreviewRenderUtility(); 321 | utility.BeginStaticPreview(new Rect(0, 0, width, height)); 322 | 323 | // Normally would set up a little scene within PreviewRenderUtility, then render that manually 324 | // useful links: 325 | // https://github.com/raphael-ernaelsten/Texture3DPreview-for-Unity/blob/master/Assets/Texture3DPreview/Editor/Extensions/Texture3DExtensions.cs 326 | // http://answers.unity.com/answers/1650714/view.html 327 | // for example: 328 | // utility.camera.transform.position = Vector2.zero; 329 | // utility.camera.transform.position = utility.camera.transform.forward * -distance; 330 | // utility.camera.backgroundColor = Color.red; 331 | // utility.DrawMesh(someMesh, Matrix4x4.identity, someMaterial, 0); 332 | // utility.camera.Render(); 333 | 334 | // But in this case we just blit to camera's target 335 | thumbnailMaterial.SetVector("_Bounds", decalAsset.BoundsAsVector4); 336 | thumbnailMaterial.SetColor("_ColourForAlpha", previewBackColour); 337 | Graphics.Blit(decalAsset.diffuseAlpha, utility.camera.targetTexture, thumbnailMaterial, 0); 338 | 339 | // EndStaticPreview() gives us the texture generated by utility.camera 340 | // (for some reason returning a texture made this way works, returning a texture I make doesn't) 341 | var result = utility.EndStaticPreview(); 342 | utility.Cleanup(); 343 | 344 | return result; 345 | } 346 | } 347 | } 348 | -------------------------------------------------------------------------------- /Editor/DecalAssetInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e1c230d099809e44ae6cabedd9b7441 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/DecalMenuItem.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using UnityEngine; 3 | using UnityEditor; 4 | 5 | namespace SamDriver.Decal 6 | { 7 | public static class StaticDecalMenuItem 8 | { 9 | [MenuItem("GameObject/3D Object/Driven Decal")] 10 | static void CreateDecal() 11 | { 12 | GameObject decalObject = new GameObject("Decal"); 13 | decalObject.AddComponent(); 14 | var meshRenderer = decalObject.AddComponent(); 15 | var decal = decalObject.AddComponent(); 16 | 17 | // do NOT set to be used in static batching - Unity breaks something with UVs 18 | GameObjectUtility.SetStaticEditorFlags(decalObject, 19 | StaticEditorFlags.ContributeGI | 20 | StaticEditorFlags.OccludeeStatic | 21 | StaticEditorFlags.ReflectionProbeStatic 22 | ); 23 | 24 | // decals shouldn't cast shadows 25 | meshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; 26 | 27 | // set as child of selected object, if possible 28 | if (Selection.activeTransform != null) 29 | { 30 | decalObject.transform.SetParent(Selection.activeTransform, false); 31 | } 32 | 33 | decal.DecalAsset = FetchSampleDecalAsset(); 34 | 35 | // generate initial quad mesh 36 | decal.GenerateSimpleQuadMesh(); 37 | 38 | // select the created item (mimicking behaviour of adding a built-in object) 39 | Selection.activeObject = decalObject; 40 | } 41 | 42 | const string sampleDecalsPath = "Packages/com.samdriver.driven-decals/Runtime/Sample Decals/"; 43 | static DecalAsset FetchSampleDecalAsset() 44 | { 45 | var path = Path.Combine(sampleDecalsPath, "Simple/Grid.asset"); 46 | var decal = AssetDatabase.LoadAssetAtPath(path); 47 | if (decal == null) throw new FileNotFoundException($"Couldn't find Decal Asset at {path}"); 48 | return decal; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Editor/DecalMenuItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ccef47a005e7de345a3f096e3cd1f0f9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/DecalMeshInspector.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | namespace SamDriver.Decal 5 | { 6 | [CustomEditor(typeof(DecalMesh))] 7 | [CanEditMultipleObjects] 8 | public class DecalMeshInspector : Editor 9 | { 10 | SerializedProperty decalAsset, opacity, zFadeDistance, isFlipU, isFlipV, 11 | minAngleFadeDegrees, maxAngleFadeDegrees, drawOrder, 12 | shouldUseAllSceneStaticMeshes, meshesToProjectAgainst, 13 | shouldReprojectOnMove; 14 | 15 | void OnEnable() 16 | { 17 | decalAsset = serializedObject.FindProperty(nameof(DecalMesh.DecalAsset)); 18 | opacity = serializedObject.FindProperty(nameof(DecalMesh.Opacity)); 19 | zFadeDistance = serializedObject.FindProperty(nameof(DecalMesh.ZFadeDistance)); 20 | isFlipU = serializedObject.FindProperty(nameof(DecalMesh.IsFlipU)); 21 | isFlipV = serializedObject.FindProperty(nameof(DecalMesh.IsFlipV)); 22 | minAngleFadeDegrees = serializedObject.FindProperty(nameof(DecalMesh.MinAngleFadeDegrees)); 23 | maxAngleFadeDegrees = serializedObject.FindProperty(nameof(DecalMesh.MaxAngleFadeDegrees)); 24 | drawOrder = serializedObject.FindProperty(nameof(DecalMesh.DrawOrder)); 25 | shouldUseAllSceneStaticMeshes = serializedObject.FindProperty(nameof(DecalMesh.ShouldUseSceneStaticMeshes)); 26 | meshesToProjectAgainst = serializedObject.FindProperty(nameof(DecalMesh.MeshesToProjectAgainst)); 27 | shouldReprojectOnMove = serializedObject.FindProperty(nameof(DecalMesh.ShouldReprojectOnMove)); 28 | } 29 | 30 | public override void OnInspectorGUI() 31 | { 32 | bool isEditingMultipleObjects = (targets != null && targets.Length > 1); 33 | 34 | var items = new DecalMesh[targets.Length]; 35 | for (int i = 0; i < targets.Length; ++i) 36 | { 37 | items[i] = (DecalMesh)targets[i]; 38 | } 39 | var primaryItem = (DecalMesh)target; 40 | serializedObject.Update(); 41 | 42 | ProjectMeshButtonGUI(primaryItem, items, isEditingMultipleObjects); 43 | ResetMeshButtonGUI(primaryItem, items, isEditingMultipleObjects); 44 | ScaleToMatchButtonGUI(primaryItem, items, isEditingMultipleObjects); 45 | DecalPickerGUI(primaryItem, items, isEditingMultipleObjects); 46 | OpacityOptionsGUI(); 47 | DrawOrderOptionsGUI(); 48 | FlipOptionsGUI(); 49 | TargetMeshesGUI(); 50 | 51 | serializedObject.ApplyModifiedProperties(); 52 | 53 | Repaint(); 54 | 55 | // bit dubious doing this call from within OnInspectorGUI, but with Repaint() should get called often enough 56 | foreach (var decal in items) 57 | { 58 | if (decal.ShouldReprojectOnMove && 59 | decal.HasTransformChangedSinceProjection && 60 | !decal.IsAwaitingProjectionResult) 61 | { 62 | decal.GenerateProjectedMeshImmediate(); 63 | } 64 | } 65 | } 66 | 67 | void ProjectMeshButtonGUI(DecalMesh primaryItem, DecalMesh[] items, bool isEditingMultipleObjects) 68 | { 69 | bool canAnyTargetProject = false; 70 | foreach (var item in items) 71 | { 72 | if (item.HasMeshToProjectAgainst) 73 | { 74 | canAnyTargetProject = true; 75 | break; 76 | } 77 | } 78 | 79 | using (new EditorGUI.DisabledScope(!canAnyTargetProject)) 80 | { 81 | using (EditorGUIUtility.wideMode ? new EditorGUILayout.HorizontalScope() : null) 82 | { 83 | if (GUILayout.Button("Project mesh")) 84 | { 85 | foreach (var item in items) 86 | { 87 | if (item.HasMeshToProjectAgainst) 88 | { 89 | item.GenerateProjectedMeshImmediate(); 90 | } 91 | } 92 | } 93 | var previousWidth = EditorGUIUtility.labelWidth; 94 | EditorGUIUtility.labelWidth = 80f; 95 | EditorGUILayout.PropertyField(shouldReprojectOnMove, 96 | new GUIContent("Auto-Repeat", "Automatically attempt to project mesh when the decal is moved in the editor.")); 97 | EditorGUIUtility.labelWidth = previousWidth; 98 | } 99 | } 100 | if (!canAnyTargetProject) 101 | { 102 | if (shouldUseAllSceneStaticMeshes.boolValue) 103 | { 104 | EditorGUILayout.HelpBox("Cannot project mesh until the decal is placed close to a static mesh in the scene, or \"All static meshes\" is unticked and at least one target mesh is selected.", 105 | MessageType.Warning); 106 | } 107 | else 108 | { 109 | EditorGUILayout.HelpBox("Cannot project mesh until at least one target mesh has been selected.", 110 | MessageType.Warning); 111 | } 112 | } 113 | if (!isEditingMultipleObjects && primaryItem.IsGeneratedMeshEmpty) 114 | { 115 | if (shouldUseAllSceneStaticMeshes.boolValue) 116 | { 117 | EditorGUILayout.HelpBox("Decal mesh is currently empty so the decal is invisible.\nPlace this object so that the bounding box intersects at least one static mesh in the scene then click \"Generate Mesh\"", 118 | MessageType.Warning); 119 | } 120 | else 121 | { 122 | EditorGUILayout.HelpBox("Decal mesh is currently empty so the decal is invisible.\nPlace this object so that the bounding box intersects at least one targetted mesh then click \"Generate Mesh\"", 123 | MessageType.Warning); 124 | } 125 | } 126 | } 127 | 128 | void ResetMeshButtonGUI(DecalMesh primaryItem, DecalMesh[] items, bool isEditingMultipleObjects) 129 | { 130 | if (GUILayout.Button("Reset mesh")) 131 | { 132 | foreach (var item in items) 133 | { 134 | item.GenerateSimpleQuadMesh(); 135 | } 136 | } 137 | } 138 | 139 | void ScaleToMatchButtonGUI(DecalMesh primaryItem, DecalMesh[] items, bool isEditingMultipleObjects) 140 | { 141 | bool canAnyPerformScale = false; 142 | foreach (var item in items) 143 | { 144 | if (item.CanScaleToMatchDecal) 145 | { 146 | canAnyPerformScale = true; 147 | break; 148 | } 149 | } 150 | using (new EditorGUI.DisabledScope(!canAnyPerformScale)) 151 | { 152 | if (GUILayout.Button("Scale to match decal shape")) 153 | { 154 | foreach (var item in items) 155 | { 156 | if (item.CanScaleToMatchDecal) 157 | { 158 | item.ScaleToMatchDecalBoundsRatio(); 159 | } 160 | } 161 | } 162 | } 163 | if (!isEditingMultipleObjects && !canAnyPerformScale) 164 | { 165 | if (primaryItem.HasZeroDimensionsOnDecalAsset) 166 | { 167 | EditorGUILayout.HelpBox($"Cannot scale to match decal because selected {nameof(DecalAsset)} has width or height of zero.", 168 | MessageType.Info); 169 | } 170 | } 171 | } 172 | 173 | void DecalPickerGUI(DecalMesh primaryItem, DecalMesh[] items, bool isEditingMultipleObjects) 174 | { 175 | EditorGUILayout.PropertyField(decalAsset, 176 | new GUIContent("Decal Asset", 177 | $"The decal to display. You can create new {nameof(DecalAsset)}s in your project assets.") 178 | ); 179 | 180 | if (!isEditingMultipleObjects && !primaryItem.HasDecalAsset) 181 | { 182 | EditorGUILayout.HelpBox($"{nameof(DecalMesh)} requires a {nameof(DecalAsset)}", 183 | MessageType.Error); 184 | } 185 | } 186 | 187 | void OpacityOptionsGUI() 188 | { 189 | EditorGUILayout.Slider(opacity, 0f, 1f, "Opacity"); 190 | EditorGUILayout.Slider(zFadeDistance, 0f, 1f, "zFade Distance"); 191 | 192 | float min = minAngleFadeDegrees.floatValue; 193 | float max = maxAngleFadeDegrees.floatValue; 194 | EditorGUILayout.MinMaxSlider("Angle Fade", ref min, ref max, 0f, 90f); 195 | minAngleFadeDegrees.floatValue = min; 196 | maxAngleFadeDegrees.floatValue = max; 197 | } 198 | 199 | void FlipOptionsGUI() 200 | { 201 | using (EditorGUIUtility.wideMode ? new EditorGUILayout.HorizontalScope() : null) 202 | { 203 | EditorGUILayout.PropertyField(isFlipU, new GUIContent("Flip Horizontal")); 204 | EditorGUILayout.PropertyField(isFlipV, new GUIContent("Flip Vertical")); 205 | } 206 | } 207 | 208 | void DrawOrderOptionsGUI() 209 | { 210 | EditorGUILayout.IntSlider(drawOrder, 0, 100, "Draw Order"); 211 | } 212 | 213 | void TargetMeshesGUI() 214 | { 215 | EditorGUILayout.PropertyField(shouldUseAllSceneStaticMeshes, 216 | new GUIContent("All static meshes", 217 | "Rather than specifying which objects this decal should target, automatically find nearby static meshes in the scene." 218 | )); 219 | using (new EditorGUI.DisabledScope(shouldUseAllSceneStaticMeshes.boolValue)) 220 | { 221 | EditorGUILayout.PropertyField(meshesToProjectAgainst, 222 | new GUIContent("Target meshes", 223 | "The meshes that this decal will attempt to project against, can be any number of scene objects with MeshFilter components." 224 | )); 225 | } 226 | if (shouldUseAllSceneStaticMeshes.boolValue) 227 | { 228 | EditorGUILayout.HelpBox($"To select specific meshes to target you need to first disable the \"All static meshes\" option.", 229 | MessageType.Info); 230 | } 231 | } 232 | } 233 | } 234 | -------------------------------------------------------------------------------- /Editor/DecalMeshInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 430e9610d0394434a98afa1c8abe4e33 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Editor/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8dd32e2fec9ce5641972ac294225d0e0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Resources/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb12fc046469c7749adabee7122fb1ec 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Resources/Materials/EditorDecalOverlayBounds.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: EditorDecalOverlayBounds 11 | m_Shader: {fileID: -6465566751694194690, guid: f20932cddbb701e48aa0800ffb1a2001, 12 | type: 3} 13 | m_Parent: {fileID: 0} 14 | m_ModifiedSerializedProperties: 0 15 | m_ValidKeywords: [] 16 | m_InvalidKeywords: [] 17 | m_LightmapFlags: 4 18 | m_EnableInstancingVariants: 0 19 | m_DoubleSidedGI: 0 20 | m_CustomRenderQueue: -1 21 | stringTagMap: {} 22 | disabledShaderPasses: [] 23 | m_LockedProperties: 24 | m_SavedProperties: 25 | serializedVersion: 3 26 | m_TexEnvs: 27 | - _BaseMap: 28 | m_Texture: {fileID: 0} 29 | m_Scale: {x: 1, y: 1} 30 | m_Offset: {x: 0, y: 0} 31 | - _BumpMap: 32 | m_Texture: {fileID: 0} 33 | m_Scale: {x: 1, y: 1} 34 | m_Offset: {x: 0, y: 0} 35 | - _EmissionMap: 36 | m_Texture: {fileID: 0} 37 | m_Scale: {x: 1, y: 1} 38 | m_Offset: {x: 0, y: 0} 39 | - _MainTex: 40 | m_Texture: {fileID: 2800000, guid: cc7230ee2f76fa54a878c52345bcc314, type: 3} 41 | m_Scale: {x: 1, y: 1} 42 | m_Offset: {x: 0, y: 0} 43 | - _MetallicGlossMap: 44 | m_Texture: {fileID: 0} 45 | m_Scale: {x: 1, y: 1} 46 | m_Offset: {x: 0, y: 0} 47 | - _OcclusionMap: 48 | m_Texture: {fileID: 0} 49 | m_Scale: {x: 1, y: 1} 50 | m_Offset: {x: 0, y: 0} 51 | - _SpecGlossMap: 52 | m_Texture: {fileID: 0} 53 | m_Scale: {x: 1, y: 1} 54 | m_Offset: {x: 0, y: 0} 55 | - unity_Lightmaps: 56 | m_Texture: {fileID: 0} 57 | m_Scale: {x: 1, y: 1} 58 | m_Offset: {x: 0, y: 0} 59 | - unity_LightmapsInd: 60 | m_Texture: {fileID: 0} 61 | m_Scale: {x: 1, y: 1} 62 | m_Offset: {x: 0, y: 0} 63 | - unity_ShadowMasks: 64 | m_Texture: {fileID: 0} 65 | m_Scale: {x: 1, y: 1} 66 | m_Offset: {x: 0, y: 0} 67 | m_Ints: [] 68 | m_Floats: 69 | - _AlphaClip: 0 70 | - _Blend: 0 71 | - _BumpScale: 1 72 | - _Cull: 2 73 | - _Cutoff: 0.5 74 | - _DstBlend: 0 75 | - _EnvironmentReflections: 1 76 | - _GlossMapScale: 0 77 | - _Glossiness: 0 78 | - _GlossyReflections: 0 79 | - _Metallic: 0 80 | - _OcclusionStrength: 1 81 | - _QueueControl: 0 82 | - _QueueOffset: 0 83 | - _ReceiveShadows: 1 84 | - _Smoothness: 0.5 85 | - _SmoothnessTextureChannel: 0 86 | - _SpecularHighlights: 1 87 | - _SrcBlend: 1 88 | - _Surface: 0 89 | - _WorkflowMode: 1 90 | - _ZWrite: 1 91 | m_Colors: 92 | - Color_535B7939: {r: 0.51886785, g: 0.51886785, b: 0.51886785, a: 0} 93 | - _BaseColor: {r: 1, g: 1, b: 1, a: 1} 94 | - _Bounds: {r: 0.02, g: 0.58285713, b: 0.3342857, a: 0.9114286} 95 | - _Color: {r: 1, g: 1, b: 1, a: 1} 96 | - _ColourForAlpha: {r: 1, g: 1, b: 1, a: 1} 97 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 98 | - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} 99 | m_BuildTextureStacks: [] 100 | --- !u!114 &947017867161076915 101 | MonoBehaviour: 102 | m_ObjectHideFlags: 11 103 | m_CorrespondingSourceObject: {fileID: 0} 104 | m_PrefabInstance: {fileID: 0} 105 | m_PrefabAsset: {fileID: 0} 106 | m_GameObject: {fileID: 0} 107 | m_Enabled: 1 108 | m_EditorHideFlags: 0 109 | m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} 110 | m_Name: 111 | m_EditorClassIdentifier: 112 | version: 7 113 | -------------------------------------------------------------------------------- /Editor/Resources/Materials/EditorDecalOverlayBounds.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a8e0975517a260a478f4e70284b0c0b8 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Resources/Materials/EditorDecalThumbnail.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: EditorDecalThumbnail 11 | m_Shader: {fileID: -6465566751694194690, guid: 729954eff5261fb42b8edce55b0080ba, 12 | type: 3} 13 | m_Parent: {fileID: 0} 14 | m_ModifiedSerializedProperties: 0 15 | m_ValidKeywords: [] 16 | m_InvalidKeywords: [] 17 | m_LightmapFlags: 4 18 | m_EnableInstancingVariants: 0 19 | m_DoubleSidedGI: 0 20 | m_CustomRenderQueue: -1 21 | stringTagMap: {} 22 | disabledShaderPasses: [] 23 | m_LockedProperties: 24 | m_SavedProperties: 25 | serializedVersion: 3 26 | m_TexEnvs: 27 | - _BaseMap: 28 | m_Texture: {fileID: 0} 29 | m_Scale: {x: 1, y: 1} 30 | m_Offset: {x: 0, y: 0} 31 | - _BumpMap: 32 | m_Texture: {fileID: 0} 33 | m_Scale: {x: 1, y: 1} 34 | m_Offset: {x: 0, y: 0} 35 | - _EmissionMap: 36 | m_Texture: {fileID: 0} 37 | m_Scale: {x: 1, y: 1} 38 | m_Offset: {x: 0, y: 0} 39 | - _MainTex: 40 | m_Texture: {fileID: 2800000, guid: cc7230ee2f76fa54a878c52345bcc314, type: 3} 41 | m_Scale: {x: 1, y: 1} 42 | m_Offset: {x: 0, y: 0} 43 | - _MetallicGlossMap: 44 | m_Texture: {fileID: 0} 45 | m_Scale: {x: 1, y: 1} 46 | m_Offset: {x: 0, y: 0} 47 | - _OcclusionMap: 48 | m_Texture: {fileID: 0} 49 | m_Scale: {x: 1, y: 1} 50 | m_Offset: {x: 0, y: 0} 51 | - _SpecGlossMap: 52 | m_Texture: {fileID: 0} 53 | m_Scale: {x: 1, y: 1} 54 | m_Offset: {x: 0, y: 0} 55 | - unity_Lightmaps: 56 | m_Texture: {fileID: 0} 57 | m_Scale: {x: 1, y: 1} 58 | m_Offset: {x: 0, y: 0} 59 | - unity_LightmapsInd: 60 | m_Texture: {fileID: 0} 61 | m_Scale: {x: 1, y: 1} 62 | m_Offset: {x: 0, y: 0} 63 | - unity_ShadowMasks: 64 | m_Texture: {fileID: 0} 65 | m_Scale: {x: 1, y: 1} 66 | m_Offset: {x: 0, y: 0} 67 | m_Ints: [] 68 | m_Floats: 69 | - _AlphaClip: 0 70 | - _Blend: 0 71 | - _BumpScale: 1 72 | - _Cull: 2 73 | - _Cutoff: 0.5 74 | - _DstBlend: 0 75 | - _EnvironmentReflections: 1 76 | - _GlossMapScale: 0 77 | - _Glossiness: 0 78 | - _GlossyReflections: 0 79 | - _Metallic: 0 80 | - _OcclusionStrength: 1 81 | - _QueueControl: 0 82 | - _QueueOffset: 0 83 | - _ReceiveShadows: 1 84 | - _Smoothness: 0.5 85 | - _SmoothnessTextureChannel: 0 86 | - _SpecularHighlights: 1 87 | - _SrcBlend: 1 88 | - _Surface: 0 89 | - _WorkflowMode: 1 90 | - _ZWrite: 1 91 | m_Colors: 92 | - _BaseColor: {r: 1, g: 1, b: 1, a: 1} 93 | - _Bounds: {r: 0.6840146, g: 0.24463588, b: 0.98439366, a: 0.5533265} 94 | - _Color: {r: 1, g: 1, b: 1, a: 1} 95 | - _ColourForAlpha: {r: 1, g: 1, b: 1, a: 1} 96 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 97 | - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} 98 | m_BuildTextureStacks: [] 99 | --- !u!114 &4650353202634063725 100 | MonoBehaviour: 101 | m_ObjectHideFlags: 11 102 | m_CorrespondingSourceObject: {fileID: 0} 103 | m_PrefabInstance: {fileID: 0} 104 | m_PrefabAsset: {fileID: 0} 105 | m_GameObject: {fileID: 0} 106 | m_Enabled: 1 107 | m_EditorHideFlags: 0 108 | m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} 109 | m_Name: 110 | m_EditorClassIdentifier: 111 | version: 7 112 | -------------------------------------------------------------------------------- /Editor/Resources/Materials/EditorDecalThumbnail.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97eb60a0894860641854bcb2975ec0a0 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Resources/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f8ddb1e2f26d3f4fbb568da246b2a45 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Editor/Resources/Shaders/DecalOverlayBounds.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f20932cddbb701e48aa0800ffb1a2001 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Editor/Resources/Shaders/DecalThumbnail.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 729954eff5261fb42b8edce55b0080ba 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Editor/SamDriver.DrivenDecals.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SamDriver.DrivenDecals.Editor", 3 | "references": [ 4 | "GUID:22b65885038b8ac4fb6e944d0774c114" 5 | ], 6 | "includePlatforms": [ 7 | "Editor" 8 | ], 9 | "excludePlatforms": [], 10 | "allowUnsafeCode": false, 11 | "overrideReferences": false, 12 | "precompiledReferences": [], 13 | "autoReferenced": true, 14 | "defineConstraints": [], 15 | "versionDefines": [], 16 | "noEngineReferences": false 17 | } -------------------------------------------------------------------------------- /Editor/SamDriver.DrivenDecals.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 76dbc3c987fc113409412ab5f7e72bf3 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019-2020 Sam Driver 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c2f041a48ca4114dad610071b7c5550 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Driven Decals 2 | A mesh-based PBR decal system for Unity. For use with the Universal Render Pipeline. 3 | 4 | These types of decals are good for static things like cracks and graffiti added into the game during level design (or during an initial procedural generation process). 5 | 6 | This way of handling decals is bad for things like adding bullet holes when the player shoots. For dynamic decals, you can use the Universal Render Pipeline's [decal rendering feature](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.0/manual/renderer-feature-decal.html). 7 | 8 | I've [written a little interactive article about these two types of decal](https://samdriver.xyz/articles/decalsIntro.htm) if you would like to know more. 9 | 10 | [60 second introduction video on using this package.](https://www.youtube.com/watch?v=zFEtdRrD2D4) 11 | 12 | ## Status - Last updated 2024-06-09 13 | Note that this package has a "preview" version number. You are of course welcome to use it as you like, but please be aware there are known missing features (for example it doesn't work with animated meshes) and almost has certainly bugs. 14 | 15 | These days I work full-time on projects away from Unity, so please don't expect rapid progress. 16 | 17 | ## Example Screenshot 18 | ![Decals applied to a cylinder, giving the impression that it is made of cracked concrete. One of the cracks reveals a bright abstract pattern beneath the surface.](/Documentation~/images/demonstration.png) 19 | 20 | ## Key Features 21 | * Creates meshes that behave like any other mesh in your scene. Making them easier to work with and use with other features. 22 | * Easy to customise using Unity's Shader Graph. 23 | * Low rendering cost and full compatibility with URP's forward renderer makes it ideal for use in XR. 24 | * Custom inspectors that provide immediate in-editor feedback. 25 | * Support for multi-object editing and undo. 26 | 27 | ## Key Limitations 28 | * Decal mesh generation is relatively slow. This system is not recommended as a way to dynamically place bullet holes or other effects during gameplay. 29 | * Once the decal mesh is generated it remains as it is and will not adapt to the other meshes changing. This system will not work nicely with skinned mesh renderers or other meshes that get distorted at runtime. 30 | 31 | ## Changelog 32 | [Human-friendly changelog](CHANGELOG.md) 33 | 34 | ## Getting Started 35 | ### Requirements 36 | * Unity 2019.3.0f6 or later, using the universal render pipeline (URP) version 7.2.1 or later. 37 | 38 | In theory it should work in the LWRP and Unity versions as far back as 2018. But it looks like shader graph really doesn't care about cross-version compatibility. If you need this to work in those earlier versions I may be able to put together something compatible with some extra work. 39 | 40 | ### Installation 41 | 1. Within your project open the Package Manager from *Window* → *Package Manager* 42 | 2. Click the **+** icon at the top-left of the window and select "Add package from git URL..." 43 | 3. Paste in `https://github.com/Anatta336/driven-decals.git` and click "Add" 44 | 4. Wait a minute. It looks a lot like nothing is happening, but Unity is busy thinking about packages. 45 | 5. When installed you'll see "Driven Decals" listed in the window. 46 | 47 | **Or** you can manually modify your project's `manifest.json` file in the Packages folder to include: 48 | ```js 49 | { 50 | "dependencies": { 51 | "com.samdriver.driven-decals": "https://github.com/Anatta336/driven-decals.git", 52 | ... 53 | }, 54 | } 55 | ``` 56 | 57 | ### Documentation 58 | [Extensive documentation including step-by-step instructions to get you started.](Documentation~/DrivenDecals.md) 59 | 60 | ## Authors 61 | Sam Driver - [Website](https://samdriver.xyz/) 62 | 63 | ### Special Thanks 64 | [Kenny5](https://github.com/Kenny5) - Made everything work nicely with the Unity Package Manager. 65 | 66 | ## Licence 67 | The source code of this project and associated documentation is licensed under the [MIT licence](../master/LICENSE.txt). 68 | 69 | The included example assets are licensed under the Attribution 4.0 International [(CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/) licence. 70 | 71 | These licences mean you already have permission to use this in whatever project you like, including commercial releases. They place no obligation on you to release your source code. If you release something that makes use of this decal system a small acknowledgement in the credits would be appreciated, but is not required. 72 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c2903fe8eed78d4983bfd56672b58d9 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 16a65d1308e1a18459c5ca0bec8882a5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | // make all internals in this assembly also visible to the test assembly(s) 4 | [assembly: InternalsVisibleTo("SamDriver.DrivenDecals.EditorTests")] 5 | -------------------------------------------------------------------------------- /Runtime/AssemblyInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b0b8002742612f548b0868963487afee 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/DecalAsset.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace SamDriver.Decal 5 | { 6 | [Serializable] 7 | [CreateAssetMenu(fileName = "New Decal", menuName = "Decal/Decal Asset")] 8 | /// 9 | /// Describes the location of a particular decal within the texture(s) of a material. 10 | /// 11 | public class DecalAsset : ScriptableObject 12 | { 13 | static int diffuseAlphaID = Shader.PropertyToID("_DiffuseAlpha"); 14 | 15 | public Material Material; 16 | 17 | // bounds in uv space 18 | [SerializeField] float uMin = 0f, vMin = 0f, uMax = 1f, vMax = 1f; 19 | 20 | // this block are all set by UpdateDerivedValues() 21 | 22 | /// 23 | /// .x is uMin, .y is vMin, .z is uMax, .w is vMax 24 | /// 25 | public Vector4 BoundsAsVector4 { get; private set; } 26 | public float UVWidth { get; private set; } 27 | public float UVHeight { get; private set; } 28 | public float UVWidthDividedByHeight { get; private set; } 29 | public bool HasAnyZeroSizedDimensions { get; private set; } 30 | 31 | public bool HasDiffuseAlphaTexture 32 | { 33 | get => (Material != null && Material.HasProperty(diffuseAlphaID)); 34 | } 35 | public Texture2D diffuseAlpha 36 | { 37 | get => HasDiffuseAlphaTexture ? (Texture2D)Material.GetTexture(diffuseAlphaID) : null; 38 | } 39 | public float TexelsWidth 40 | { 41 | get 42 | { 43 | if (!HasDiffuseAlphaTexture) return 0f; 44 | Texture2D diffuseAlpha = (Texture2D)Material.GetTexture(diffuseAlphaID); 45 | return UVWidth * diffuseAlpha.width; 46 | } 47 | } 48 | public float TexelsHeight 49 | { 50 | get 51 | { 52 | if (!HasDiffuseAlphaTexture) return 0f; 53 | Texture2D diffuseAlpha = (Texture2D)Material.GetTexture(diffuseAlphaID); 54 | return UVHeight * diffuseAlpha.height; 55 | } 56 | } 57 | 58 | void OnEnable() 59 | { 60 | UpdateDerivedValues(); 61 | } 62 | 63 | void OnValidate() 64 | { 65 | uMax = Mathf.Max(uMin, uMax); 66 | vMax = Mathf.Max(vMin, vMax); 67 | UpdateDerivedValues(); 68 | } 69 | 70 | void UpdateDerivedValues() 71 | { 72 | BoundsAsVector4 = new Vector4(uMin, vMin, uMax, vMax); 73 | UVWidth = uMax - uMin; 74 | UVHeight = vMax - vMin; 75 | UVWidthDividedByHeight = UVWidth / UVHeight; 76 | HasAnyZeroSizedDimensions = (Mathf.Approximately(UVWidth, 0f) || Mathf.Approximately(UVHeight, 0f)); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Runtime/DecalAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8cd7be7c3532c974c919d1b2a4cf439b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: 7 | - DiffuseAlpha: {instanceID: 0} 8 | - MetallicSmoothnessOcclusion: {instanceID: 0} 9 | - Normal: {instanceID: 0} 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | assetBundleVariant: 15 | -------------------------------------------------------------------------------- /Runtime/DecalMesh.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace SamDriver.Decal 6 | { 7 | [ExecuteInEditMode] 8 | [RequireComponent(typeof(MeshRenderer))] 9 | [RequireComponent(typeof(MeshFilter))] 10 | /// 11 | /// Represents a single mesh-based decal in the scene. 12 | /// 13 | public class DecalMesh : MonoBehaviour 14 | { 15 | public DecalAsset DecalAsset; 16 | public float Opacity = 1f; 17 | public float ZFadeDistance = 0.1f; 18 | public float MinAngleFadeDegrees = 83f; 19 | public float MaxAngleFadeDegrees = 85f; 20 | public bool IsFlipU = false; 21 | public bool IsFlipV = false; 22 | public int DrawOrder = 0; 23 | public bool ShouldUseSceneStaticMeshes = true; 24 | public List MeshesToProjectAgainst = new List(); 25 | public bool ShouldReprojectOnMove = false; 26 | 27 | public bool IsAwaitingProjectionResult 28 | { 29 | get => projectionInProgress != null && projectionInProgress.InProgress; 30 | } 31 | MeshProjection projectionInProgress; 32 | 33 | public bool HasTransformChangedSinceProjection 34 | { 35 | get => positionOfProjection != transform.position || 36 | scaleOfProjection != transform.localScale || 37 | rotationOfProjection != transform.rotation; 38 | } 39 | [SerializeField] Vector3 positionOfProjection; 40 | [SerializeField] Vector3 scaleOfProjection; 41 | [SerializeField] Quaternion rotationOfProjection; 42 | 43 | [SerializeField] bool isMeshUnprojected = false; 44 | 45 | MeshFilter _meshFilter; 46 | MeshFilter meshFilter 47 | { 48 | get 49 | { 50 | if (_meshFilter == null) _meshFilter = GetComponent(); 51 | return _meshFilter; 52 | } 53 | } 54 | MeshRenderer _meshRenderer; 55 | MeshRenderer meshRenderer 56 | { 57 | get 58 | { 59 | if (_meshRenderer == null) _meshRenderer = GetComponent(); 60 | return _meshRenderer; 61 | } 62 | } 63 | 64 | MaterialPropertyBlock materialPropertyBlock; 65 | 66 | static int boundsID = Shader.PropertyToID("_Bounds"); 67 | static int opacityID = Shader.PropertyToID("_Opacity"); 68 | static int zFadeStartID = Shader.PropertyToID("_ZFadeStart"); 69 | static int minAngleFadeRadiansID = Shader.PropertyToID("_MinAngleFadeRadians"); 70 | static int maxAngleFadeRadiansID = Shader.PropertyToID("_MaxAngleFadeRadians"); 71 | static int flipUID = Shader.PropertyToID("_FlipU"); 72 | static int flipVID = Shader.PropertyToID("_FlipV"); 73 | static int zNudgeID = Shader.PropertyToID("_ZNudge"); 74 | 75 | public bool IsGeneratedMeshEmpty 76 | { 77 | get => (meshFilter.sharedMesh == null || meshFilter.sharedMesh.vertexCount == 0); 78 | } 79 | 80 | /// 81 | /// Is it currently possible to ScaleToMatchDecalBoundsRatio for this decal. 82 | /// 83 | public bool CanScaleToMatchDecal 84 | { 85 | get => (DecalAsset != null) && !DecalAsset.HasAnyZeroSizedDimensions; 86 | } 87 | 88 | /// 89 | /// Is a DecalAsset currently selected. 90 | /// 91 | public bool HasDecalAsset { get => (DecalAsset != null); } 92 | 93 | /// 94 | /// Queries .HasAnyZeroSizedDimensions on the selected DecalAsset. 95 | /// False if there is no DecalAsset currently selected. 96 | /// 97 | public bool HasZeroDimensionsOnDecalAsset 98 | { 99 | get => (DecalAsset != null) && DecalAsset.HasAnyZeroSizedDimensions; 100 | } 101 | 102 | public bool HasMeshToProjectAgainst 103 | { 104 | get => WorldMeshFilters().Any(); 105 | } 106 | 107 | void OnEnable() 108 | { 109 | materialPropertyBlock = new MaterialPropertyBlock(); 110 | SetupMaterialPropertyBlock(); 111 | } 112 | 113 | void OnDisable() 114 | { 115 | if (projectionInProgress != null) 116 | { 117 | projectionInProgress.Abort(); 118 | projectionInProgress = null; 119 | } 120 | } 121 | 122 | void EnforcePositiveScale() 123 | { 124 | if (transform.localScale.x < 0f) 125 | { 126 | transform.localScale = new Vector3( 127 | transform.localScale.x * -1f, 128 | transform.localScale.y, 129 | transform.localScale.z 130 | ); 131 | } 132 | if (transform.localScale.y < 0f) 133 | { 134 | transform.localScale = new Vector3( 135 | transform.localScale.x, 136 | transform.localScale.y * -1f, 137 | transform.localScale.z 138 | ); 139 | } 140 | if (transform.localScale.z < 0f) 141 | { 142 | transform.localScale = new Vector3( 143 | transform.localScale.x, 144 | transform.localScale.y, 145 | transform.localScale.z * -1f 146 | ); 147 | } 148 | } 149 | 150 | void Update() 151 | { 152 | if (projectionInProgress != null && projectionInProgress.IsReadyToComplete) 153 | { 154 | ReceiveProjectionResult(); 155 | } 156 | 157 | #if UNITY_EDITOR 158 | // in the editor just setup every frame to be safe. During play it should be rare 159 | // that it needs changing so leave it to whatever caused the change to call setup. 160 | SetupMaterialPropertyBlock(); 161 | #endif 162 | } 163 | 164 | /// 165 | /// Sets Material on object's MeshRenderer and uses a MaterialPropertyBlock to provide 166 | /// values for rendering this decal. 167 | /// Should be called whenever there's a change to DecalAsset or this DecalMesh's properties. 168 | /// 169 | public void SetupMaterialPropertyBlock() 170 | { 171 | if (DecalAsset == null) return; 172 | 173 | meshRenderer.sharedMaterial = DecalAsset.Material; 174 | meshRenderer.GetPropertyBlock(materialPropertyBlock); 175 | 176 | materialPropertyBlock.SetVector(boundsID, DecalAsset.BoundsAsVector4); 177 | materialPropertyBlock.SetFloat(opacityID, Opacity); 178 | materialPropertyBlock.SetFloat(zFadeStartID, isMeshUnprojected ? 0f : ZFadeDistance); 179 | materialPropertyBlock.SetFloat(minAngleFadeRadiansID, MinAngleFadeDegrees * Mathf.Deg2Rad); 180 | materialPropertyBlock.SetFloat(maxAngleFadeRadiansID, MaxAngleFadeDegrees * Mathf.Deg2Rad); 181 | materialPropertyBlock.SetInt(flipUID, IsFlipU ? 1 : 0); 182 | materialPropertyBlock.SetInt(flipVID, IsFlipV ? 1 : 0); 183 | 184 | meshRenderer.sortingOrder = DrawOrder; 185 | 186 | meshRenderer.SetPropertyBlock(materialPropertyBlock); 187 | } 188 | 189 | /// 190 | /// Adjust this object's local scale to make its aspect ratio match selected decal texture's bounds. 191 | /// Will decrease either the x or y component of local scale, never changes z. 192 | /// 193 | /// Will throw DecalException if unable to perform the scale operation. 194 | /// You should check CanScaleToMatchDecal before calling. 195 | /// 196 | public void ScaleToMatchDecalBoundsRatio() 197 | { 198 | if (DecalAsset == null) 199 | { 200 | Debug.LogError($"{nameof(DecalMesh)} cannot scale to match decal when it doesn't have a {nameof(DecalAsset)}."); 201 | return; 202 | } 203 | else if (DecalAsset.HasAnyZeroSizedDimensions) 204 | { 205 | Debug.LogError($"{nameof(DecalMesh)} cannot scale to match a {nameof(DecalAsset)} with zero width or height."); 206 | } 207 | 208 | #if UNITY_EDITOR 209 | UnityEditor.Undo.RecordObjects(new UnityEngine.Object[] { this, this.transform }, "rescale decal"); 210 | #endif 211 | 212 | // negative scaling breaks the projection process (flip effect can be done with FlipU and FlipV properties) 213 | EnforcePositiveScale(); 214 | 215 | Vector3 scale = transform.localScale; 216 | float targetRatio = DecalAsset.TexelsWidth / DecalAsset.TexelsHeight; 217 | float currentRatio = scale.x / scale.y; 218 | 219 | if (currentRatio > targetRatio) 220 | { 221 | // current is too wide, so reduce width 222 | scale.x = targetRatio * scale.y; 223 | } 224 | else 225 | { 226 | // current is too tall, so reduce height 227 | scale.y = scale.x / targetRatio; 228 | } 229 | 230 | transform.localScale = scale; 231 | 232 | #if UNITY_EDITOR 233 | // if we're part of a prefab need to report change through PrefabUtility for undo etc to work correctly 234 | if (UnityEditor.PrefabUtility.IsPartOfAnyPrefab(this)) 235 | { 236 | UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(this); 237 | } 238 | #endif 239 | } 240 | 241 | /// 242 | /// Create a simple quad mesh positioned on the "back" face of the decal's region. 243 | /// Intended for use as an initial display of where the decal is. 244 | /// Note that this overwrites any existing mesh, so will cause the loss of any 245 | /// projected mesh from GenerateProjectedMesh. 246 | /// 247 | public void GenerateSimpleQuadMesh() 248 | { 249 | #if UNITY_EDITOR 250 | UnityEditor.Undo.RecordObjects( 251 | new UnityEngine.Object[] { this, meshFilter }, "reset decal mesh" 252 | ); 253 | #endif 254 | 255 | EnforcePositiveScale(); 256 | 257 | List positions = new List(); 258 | List uvs = new List(); 259 | List normals = new List(); 260 | List tangents = new List(); 261 | foreach (var corner in Square.CenteredUnitSquareCorners) 262 | { 263 | positions.Add(new Vector3(corner.x, corner.y, -0.5f)); 264 | uvs.Add(new Vector2(corner.x + 0.5f, corner.y + 0.5f)); 265 | normals.Add(Vector3.back); 266 | tangents.Add(new Vector4(1f, 0f, 0f, -1f)); 267 | } 268 | 269 | int[] indices = new int[] { 270 | 0, 2, 1, 271 | 0, 3, 2 272 | }; 273 | 274 | var mesh = new Mesh(); 275 | mesh.vertices = positions.ToArray(); 276 | mesh.normals = normals.ToArray(); 277 | mesh.tangents = tangents.ToArray(); 278 | mesh.uv = uvs.ToArray(); 279 | mesh.triangles = indices; 280 | 281 | meshFilter.mesh = mesh; 282 | isMeshUnprojected = true; 283 | 284 | #if UNITY_EDITOR 285 | // if we're part of a prefab need to report change through PrefabUtility for undo etc to work correctly 286 | if (UnityEditor.PrefabUtility.IsPartOfAnyPrefab(this)) 287 | { 288 | UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(this); 289 | UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(meshFilter); 290 | } 291 | #endif 292 | } 293 | 294 | /// 295 | /// Create a mesh that represents the decal having been projected against the target mesh(es). 296 | /// The created mesh is set as this object's MeshFilter's current mesh. 297 | /// 298 | public void GenerateProjectedMeshImmediate() 299 | { 300 | if (!HasMeshToProjectAgainst) 301 | { 302 | Debug.LogError($"Projecting a {nameof(DecalMesh)} requires at least one target mesh to project against."); 303 | return; 304 | } 305 | 306 | #if UNITY_EDITOR 307 | UnityEditor.Undo.RecordObjects( 308 | new UnityEngine.Object[] { this, meshFilter }, "project decal mesh"); 309 | #endif 310 | 311 | EnforcePositiveScale(); 312 | 313 | meshFilter.mesh = MeshProjection.GenerateProjectedDecalMesh(WorldMeshFilters(), transform); 314 | isMeshUnprojected = false; 315 | positionOfProjection = transform.position; 316 | scaleOfProjection = transform.localScale; 317 | rotationOfProjection = transform.rotation; 318 | 319 | #if UNITY_EDITOR 320 | // if we're part of a prefab need to report change through PrefabUtility for undo etc to work correctly 321 | if (UnityEditor.PrefabUtility.IsPartOfAnyPrefab(this)) 322 | { 323 | UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(this); 324 | UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(meshFilter); 325 | } 326 | #endif 327 | } 328 | 329 | /// 330 | /// Performs the same operation as GenerateProjectedMesh but allows it to be spread 331 | /// over several frames. 332 | /// 333 | public void GenerateProjectedMeshDelayed(bool expectToTakeMoreThanFourFrames = false) 334 | { 335 | if (projectionInProgress != null) 336 | { 337 | // already in progress 338 | return; 339 | } 340 | if (!HasMeshToProjectAgainst) 341 | { 342 | Debug.LogError($"Projecting a {nameof(DecalMesh)} requires at least one target mesh to project against."); 343 | return; 344 | } 345 | 346 | EnforcePositiveScale(); 347 | 348 | projectionInProgress = new MeshProjection(WorldMeshFilters(), transform, expectToTakeMoreThanFourFrames); 349 | projectionInProgress.Begin(); 350 | positionOfProjection = transform.position; 351 | scaleOfProjection = transform.localScale; 352 | rotationOfProjection = transform.rotation; 353 | } 354 | 355 | void ReceiveProjectionResult() 356 | { 357 | #if UNITY_EDITOR 358 | UnityEditor.Undo.RecordObjects( 359 | new UnityEngine.Object[] { this, meshFilter }, "project decal mesh"); 360 | #endif 361 | 362 | meshFilter.mesh = projectionInProgress.Complete(); 363 | projectionInProgress = null; 364 | isMeshUnprojected = false; 365 | 366 | #if UNITY_EDITOR 367 | // if we're part of a prefab need to report change through PrefabUtility for undo etc to work correctly 368 | if (UnityEditor.PrefabUtility.IsPartOfAnyPrefab(this)) 369 | { 370 | UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(this); 371 | UnityEditor.PrefabUtility.RecordPrefabInstancePropertyModifications(meshFilter); 372 | } 373 | #endif 374 | } 375 | 376 | /// 377 | /// Provides the MeshFilters that this decal should be projected against. 378 | /// How they are sourced is decided by ShouldUseAllSceneStaticMeshes. 379 | /// 380 | IEnumerable WorldMeshFilters() 381 | { 382 | if (ShouldUseSceneStaticMeshes) 383 | { 384 | // we'll (fairly roughly) construct a sphere that encompasses the whole of 385 | // the mesh in question, then see if that intersects a sphere around the decal. 386 | // a k-d tree or some other spatial mapping would be a good idea, but so long 387 | // as we're generating the mesh outside of runtime, it's not a priority. 388 | Vector3 decalCenter = this.transform.position; 389 | 390 | // decal is a unit cube, centered on decalCenter 391 | float decalRadiusSquared = (this.transform.TransformPoint(Vector3.one * 0.5f) - decalCenter).sqrMagnitude; 392 | 393 | foreach (MeshFilter meshFilter in GameObject.FindObjectsOfType(typeof(MeshFilter))) 394 | { 395 | // only interested in meshes on static objects 396 | if (!meshFilter.gameObject.isStatic) continue; 397 | 398 | // don't project against other decals 399 | #if UNITY_2019_2_OR_NEWER 400 | if (meshFilter.gameObject.TryGetComponent(out _)) continue; 401 | #else 402 | if (meshFilter.gameObject.GetComponent() != null) continue; 403 | #endif 404 | 405 | //NOTE: if you want to exclude any other objects from "all static objects" here's the place to do it 406 | 407 | var bounds = meshFilter.sharedMesh.bounds; 408 | Vector3 meshCenter = meshFilter.transform.TransformPoint(bounds.center); 409 | float meshRadiusSquared = (meshFilter.transform.TransformPoint(bounds.max) - meshCenter).sqrMagnitude; 410 | 411 | float separationSquared = (meshCenter - decalCenter).sqrMagnitude; 412 | if (separationSquared < (decalRadiusSquared + meshRadiusSquared)) 413 | { 414 | yield return meshFilter; 415 | } 416 | } 417 | } 418 | else 419 | { 420 | foreach (MeshFilter meshFilter in MeshesToProjectAgainst) 421 | { 422 | yield return meshFilter; 423 | } 424 | } 425 | } 426 | 427 | #if UNITY_EDITOR 428 | void OnDrawGizmosSelected() 429 | { 430 | DrawGizmoDecalRegion(); 431 | } 432 | 433 | void DrawGizmoDecalRegion() 434 | { 435 | Gizmos.color = Color.grey; 436 | for (int i = 0; i < Square.CornerCount; ++i) 437 | { 438 | Float2 v0 = Square.CenteredUnitSquareCorners[i]; 439 | Float2 v1 = Square.CenteredUnitSquareCorners[(i + 1) % Square.CornerCount]; 440 | 441 | // back 442 | Gizmos.DrawLine( 443 | transform.TransformPoint(new Vector3(v0.x, v0.y, -0.5f)), 444 | transform.TransformPoint(new Vector3(v1.x, v1.y, -0.5f)) 445 | ); 446 | // connecting 447 | Gizmos.DrawLine( 448 | transform.TransformPoint(new Vector3(v0.x, v0.y, -0.5f)), 449 | transform.TransformPoint(new Vector3(v0.x, v0.y, +0.5f)) 450 | ); 451 | // front 452 | Gizmos.DrawLine( 453 | transform.TransformPoint(new Vector3(v0.x, v0.y, +0.5f)), 454 | transform.TransformPoint(new Vector3(v1.x, v1.y, +0.5f)) 455 | ); 456 | } 457 | } 458 | #endif //UNITY_EDITOR 459 | } 460 | } 461 | -------------------------------------------------------------------------------- /Runtime/DecalMesh.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1208bbe937c3a54488f1d85a7931055a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/MeshProjection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c58e2125aad637d44abfc08e48648e95 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/SamDriver.DrivenDecals.Runtime.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SamDriver.DrivenDecals.Runtime", 3 | "references": [], 4 | "includePlatforms": [], 5 | "excludePlatforms": [], 6 | "allowUnsafeCode": false, 7 | "overrideReferences": false, 8 | "precompiledReferences": [], 9 | "autoReferenced": true, 10 | "defineConstraints": [], 11 | "versionDefines": [], 12 | "noEngineReferences": false 13 | } -------------------------------------------------------------------------------- /Runtime/SamDriver.DrivenDecals.Runtime.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22b65885038b8ac4fb6e944d0774c114 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime/Sample Decals.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b3dffd214db7bd3449170e09ff49596f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 014631cb69388854b8a809a8ff88da28 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Dimple in.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8cd7be7c3532c974c919d1b2a4cf439b, type: 3} 13 | m_Name: Dimple in 14 | m_EditorClassIdentifier: 15 | Material: {fileID: 2100000, guid: 41cdeb38201dd97469527bde6ed67f4b, type: 2} 16 | uMin: 0.34705356 17 | vMin: 0.59540737 18 | uMax: 0.65414065 19 | vMax: 0.9045201 20 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Dimple in.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba216269defa6a74290fb8cf08bf49b9 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Dimple out.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8cd7be7c3532c974c919d1b2a4cf439b, type: 3} 13 | m_Name: Dimple out 14 | m_EditorClassIdentifier: 15 | Material: {fileID: 2100000, guid: 41cdeb38201dd97469527bde6ed67f4b, type: 2} 16 | uMin: 0.6744308 17 | vMin: 0.6 18 | uMax: 0.9742857 19 | vMax: 0.9066183 20 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Dimple out.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e25f926834dcc9439ea3ba5485b620d 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Hex in indent.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8cd7be7c3532c974c919d1b2a4cf439b, type: 3} 13 | m_Name: Hex in indent 14 | m_EditorClassIdentifier: 15 | Material: {fileID: 2100000, guid: 41cdeb38201dd97469527bde6ed67f4b, type: 2} 16 | uMin: 0.016238838 17 | vMin: 0.24766742 18 | uMax: 0.3257143 19 | vMax: 0.56263953 20 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Hex in indent.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d709478a89fe09240bdbc14c9eaa4b15 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Hex.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8cd7be7c3532c974c919d1b2a4cf439b, type: 3} 13 | m_Name: Hex 14 | m_EditorClassIdentifier: 15 | Material: {fileID: 2100000, guid: 41cdeb38201dd97469527bde6ed67f4b, type: 2} 16 | uMin: 0.030524554 17 | vMin: 0.029620536 18 | uMax: 0.24857143 19 | vMax: 0.24947545 20 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Hex.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f6679b571b92b4148899ac2383128957 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Indent.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8cd7be7c3532c974c919d1b2a4cf439b, type: 3} 13 | m_Name: Indent 14 | m_EditorClassIdentifier: 15 | Material: {fileID: 2100000, guid: 41cdeb38201dd97469527bde6ed67f4b, type: 2} 16 | uMin: 0.02 17 | vMin: 0.58285713 18 | uMax: 0.3342857 19 | vMax: 0.9114286 20 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Indent.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a43cd9660e706945b5e4453e10775d7 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Material.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8d42f30d52d19640b47734af0ce4549 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Material/Fasteners Decal Material.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &-5056110346041478322 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 11 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | version: 7 16 | --- !u!21 &2100000 17 | Material: 18 | serializedVersion: 8 19 | m_ObjectHideFlags: 0 20 | m_CorrespondingSourceObject: {fileID: 0} 21 | m_PrefabInstance: {fileID: 0} 22 | m_PrefabAsset: {fileID: 0} 23 | m_Name: Fasteners Decal Material 24 | m_Shader: {fileID: -6465566751694194690, guid: 7591ee611af01534c8c674cbd4ea4972, 25 | type: 3} 26 | m_Parent: {fileID: 0} 27 | m_ModifiedSerializedProperties: 0 28 | m_ValidKeywords: [] 29 | m_InvalidKeywords: [] 30 | m_LightmapFlags: 4 31 | m_EnableInstancingVariants: 1 32 | m_DoubleSidedGI: 0 33 | m_CustomRenderQueue: -1 34 | stringTagMap: {} 35 | disabledShaderPasses: [] 36 | m_LockedProperties: 37 | m_SavedProperties: 38 | serializedVersion: 3 39 | m_TexEnvs: 40 | - _BaseMap: 41 | m_Texture: {fileID: 0} 42 | m_Scale: {x: 1, y: 1} 43 | m_Offset: {x: 0, y: 0} 44 | - _BumpMap: 45 | m_Texture: {fileID: 0} 46 | m_Scale: {x: 1, y: 1} 47 | m_Offset: {x: 0, y: 0} 48 | - _DiffuseAlpha: 49 | m_Texture: {fileID: 2800000, guid: cc7230ee2f76fa54a878c52345bcc314, type: 3} 50 | m_Scale: {x: 1, y: 1} 51 | m_Offset: {x: 0, y: 0} 52 | - _EmissionMap: 53 | m_Texture: {fileID: 0} 54 | m_Scale: {x: 1, y: 1} 55 | m_Offset: {x: 0, y: 0} 56 | - _MainTex: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | - _MetallicGlossMap: 61 | m_Texture: {fileID: 0} 62 | m_Scale: {x: 1, y: 1} 63 | m_Offset: {x: 0, y: 0} 64 | - _MetallicSmoothnessOcclusion: 65 | m_Texture: {fileID: 2800000, guid: 327812225b4a74e4795c2a8761695745, type: 3} 66 | m_Scale: {x: 1, y: 1} 67 | m_Offset: {x: 0, y: 0} 68 | - _Normal: 69 | m_Texture: {fileID: 2800000, guid: 0900c5e630632764491d87aa967a138a, type: 3} 70 | m_Scale: {x: 1, y: 1} 71 | m_Offset: {x: 0, y: 0} 72 | - _OcclusionMap: 73 | m_Texture: {fileID: 0} 74 | m_Scale: {x: 1, y: 1} 75 | m_Offset: {x: 0, y: 0} 76 | - _SpecGlossMap: 77 | m_Texture: {fileID: 0} 78 | m_Scale: {x: 1, y: 1} 79 | m_Offset: {x: 0, y: 0} 80 | - unity_Lightmaps: 81 | m_Texture: {fileID: 0} 82 | m_Scale: {x: 1, y: 1} 83 | m_Offset: {x: 0, y: 0} 84 | - unity_LightmapsInd: 85 | m_Texture: {fileID: 0} 86 | m_Scale: {x: 1, y: 1} 87 | m_Offset: {x: 0, y: 0} 88 | - unity_ShadowMasks: 89 | m_Texture: {fileID: 0} 90 | m_Scale: {x: 1, y: 1} 91 | m_Offset: {x: 0, y: 0} 92 | m_Ints: [] 93 | m_Floats: 94 | - _AlphaClip: 0 95 | - _Blend: 0 96 | - _BumpScale: 1 97 | - _Cull: 2 98 | - _Cutoff: 0.5 99 | - _DstBlend: 0 100 | - _EnvironmentReflections: 1 101 | - _FlipU: 0 102 | - _FlipV: 0 103 | - _GlossMapScale: 0 104 | - _Glossiness: 0 105 | - _GlossyReflections: 0 106 | - _MaxAngleFadeRadians: 1.570796 107 | - _Metallic: 0 108 | - _MetallicMultiplier: 1 109 | - _MinAngleFadeRadians: 1.396263 110 | - _NormalMultiplier: 1 111 | - _OcclusionMultiplier: 1 112 | - _OcclusionStrength: 1 113 | - _OffsetViewZ: 0.001 114 | - _Opacity: 1 115 | - _QueueControl: 0 116 | - _QueueOffset: 0 117 | - _ReceiveShadows: 1 118 | - _Smoothness: 0.5 119 | - _SmoothnessMultiplier: 1 120 | - _SmoothnessTextureChannel: 0 121 | - _SpecularHighlights: 1 122 | - _SrcBlend: 1 123 | - _Surface: 0 124 | - _WorkflowMode: 1 125 | - _ZFadeStart: 0 126 | - _ZWrite: 1 127 | m_Colors: 128 | - _BaseColor: {r: 1, g: 1, b: 1, a: 1} 129 | - _Bounds: {r: 0, g: 0, b: 1, a: 1} 130 | - _Color: {r: 1, g: 1, b: 1, a: 1} 131 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 132 | - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} 133 | m_BuildTextureStacks: [] 134 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Material/Fasteners Decal Material.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41cdeb38201dd97469527bde6ed67f4b 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Material/fasteners - DiffuseAlpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Runtime/Sample Decals/Fasteners/Material/fasteners - DiffuseAlpha.png -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Material/fasteners - DiffuseAlpha.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc7230ee2f76fa54a878c52345bcc314 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 13 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | flipGreenChannel: 0 24 | isReadable: 0 25 | streamingMipmaps: 0 26 | streamingMipmapsPriority: 0 27 | vTOnly: 0 28 | ignoreMipmapLimit: 0 29 | grayScaleToAlpha: 0 30 | generateCubemap: 6 31 | cubemapConvolution: 0 32 | seamlessCubemap: 0 33 | textureFormat: 1 34 | maxTextureSize: 2048 35 | textureSettings: 36 | serializedVersion: 2 37 | filterMode: 1 38 | aniso: 2 39 | mipBias: 0 40 | wrapU: 0 41 | wrapV: 0 42 | wrapW: 0 43 | nPOTScale: 1 44 | lightmap: 0 45 | compressionQuality: 50 46 | spriteMode: 0 47 | spriteExtrude: 1 48 | spriteMeshType: 1 49 | alignment: 0 50 | spritePivot: {x: 0.5, y: 0.5} 51 | spritePixelsToUnits: 100 52 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 53 | spriteGenerateFallbackPhysicsShape: 1 54 | alphaUsage: 1 55 | alphaIsTransparency: 1 56 | spriteTessellationDetail: -1 57 | textureType: 0 58 | textureShape: 1 59 | singleChannelComponent: 0 60 | flipbookRows: 1 61 | flipbookColumns: 1 62 | maxTextureSizeSet: 0 63 | compressionQualitySet: 0 64 | textureFormatSet: 0 65 | ignorePngGamma: 0 66 | applyGammaDecoding: 0 67 | swizzle: 50462976 68 | cookieLightType: 1 69 | platformSettings: 70 | - serializedVersion: 3 71 | buildTarget: DefaultTexturePlatform 72 | maxTextureSize: 8192 73 | resizeAlgorithm: 0 74 | textureFormat: -1 75 | textureCompression: 1 76 | compressionQuality: 50 77 | crunchedCompression: 0 78 | allowsAlphaSplitting: 0 79 | overridden: 0 80 | ignorePlatformSupport: 0 81 | androidETC2FallbackOverride: 0 82 | forceMaximumCompressionQuality_BC6H_BC7: 0 83 | - serializedVersion: 3 84 | buildTarget: Standalone 85 | maxTextureSize: 8192 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | ignorePlatformSupport: 0 94 | androidETC2FallbackOverride: 0 95 | forceMaximumCompressionQuality_BC6H_BC7: 0 96 | - serializedVersion: 3 97 | buildTarget: iPhone 98 | maxTextureSize: 8192 99 | resizeAlgorithm: 0 100 | textureFormat: -1 101 | textureCompression: 1 102 | compressionQuality: 50 103 | crunchedCompression: 0 104 | allowsAlphaSplitting: 0 105 | overridden: 0 106 | ignorePlatformSupport: 0 107 | androidETC2FallbackOverride: 0 108 | forceMaximumCompressionQuality_BC6H_BC7: 0 109 | - serializedVersion: 3 110 | buildTarget: Android 111 | maxTextureSize: 8192 112 | resizeAlgorithm: 0 113 | textureFormat: -1 114 | textureCompression: 1 115 | compressionQuality: 50 116 | crunchedCompression: 0 117 | allowsAlphaSplitting: 0 118 | overridden: 0 119 | ignorePlatformSupport: 0 120 | androidETC2FallbackOverride: 0 121 | forceMaximumCompressionQuality_BC6H_BC7: 0 122 | - serializedVersion: 3 123 | buildTarget: Windows Store Apps 124 | maxTextureSize: 8192 125 | resizeAlgorithm: 0 126 | textureFormat: -1 127 | textureCompression: 1 128 | compressionQuality: 50 129 | crunchedCompression: 0 130 | allowsAlphaSplitting: 0 131 | overridden: 0 132 | ignorePlatformSupport: 0 133 | androidETC2FallbackOverride: 0 134 | forceMaximumCompressionQuality_BC6H_BC7: 0 135 | - serializedVersion: 3 136 | buildTarget: WebGL 137 | maxTextureSize: 8192 138 | resizeAlgorithm: 0 139 | textureFormat: -1 140 | textureCompression: 1 141 | compressionQuality: 50 142 | crunchedCompression: 0 143 | allowsAlphaSplitting: 0 144 | overridden: 0 145 | ignorePlatformSupport: 0 146 | androidETC2FallbackOverride: 0 147 | forceMaximumCompressionQuality_BC6H_BC7: 0 148 | spriteSheet: 149 | serializedVersion: 2 150 | sprites: [] 151 | outline: [] 152 | physicsShape: [] 153 | bones: [] 154 | spriteID: 155 | internalID: 0 156 | vertices: [] 157 | indices: 158 | edges: [] 159 | weights: [] 160 | secondaryTextures: [] 161 | nameFileIdTable: {} 162 | mipmapLimitGroupName: 163 | pSDRemoveMatte: 0 164 | userData: 165 | assetBundleName: 166 | assetBundleVariant: 167 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Material/fasteners - MSO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Runtime/Sample Decals/Fasteners/Material/fasteners - MSO.png -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Material/fasteners - MSO.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 327812225b4a74e4795c2a8761695745 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 0 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: 2 36 | mipBias: -100 37 | wrapU: 0 38 | wrapV: 0 39 | wrapW: 0 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 0 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 8192 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | - serializedVersion: 3 75 | buildTarget: Standalone 76 | maxTextureSize: 8192 77 | resizeAlgorithm: 0 78 | textureFormat: -1 79 | textureCompression: 1 80 | compressionQuality: 50 81 | crunchedCompression: 0 82 | allowsAlphaSplitting: 0 83 | overridden: 0 84 | androidETC2FallbackOverride: 0 85 | forceMaximumCompressionQuality_BC6H_BC7: 0 86 | - serializedVersion: 3 87 | buildTarget: iPhone 88 | maxTextureSize: 8192 89 | resizeAlgorithm: 0 90 | textureFormat: -1 91 | textureCompression: 1 92 | compressionQuality: 50 93 | crunchedCompression: 0 94 | allowsAlphaSplitting: 0 95 | overridden: 0 96 | androidETC2FallbackOverride: 0 97 | forceMaximumCompressionQuality_BC6H_BC7: 0 98 | - serializedVersion: 3 99 | buildTarget: Android 100 | maxTextureSize: 8192 101 | resizeAlgorithm: 0 102 | textureFormat: -1 103 | textureCompression: 1 104 | compressionQuality: 50 105 | crunchedCompression: 0 106 | allowsAlphaSplitting: 0 107 | overridden: 0 108 | androidETC2FallbackOverride: 0 109 | forceMaximumCompressionQuality_BC6H_BC7: 0 110 | - serializedVersion: 3 111 | buildTarget: Windows Store Apps 112 | maxTextureSize: 8192 113 | resizeAlgorithm: 0 114 | textureFormat: -1 115 | textureCompression: 1 116 | compressionQuality: 50 117 | crunchedCompression: 0 118 | allowsAlphaSplitting: 0 119 | overridden: 0 120 | androidETC2FallbackOverride: 0 121 | forceMaximumCompressionQuality_BC6H_BC7: 0 122 | - serializedVersion: 3 123 | buildTarget: WebGL 124 | maxTextureSize: 8192 125 | resizeAlgorithm: 0 126 | textureFormat: -1 127 | textureCompression: 1 128 | compressionQuality: 50 129 | crunchedCompression: 0 130 | allowsAlphaSplitting: 0 131 | overridden: 0 132 | androidETC2FallbackOverride: 0 133 | forceMaximumCompressionQuality_BC6H_BC7: 0 134 | spriteSheet: 135 | serializedVersion: 2 136 | sprites: [] 137 | outline: [] 138 | physicsShape: [] 139 | bones: [] 140 | spriteID: 141 | internalID: 0 142 | vertices: [] 143 | indices: 144 | edges: [] 145 | weights: [] 146 | secondaryTextures: [] 147 | spritePackingTag: 148 | pSDRemoveMatte: 0 149 | pSDShowRemoveMatteOption: 0 150 | userData: 151 | assetBundleName: 152 | assetBundleVariant: 153 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Material/fasteners - Normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Runtime/Sample Decals/Fasteners/Material/fasteners - Normal.png -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Material/fasteners - Normal.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0900c5e630632764491d87aa967a138a 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 0 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: 2 36 | mipBias: -100 37 | wrapU: 0 38 | wrapV: 0 39 | wrapW: 0 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 0 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 1 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 8192 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | - serializedVersion: 3 75 | buildTarget: Standalone 76 | maxTextureSize: 8192 77 | resizeAlgorithm: 0 78 | textureFormat: -1 79 | textureCompression: 1 80 | compressionQuality: 50 81 | crunchedCompression: 0 82 | allowsAlphaSplitting: 0 83 | overridden: 0 84 | androidETC2FallbackOverride: 0 85 | forceMaximumCompressionQuality_BC6H_BC7: 0 86 | - serializedVersion: 3 87 | buildTarget: iPhone 88 | maxTextureSize: 8192 89 | resizeAlgorithm: 0 90 | textureFormat: -1 91 | textureCompression: 1 92 | compressionQuality: 50 93 | crunchedCompression: 0 94 | allowsAlphaSplitting: 0 95 | overridden: 0 96 | androidETC2FallbackOverride: 0 97 | forceMaximumCompressionQuality_BC6H_BC7: 0 98 | - serializedVersion: 3 99 | buildTarget: Android 100 | maxTextureSize: 8192 101 | resizeAlgorithm: 0 102 | textureFormat: -1 103 | textureCompression: 1 104 | compressionQuality: 50 105 | crunchedCompression: 0 106 | allowsAlphaSplitting: 0 107 | overridden: 0 108 | androidETC2FallbackOverride: 0 109 | forceMaximumCompressionQuality_BC6H_BC7: 0 110 | - serializedVersion: 3 111 | buildTarget: Windows Store Apps 112 | maxTextureSize: 8192 113 | resizeAlgorithm: 0 114 | textureFormat: -1 115 | textureCompression: 1 116 | compressionQuality: 50 117 | crunchedCompression: 0 118 | allowsAlphaSplitting: 0 119 | overridden: 0 120 | androidETC2FallbackOverride: 0 121 | forceMaximumCompressionQuality_BC6H_BC7: 0 122 | - serializedVersion: 3 123 | buildTarget: WebGL 124 | maxTextureSize: 8192 125 | resizeAlgorithm: 0 126 | textureFormat: -1 127 | textureCompression: 1 128 | compressionQuality: 50 129 | crunchedCompression: 0 130 | allowsAlphaSplitting: 0 131 | overridden: 0 132 | androidETC2FallbackOverride: 0 133 | forceMaximumCompressionQuality_BC6H_BC7: 0 134 | spriteSheet: 135 | serializedVersion: 2 136 | sprites: [] 137 | outline: [] 138 | physicsShape: [] 139 | bones: [] 140 | spriteID: 141 | internalID: 0 142 | vertices: [] 143 | indices: 144 | edges: [] 145 | weights: [] 146 | secondaryTextures: [] 147 | spritePackingTag: 148 | pSDRemoveMatte: 0 149 | pSDShowRemoveMatteOption: 0 150 | userData: 151 | assetBundleName: 152 | assetBundleVariant: 153 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Nut in indent.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8cd7be7c3532c974c919d1b2a4cf439b, type: 3} 13 | m_Name: Nut in indent 14 | m_EditorClassIdentifier: 15 | Material: {fileID: 2100000, guid: 41cdeb38201dd97469527bde6ed67f4b, type: 2} 16 | uMin: 0.34 17 | vMin: 0.23714286 18 | uMax: 0.6685714 19 | vMax: 0.56285715 20 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Nut in indent.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8e59262b04f8f0c4aab799d182e0c461 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Nut.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8cd7be7c3532c974c919d1b2a4cf439b, type: 3} 13 | m_Name: Nut 14 | m_EditorClassIdentifier: 15 | Material: {fileID: 2100000, guid: 41cdeb38201dd97469527bde6ed67f4b, type: 2} 16 | uMin: 0.74285716 17 | vMin: 0.022857143 18 | uMax: 0.9657143 19 | vMax: 0.24 20 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Nut.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 32f595d2b6e27bb4a85a288a55380d16 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Screw and washer.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8cd7be7c3532c974c919d1b2a4cf439b, type: 3} 13 | m_Name: Screw and washer 14 | m_EditorClassIdentifier: 15 | Material: {fileID: 2100000, guid: 41cdeb38201dd97469527bde6ed67f4b, type: 2} 16 | uMin: 0.5247748 17 | vMin: 0.039930753 18 | uMax: 0.7178149 19 | vMax: 0.23665452 20 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Screw and washer.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e7a1403de7417644b3072c3eafd96b3 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Screw in indent.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8cd7be7c3532c974c919d1b2a4cf439b, type: 3} 13 | m_Name: Screw in indent 14 | m_EditorClassIdentifier: 15 | Material: {fileID: 2100000, guid: 41cdeb38201dd97469527bde6ed67f4b, type: 2} 16 | uMin: 0.6840146 17 | vMin: 0.24463588 18 | uMax: 0.98439366 19 | vMax: 0.5533265 20 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Screw in indent.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6466a829781676145baa3b21f1955717 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Screw.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8cd7be7c3532c974c919d1b2a4cf439b, type: 3} 13 | m_Name: Screw 14 | m_EditorClassIdentifier: 15 | Material: {fileID: 2100000, guid: 41cdeb38201dd97469527bde6ed67f4b, type: 2} 16 | uMin: 0.2841239 17 | vMin: 0.042857144 18 | uMax: 0.47714287 19 | vMax: 0.23699777 20 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Fasteners/Screw.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22aae6f77dfa8c54b8fa56769793d19d 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Simple.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 432f3a462464fc04fbb55fa1d2a5d30e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Simple/Grid.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8cd7be7c3532c974c919d1b2a4cf439b, type: 3} 13 | m_Name: Grid 14 | m_EditorClassIdentifier: 15 | Material: {fileID: 2100000, guid: 20159b3cdda77ae4198a085a1fab3a51, type: 2} 16 | uMin: 0 17 | vMin: 0 18 | uMax: 1 19 | vMax: 1 20 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Simple/Grid.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0c8f4add8d0bdad43a5e08f060163266 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Simple/Material.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f70617f9845c8a74b865cfa8649029de 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Simple/Material/Flat Decal Material.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &-2420921675099302747 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 11 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | version: 7 16 | --- !u!21 &2100000 17 | Material: 18 | serializedVersion: 8 19 | m_ObjectHideFlags: 0 20 | m_CorrespondingSourceObject: {fileID: 0} 21 | m_PrefabInstance: {fileID: 0} 22 | m_PrefabAsset: {fileID: 0} 23 | m_Name: Flat Decal Material 24 | m_Shader: {fileID: -6465566751694194690, guid: 8a85cb34c1498244f83d33290e90b149, 25 | type: 3} 26 | m_Parent: {fileID: 0} 27 | m_ModifiedSerializedProperties: 0 28 | m_ValidKeywords: [] 29 | m_InvalidKeywords: [] 30 | m_LightmapFlags: 4 31 | m_EnableInstancingVariants: 0 32 | m_DoubleSidedGI: 0 33 | m_CustomRenderQueue: -1 34 | stringTagMap: {} 35 | disabledShaderPasses: [] 36 | m_LockedProperties: 37 | m_SavedProperties: 38 | serializedVersion: 3 39 | m_TexEnvs: 40 | - _BaseMap: 41 | m_Texture: {fileID: 0} 42 | m_Scale: {x: 1, y: 1} 43 | m_Offset: {x: 0, y: 0} 44 | - _BumpMap: 45 | m_Texture: {fileID: 0} 46 | m_Scale: {x: 1, y: 1} 47 | m_Offset: {x: 0, y: 0} 48 | - _DiffuseAlpha: 49 | m_Texture: {fileID: 2800000, guid: 5e6fc5644f3a66347b53b09ce94a2eb9, type: 3} 50 | m_Scale: {x: 1, y: 1} 51 | m_Offset: {x: 0, y: 0} 52 | - _EmissionMap: 53 | m_Texture: {fileID: 0} 54 | m_Scale: {x: 1, y: 1} 55 | m_Offset: {x: 0, y: 0} 56 | - _MainTex: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | - _MetallicGlossMap: 61 | m_Texture: {fileID: 0} 62 | m_Scale: {x: 1, y: 1} 63 | m_Offset: {x: 0, y: 0} 64 | - _OcclusionMap: 65 | m_Texture: {fileID: 0} 66 | m_Scale: {x: 1, y: 1} 67 | m_Offset: {x: 0, y: 0} 68 | - _SpecGlossMap: 69 | m_Texture: {fileID: 0} 70 | m_Scale: {x: 1, y: 1} 71 | m_Offset: {x: 0, y: 0} 72 | - unity_Lightmaps: 73 | m_Texture: {fileID: 0} 74 | m_Scale: {x: 1, y: 1} 75 | m_Offset: {x: 0, y: 0} 76 | - unity_LightmapsInd: 77 | m_Texture: {fileID: 0} 78 | m_Scale: {x: 1, y: 1} 79 | m_Offset: {x: 0, y: 0} 80 | - unity_ShadowMasks: 81 | m_Texture: {fileID: 0} 82 | m_Scale: {x: 1, y: 1} 83 | m_Offset: {x: 0, y: 0} 84 | m_Ints: [] 85 | m_Floats: 86 | - _AlphaClip: 0 87 | - _Ambient: 0.5 88 | - _Blend: 0 89 | - _BumpScale: 1 90 | - _Cull: 2 91 | - _Cutoff: 0.5 92 | - _DstBlend: 0 93 | - _EnvironmentReflections: 1 94 | - _FlipU: 0 95 | - _FlipV: 0 96 | - _GlossMapScale: 0 97 | - _Glossiness: 0 98 | - _GlossyReflections: 0 99 | - _MaxAngleFadeRadians: 1.570796 100 | - _Metallic: 0 101 | - _MinAngleFadeRadians: 1.396263 102 | - _OcclusionStrength: 1 103 | - _OffsetViewZ: 0.001 104 | - _Opacity: 0.78 105 | - _QueueControl: 0 106 | - _QueueOffset: 0 107 | - _ReceiveShadows: 1 108 | - _Smoothness: 0.5 109 | - _SmoothnessTextureChannel: 0 110 | - _SpecularHighlights: 1 111 | - _SrcBlend: 1 112 | - _Surface: 0 113 | - _WorkflowMode: 1 114 | - _ZFadeStart: -1 115 | - _ZWrite: 1 116 | m_Colors: 117 | - _BaseColor: {r: 1, g: 1, b: 1, a: 1} 118 | - _Bounds: {r: 0, g: 0, b: 1, a: 1} 119 | - _Color: {r: 1, g: 1, b: 1, a: 1} 120 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 121 | - _FlatColour: {r: 0.20558918, g: 0.6372988, b: 0.7924528, a: 0} 122 | - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} 123 | m_BuildTextureStacks: [] 124 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Simple/Material/Flat Decal Material.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 66f15ee85b0dc674bb5a8a7c30007a1e 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Simple/Material/Grid Decal Material.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Grid Decal Material 11 | m_Shader: {fileID: -6465566751694194690, guid: aa8953bcd9bbb6b4f8e5f84887b0fdd2, 12 | type: 3} 13 | m_Parent: {fileID: 0} 14 | m_ModifiedSerializedProperties: 0 15 | m_ValidKeywords: [] 16 | m_InvalidKeywords: [] 17 | m_LightmapFlags: 4 18 | m_EnableInstancingVariants: 0 19 | m_DoubleSidedGI: 0 20 | m_CustomRenderQueue: -1 21 | stringTagMap: {} 22 | disabledShaderPasses: [] 23 | m_LockedProperties: 24 | m_SavedProperties: 25 | serializedVersion: 3 26 | m_TexEnvs: 27 | - _BASE_COLOR_MAP: 28 | m_Texture: {fileID: 0} 29 | m_Scale: {x: 1, y: 1} 30 | m_Offset: {x: 0, y: 0} 31 | - _BaseMap: 32 | m_Texture: {fileID: 0} 33 | m_Scale: {x: 1, y: 1} 34 | m_Offset: {x: 0, y: 0} 35 | - _BumpMap: 36 | m_Texture: {fileID: 0} 37 | m_Scale: {x: 1, y: 1} 38 | m_Offset: {x: 0, y: 0} 39 | - _DiffuseAlpha: 40 | m_Texture: {fileID: 2800000, guid: 5e6fc5644f3a66347b53b09ce94a2eb9, type: 3} 41 | m_Scale: {x: 1, y: 1} 42 | m_Offset: {x: 0, y: 0} 43 | - _EMISSION_COLOR_MAP: 44 | m_Texture: {fileID: 0} 45 | m_Scale: {x: 1, y: 1} 46 | m_Offset: {x: 0, y: 0} 47 | - _EmissionMap: 48 | m_Texture: {fileID: 0} 49 | m_Scale: {x: 1, y: 1} 50 | m_Offset: {x: 0, y: 0} 51 | - _METALNESS_MAP: 52 | m_Texture: {fileID: 0} 53 | m_Scale: {x: 1, y: 1} 54 | m_Offset: {x: 0, y: 0} 55 | - _MainTex: 56 | m_Texture: {fileID: 0} 57 | m_Scale: {x: 1, y: 1} 58 | m_Offset: {x: 0, y: 0} 59 | - _MetallicGlossMap: 60 | m_Texture: {fileID: 0} 61 | m_Scale: {x: 1, y: 1} 62 | m_Offset: {x: 0, y: 0} 63 | - _NORMAL_MAP: 64 | m_Texture: {fileID: 0} 65 | m_Scale: {x: 1, y: 1} 66 | m_Offset: {x: 0, y: 0} 67 | - _OcclusionMap: 68 | m_Texture: {fileID: 0} 69 | m_Scale: {x: 1, y: 1} 70 | m_Offset: {x: 0, y: 0} 71 | - _SPECULAR_COLOR_MAP: 72 | m_Texture: {fileID: 0} 73 | m_Scale: {x: 1, y: 1} 74 | m_Offset: {x: 0, y: 0} 75 | - _SPECULAR_IOR_MAP: 76 | m_Texture: {fileID: 0} 77 | m_Scale: {x: 1, y: 1} 78 | m_Offset: {x: 0, y: 0} 79 | - _SPECULAR_ROUGHNESS_MAP: 80 | m_Texture: {fileID: 0} 81 | m_Scale: {x: 1, y: 1} 82 | m_Offset: {x: 0, y: 0} 83 | - _SpecGlossMap: 84 | m_Texture: {fileID: 0} 85 | m_Scale: {x: 1, y: 1} 86 | m_Offset: {x: 0, y: 0} 87 | - unity_Lightmaps: 88 | m_Texture: {fileID: 0} 89 | m_Scale: {x: 1, y: 1} 90 | m_Offset: {x: 0, y: 0} 91 | - unity_LightmapsInd: 92 | m_Texture: {fileID: 0} 93 | m_Scale: {x: 1, y: 1} 94 | m_Offset: {x: 0, y: 0} 95 | - unity_ShadowMasks: 96 | m_Texture: {fileID: 0} 97 | m_Scale: {x: 1, y: 1} 98 | m_Offset: {x: 0, y: 0} 99 | m_Ints: [] 100 | m_Floats: 101 | - _AlphaClip: 0 102 | - _Ambient: 0.5 103 | - _Blend: 0 104 | - _BumpScale: 1 105 | - _Cull: 2 106 | - _Cutoff: 0.5 107 | - _DstBlend: 0 108 | - _EnvironmentReflections: 1 109 | - _FlipU: 0 110 | - _FlipV: 0 111 | - _GlossMapScale: 0 112 | - _Glossiness: 0 113 | - _GlossyReflections: 0 114 | - _METALNESS: 0 115 | - _MaxAngleFadeRadians: 0.7853982 116 | - _Metallic: 0 117 | - _MinAngleFadeRadians: 0.5235988 118 | - _OcclusionStrength: 1 119 | - _OffsetViewZ: 0.001 120 | - _Opacity: 1 121 | - _QueueControl: 0 122 | - _QueueOffset: 0 123 | - _ReceiveShadows: 1 124 | - _SPECULAR_IOR: 1.5 125 | - _SPECULAR_ROUGHNESS: 0 126 | - _Smoothness: 0 127 | - _SmoothnessTextureChannel: 0 128 | - _SpecularHighlights: 1 129 | - _SrcBlend: 1 130 | - _Surface: 0 131 | - _WorkflowMode: 1 132 | - _ZFadeStart: 0.1 133 | - _ZWrite: 1 134 | m_Colors: 135 | - _BASE_COLOR: {r: 0, g: 0, b: 0, a: 0} 136 | - _BaseColor: {r: 1, g: 1, b: 1, a: 1} 137 | - _Bounds: {r: 0, g: 0, b: 1, a: 1} 138 | - _Color: {r: 1, g: 1, b: 1, a: 1} 139 | - _EMISSION_COLOR: {r: 0, g: 0, b: 0, a: 0} 140 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 141 | - _SPECULAR_COLOR: {r: 1, g: 1, b: 1, a: 0} 142 | - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} 143 | m_BuildTextureStacks: [] 144 | --- !u!114 &2565576085879317660 145 | MonoBehaviour: 146 | m_ObjectHideFlags: 11 147 | m_CorrespondingSourceObject: {fileID: 0} 148 | m_PrefabInstance: {fileID: 0} 149 | m_PrefabAsset: {fileID: 0} 150 | m_GameObject: {fileID: 0} 151 | m_Enabled: 1 152 | m_EditorHideFlags: 0 153 | m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} 154 | m_Name: 155 | m_EditorClassIdentifier: 156 | version: 7 157 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Simple/Material/Grid Decal Material.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20159b3cdda77ae4198a085a1fab3a51 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Simple/Material/Grid256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Runtime/Sample Decals/Simple/Material/Grid256.png -------------------------------------------------------------------------------- /Runtime/Sample Decals/Simple/Material/Grid256.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e6fc5644f3a66347b53b09ce94a2eb9 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: 2 36 | mipBias: -100 37 | wrapU: 0 38 | wrapV: 0 39 | wrapW: 0 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 0 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 8192 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | - serializedVersion: 3 75 | buildTarget: Standalone 76 | maxTextureSize: 8192 77 | resizeAlgorithm: 0 78 | textureFormat: -1 79 | textureCompression: 1 80 | compressionQuality: 50 81 | crunchedCompression: 0 82 | allowsAlphaSplitting: 0 83 | overridden: 0 84 | androidETC2FallbackOverride: 0 85 | forceMaximumCompressionQuality_BC6H_BC7: 0 86 | - serializedVersion: 3 87 | buildTarget: iPhone 88 | maxTextureSize: 8192 89 | resizeAlgorithm: 0 90 | textureFormat: -1 91 | textureCompression: 1 92 | compressionQuality: 50 93 | crunchedCompression: 0 94 | allowsAlphaSplitting: 0 95 | overridden: 0 96 | androidETC2FallbackOverride: 0 97 | forceMaximumCompressionQuality_BC6H_BC7: 0 98 | - serializedVersion: 3 99 | buildTarget: Android 100 | maxTextureSize: 8192 101 | resizeAlgorithm: 0 102 | textureFormat: -1 103 | textureCompression: 1 104 | compressionQuality: 50 105 | crunchedCompression: 0 106 | allowsAlphaSplitting: 0 107 | overridden: 0 108 | androidETC2FallbackOverride: 0 109 | forceMaximumCompressionQuality_BC6H_BC7: 0 110 | - serializedVersion: 3 111 | buildTarget: Windows Store Apps 112 | maxTextureSize: 8192 113 | resizeAlgorithm: 0 114 | textureFormat: -1 115 | textureCompression: 1 116 | compressionQuality: 50 117 | crunchedCompression: 0 118 | allowsAlphaSplitting: 0 119 | overridden: 0 120 | androidETC2FallbackOverride: 0 121 | forceMaximumCompressionQuality_BC6H_BC7: 0 122 | - serializedVersion: 3 123 | buildTarget: WebGL 124 | maxTextureSize: 8192 125 | resizeAlgorithm: 0 126 | textureFormat: -1 127 | textureCompression: 1 128 | compressionQuality: 50 129 | crunchedCompression: 0 130 | allowsAlphaSplitting: 0 131 | overridden: 0 132 | androidETC2FallbackOverride: 0 133 | forceMaximumCompressionQuality_BC6H_BC7: 0 134 | spriteSheet: 135 | serializedVersion: 2 136 | sprites: [] 137 | outline: [] 138 | physicsShape: [] 139 | bones: [] 140 | spriteID: 141 | internalID: 0 142 | vertices: [] 143 | indices: 144 | edges: [] 145 | weights: [] 146 | secondaryTextures: [] 147 | spritePackingTag: 148 | pSDRemoveMatte: 0 149 | pSDShowRemoveMatteOption: 0 150 | userData: 151 | assetBundleName: 152 | assetBundleVariant: 153 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Simple/Material/Unlit Grid Decal Material.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &-2420921675099302747 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 11 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | version: 7 16 | --- !u!21 &2100000 17 | Material: 18 | serializedVersion: 8 19 | m_ObjectHideFlags: 0 20 | m_CorrespondingSourceObject: {fileID: 0} 21 | m_PrefabInstance: {fileID: 0} 22 | m_PrefabAsset: {fileID: 0} 23 | m_Name: Unlit Grid Decal Material 24 | m_Shader: {fileID: -6465566751694194690, guid: 7089fcadafe293f48b06c9934274a7f1, 25 | type: 3} 26 | m_Parent: {fileID: 0} 27 | m_ModifiedSerializedProperties: 0 28 | m_ValidKeywords: [] 29 | m_InvalidKeywords: [] 30 | m_LightmapFlags: 4 31 | m_EnableInstancingVariants: 0 32 | m_DoubleSidedGI: 0 33 | m_CustomRenderQueue: -1 34 | stringTagMap: {} 35 | disabledShaderPasses: [] 36 | m_LockedProperties: 37 | m_SavedProperties: 38 | serializedVersion: 3 39 | m_TexEnvs: 40 | - _BaseMap: 41 | m_Texture: {fileID: 0} 42 | m_Scale: {x: 1, y: 1} 43 | m_Offset: {x: 0, y: 0} 44 | - _BumpMap: 45 | m_Texture: {fileID: 0} 46 | m_Scale: {x: 1, y: 1} 47 | m_Offset: {x: 0, y: 0} 48 | - _DiffuseAlpha: 49 | m_Texture: {fileID: 2800000, guid: 5e6fc5644f3a66347b53b09ce94a2eb9, type: 3} 50 | m_Scale: {x: 1, y: 1} 51 | m_Offset: {x: 0, y: 0} 52 | - _EmissionMap: 53 | m_Texture: {fileID: 0} 54 | m_Scale: {x: 1, y: 1} 55 | m_Offset: {x: 0, y: 0} 56 | - _MainTex: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | - _MetallicGlossMap: 61 | m_Texture: {fileID: 0} 62 | m_Scale: {x: 1, y: 1} 63 | m_Offset: {x: 0, y: 0} 64 | - _OcclusionMap: 65 | m_Texture: {fileID: 0} 66 | m_Scale: {x: 1, y: 1} 67 | m_Offset: {x: 0, y: 0} 68 | - _SpecGlossMap: 69 | m_Texture: {fileID: 0} 70 | m_Scale: {x: 1, y: 1} 71 | m_Offset: {x: 0, y: 0} 72 | - unity_Lightmaps: 73 | m_Texture: {fileID: 0} 74 | m_Scale: {x: 1, y: 1} 75 | m_Offset: {x: 0, y: 0} 76 | - unity_LightmapsInd: 77 | m_Texture: {fileID: 0} 78 | m_Scale: {x: 1, y: 1} 79 | m_Offset: {x: 0, y: 0} 80 | - unity_ShadowMasks: 81 | m_Texture: {fileID: 0} 82 | m_Scale: {x: 1, y: 1} 83 | m_Offset: {x: 0, y: 0} 84 | m_Ints: [] 85 | m_Floats: 86 | - _AlphaClip: 0 87 | - _Ambient: 0.5 88 | - _Blend: 0 89 | - _BumpScale: 1 90 | - _Cull: 2 91 | - _Cutoff: 0.5 92 | - _DstBlend: 0 93 | - _EnvironmentReflections: 1 94 | - _FlipU: 0 95 | - _FlipV: 0 96 | - _GlossMapScale: 0 97 | - _Glossiness: 0 98 | - _GlossyReflections: 0 99 | - _MaxAngleFadeRadians: 1.570796 100 | - _Metallic: 0 101 | - _MinAngleFadeRadians: 1.396263 102 | - _OcclusionStrength: 1 103 | - _OffsetViewZ: 0.001 104 | - _Opacity: 1 105 | - _QueueControl: 0 106 | - _QueueOffset: 0 107 | - _ReceiveShadows: 1 108 | - _Smoothness: 0.5 109 | - _SmoothnessTextureChannel: 0 110 | - _SpecularHighlights: 1 111 | - _SrcBlend: 1 112 | - _Surface: 0 113 | - _WorkflowMode: 1 114 | - _ZFadeStart: 0.1 115 | - _ZWrite: 1 116 | m_Colors: 117 | - _BaseColor: {r: 1, g: 1, b: 1, a: 1} 118 | - _Bounds: {r: 0, g: 0, b: 1, a: 1} 119 | - _Color: {r: 1, g: 1, b: 1, a: 1} 120 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 121 | - _FlatColour: {r: 0.20558918, g: 0.6372988, b: 0.7924528, a: 0} 122 | - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} 123 | m_BuildTextureStacks: [] 124 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Simple/Material/Unlit Grid Decal Material.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a3413b0bd8175941a1fb9c256b3596b 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Simple/Unlit Grid.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8cd7be7c3532c974c919d1b2a4cf439b, type: 3} 13 | m_Name: Unlit Grid 14 | m_EditorClassIdentifier: 15 | Material: {fileID: 2100000, guid: 3a3413b0bd8175941a1fb9c256b3596b, type: 2} 16 | uMin: 0 17 | vMin: 0 18 | uMax: 1 19 | vMax: 1 20 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Simple/Unlit Grid.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc93dd56b0e153b4ab531f039230ddab 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Sticky Notes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52324249253952849b2b0590f41b5c7e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Sticky Notes/Code Note.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8cd7be7c3532c974c919d1b2a4cf439b, type: 3} 13 | m_Name: Code Note 14 | m_EditorClassIdentifier: 15 | Material: {fileID: 2100000, guid: ef4c4653fdc45e94b8bbb30e94f1a041, type: 2} 16 | uMin: 0 17 | vMin: 0 18 | uMax: 1 19 | vMax: 1 20 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Sticky Notes/Code Note.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5037c6031f963fc48b114cb50626f0d3 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Sticky Notes/Material.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ee13f494ccb53640b2434b5684a3fbc 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Sticky Notes/Material/Note Decal Material.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &-274977968684644419 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 11 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | version: 7 16 | --- !u!21 &2100000 17 | Material: 18 | serializedVersion: 8 19 | m_ObjectHideFlags: 0 20 | m_CorrespondingSourceObject: {fileID: 0} 21 | m_PrefabInstance: {fileID: 0} 22 | m_PrefabAsset: {fileID: 0} 23 | m_Name: Note Decal Material 24 | m_Shader: {fileID: -6465566751694194690, guid: 7591ee611af01534c8c674cbd4ea4972, 25 | type: 3} 26 | m_Parent: {fileID: 0} 27 | m_ModifiedSerializedProperties: 0 28 | m_ValidKeywords: [] 29 | m_InvalidKeywords: [] 30 | m_LightmapFlags: 4 31 | m_EnableInstancingVariants: 0 32 | m_DoubleSidedGI: 0 33 | m_CustomRenderQueue: -1 34 | stringTagMap: {} 35 | disabledShaderPasses: [] 36 | m_LockedProperties: 37 | m_SavedProperties: 38 | serializedVersion: 3 39 | m_TexEnvs: 40 | - _BaseMap: 41 | m_Texture: {fileID: 0} 42 | m_Scale: {x: 1, y: 1} 43 | m_Offset: {x: 0, y: 0} 44 | - _BumpMap: 45 | m_Texture: {fileID: 0} 46 | m_Scale: {x: 1, y: 1} 47 | m_Offset: {x: 0, y: 0} 48 | - _DiffuseAlpha: 49 | m_Texture: {fileID: 2800000, guid: 9d84a4351b749ea4fa7f2eca2f679f0a, type: 3} 50 | m_Scale: {x: 1, y: 1} 51 | m_Offset: {x: 0, y: 0} 52 | - _EmissionMap: 53 | m_Texture: {fileID: 0} 54 | m_Scale: {x: 1, y: 1} 55 | m_Offset: {x: 0, y: 0} 56 | - _MainTex: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | - _MetallicGlossMap: 61 | m_Texture: {fileID: 0} 62 | m_Scale: {x: 1, y: 1} 63 | m_Offset: {x: 0, y: 0} 64 | - _MetallicSmoothnessOcclusion: 65 | m_Texture: {fileID: 2800000, guid: f8eb0b09a3f1c95448255a576e4b706e, type: 3} 66 | m_Scale: {x: 1, y: 1} 67 | m_Offset: {x: 0, y: 0} 68 | - _Normal: 69 | m_Texture: {fileID: 2800000, guid: 9984b30e7c719b54b87623e504b2de2a, type: 3} 70 | m_Scale: {x: 1, y: 1} 71 | m_Offset: {x: 0, y: 0} 72 | - _OcclusionMap: 73 | m_Texture: {fileID: 0} 74 | m_Scale: {x: 1, y: 1} 75 | m_Offset: {x: 0, y: 0} 76 | - _SpecGlossMap: 77 | m_Texture: {fileID: 0} 78 | m_Scale: {x: 1, y: 1} 79 | m_Offset: {x: 0, y: 0} 80 | - unity_Lightmaps: 81 | m_Texture: {fileID: 0} 82 | m_Scale: {x: 1, y: 1} 83 | m_Offset: {x: 0, y: 0} 84 | - unity_LightmapsInd: 85 | m_Texture: {fileID: 0} 86 | m_Scale: {x: 1, y: 1} 87 | m_Offset: {x: 0, y: 0} 88 | - unity_ShadowMasks: 89 | m_Texture: {fileID: 0} 90 | m_Scale: {x: 1, y: 1} 91 | m_Offset: {x: 0, y: 0} 92 | m_Ints: [] 93 | m_Floats: 94 | - _AlphaClip: 0 95 | - _Blend: 0 96 | - _BumpScale: 1 97 | - _Cull: 2 98 | - _Cutoff: 0.5 99 | - _DstBlend: 0 100 | - _EnvironmentReflections: 1 101 | - _FlipU: 0 102 | - _FlipV: 0 103 | - _GlossMapScale: 0 104 | - _Glossiness: 0 105 | - _GlossyReflections: 0 106 | - _MaxAngleFadeRadians: 1.570796 107 | - _Metallic: 0 108 | - _MetallicMultiplier: 1 109 | - _MinAngleFadeRadians: 1.396263 110 | - _NormalMultiplier: 1 111 | - _OcclusionMultiplier: 1 112 | - _OcclusionStrength: 1 113 | - _OffsetViewZ: 0.001 114 | - _Opacity: 1 115 | - _QueueControl: 0 116 | - _QueueOffset: 0 117 | - _ReceiveShadows: 1 118 | - _Smoothness: 0.5 119 | - _SmoothnessMultiplier: 1 120 | - _SmoothnessTextureChannel: 0 121 | - _SpecularHighlights: 1 122 | - _SrcBlend: 1 123 | - _Surface: 0 124 | - _WorkflowMode: 1 125 | - _ZFadeStart: 0 126 | - _ZWrite: 1 127 | m_Colors: 128 | - _BaseColor: {r: 1, g: 1, b: 1, a: 1} 129 | - _Bounds: {r: 0, g: 0, b: 1, a: 1} 130 | - _Color: {r: 1, g: 1, b: 1, a: 1} 131 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 132 | - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} 133 | m_BuildTextureStacks: [] 134 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Sticky Notes/Material/Note Decal Material.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ef4c4653fdc45e94b8bbb30e94f1a041 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Sticky Notes/Material/postit-code - DiffuseAlpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Runtime/Sample Decals/Sticky Notes/Material/postit-code - DiffuseAlpha.png -------------------------------------------------------------------------------- /Runtime/Sample Decals/Sticky Notes/Material/postit-code - DiffuseAlpha.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9d84a4351b749ea4fa7f2eca2f679f0a 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: 2 36 | mipBias: -100 37 | wrapU: 0 38 | wrapV: 0 39 | wrapW: 0 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 1 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 8192 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | - serializedVersion: 3 75 | buildTarget: Standalone 76 | maxTextureSize: 8192 77 | resizeAlgorithm: 0 78 | textureFormat: -1 79 | textureCompression: 1 80 | compressionQuality: 50 81 | crunchedCompression: 0 82 | allowsAlphaSplitting: 0 83 | overridden: 0 84 | androidETC2FallbackOverride: 0 85 | forceMaximumCompressionQuality_BC6H_BC7: 0 86 | - serializedVersion: 3 87 | buildTarget: iPhone 88 | maxTextureSize: 8192 89 | resizeAlgorithm: 0 90 | textureFormat: -1 91 | textureCompression: 1 92 | compressionQuality: 50 93 | crunchedCompression: 0 94 | allowsAlphaSplitting: 0 95 | overridden: 0 96 | androidETC2FallbackOverride: 0 97 | forceMaximumCompressionQuality_BC6H_BC7: 0 98 | - serializedVersion: 3 99 | buildTarget: Android 100 | maxTextureSize: 8192 101 | resizeAlgorithm: 0 102 | textureFormat: -1 103 | textureCompression: 1 104 | compressionQuality: 50 105 | crunchedCompression: 0 106 | allowsAlphaSplitting: 0 107 | overridden: 0 108 | androidETC2FallbackOverride: 0 109 | forceMaximumCompressionQuality_BC6H_BC7: 0 110 | - serializedVersion: 3 111 | buildTarget: Windows Store Apps 112 | maxTextureSize: 8192 113 | resizeAlgorithm: 0 114 | textureFormat: -1 115 | textureCompression: 1 116 | compressionQuality: 50 117 | crunchedCompression: 0 118 | allowsAlphaSplitting: 0 119 | overridden: 0 120 | androidETC2FallbackOverride: 0 121 | forceMaximumCompressionQuality_BC6H_BC7: 0 122 | - serializedVersion: 3 123 | buildTarget: WebGL 124 | maxTextureSize: 8192 125 | resizeAlgorithm: 0 126 | textureFormat: -1 127 | textureCompression: 1 128 | compressionQuality: 50 129 | crunchedCompression: 0 130 | allowsAlphaSplitting: 0 131 | overridden: 0 132 | androidETC2FallbackOverride: 0 133 | forceMaximumCompressionQuality_BC6H_BC7: 0 134 | spriteSheet: 135 | serializedVersion: 2 136 | sprites: [] 137 | outline: [] 138 | physicsShape: [] 139 | bones: [] 140 | spriteID: 141 | internalID: 0 142 | vertices: [] 143 | indices: 144 | edges: [] 145 | weights: [] 146 | secondaryTextures: [] 147 | spritePackingTag: 148 | pSDRemoveMatte: 0 149 | pSDShowRemoveMatteOption: 0 150 | userData: 151 | assetBundleName: 152 | assetBundleVariant: 153 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Sticky Notes/Material/postit-code - MSO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Runtime/Sample Decals/Sticky Notes/Material/postit-code - MSO.png -------------------------------------------------------------------------------- /Runtime/Sample Decals/Sticky Notes/Material/postit-code - MSO.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8eb0b09a3f1c95448255a576e4b706e 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 0 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: 2 36 | mipBias: -100 37 | wrapU: 0 38 | wrapV: 0 39 | wrapW: 0 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 0 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 8192 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | - serializedVersion: 3 75 | buildTarget: Standalone 76 | maxTextureSize: 8192 77 | resizeAlgorithm: 0 78 | textureFormat: -1 79 | textureCompression: 1 80 | compressionQuality: 50 81 | crunchedCompression: 0 82 | allowsAlphaSplitting: 0 83 | overridden: 0 84 | androidETC2FallbackOverride: 0 85 | forceMaximumCompressionQuality_BC6H_BC7: 0 86 | - serializedVersion: 3 87 | buildTarget: iPhone 88 | maxTextureSize: 8192 89 | resizeAlgorithm: 0 90 | textureFormat: -1 91 | textureCompression: 1 92 | compressionQuality: 50 93 | crunchedCompression: 0 94 | allowsAlphaSplitting: 0 95 | overridden: 0 96 | androidETC2FallbackOverride: 0 97 | forceMaximumCompressionQuality_BC6H_BC7: 0 98 | - serializedVersion: 3 99 | buildTarget: Android 100 | maxTextureSize: 8192 101 | resizeAlgorithm: 0 102 | textureFormat: -1 103 | textureCompression: 1 104 | compressionQuality: 50 105 | crunchedCompression: 0 106 | allowsAlphaSplitting: 0 107 | overridden: 0 108 | androidETC2FallbackOverride: 0 109 | forceMaximumCompressionQuality_BC6H_BC7: 0 110 | - serializedVersion: 3 111 | buildTarget: Windows Store Apps 112 | maxTextureSize: 8192 113 | resizeAlgorithm: 0 114 | textureFormat: -1 115 | textureCompression: 1 116 | compressionQuality: 50 117 | crunchedCompression: 0 118 | allowsAlphaSplitting: 0 119 | overridden: 0 120 | androidETC2FallbackOverride: 0 121 | forceMaximumCompressionQuality_BC6H_BC7: 0 122 | - serializedVersion: 3 123 | buildTarget: WebGL 124 | maxTextureSize: 8192 125 | resizeAlgorithm: 0 126 | textureFormat: -1 127 | textureCompression: 1 128 | compressionQuality: 50 129 | crunchedCompression: 0 130 | allowsAlphaSplitting: 0 131 | overridden: 0 132 | androidETC2FallbackOverride: 0 133 | forceMaximumCompressionQuality_BC6H_BC7: 0 134 | spriteSheet: 135 | serializedVersion: 2 136 | sprites: [] 137 | outline: [] 138 | physicsShape: [] 139 | bones: [] 140 | spriteID: 141 | internalID: 0 142 | vertices: [] 143 | indices: 144 | edges: [] 145 | weights: [] 146 | secondaryTextures: [] 147 | spritePackingTag: 148 | pSDRemoveMatte: 0 149 | pSDShowRemoveMatteOption: 0 150 | userData: 151 | assetBundleName: 152 | assetBundleVariant: 153 | -------------------------------------------------------------------------------- /Runtime/Sample Decals/Sticky Notes/Material/postit-code - Normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anatta336/driven-decals/4a70ad783bd5c95d9d43ed9c90654251766db17c/Runtime/Sample Decals/Sticky Notes/Material/postit-code - Normal.png -------------------------------------------------------------------------------- /Runtime/Sample Decals/Sticky Notes/Material/postit-code - Normal.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9984b30e7c719b54b87623e504b2de2a 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 13 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 0 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | flipGreenChannel: 0 24 | isReadable: 0 25 | streamingMipmaps: 0 26 | streamingMipmapsPriority: 0 27 | vTOnly: 0 28 | ignoreMipmapLimit: 0 29 | grayScaleToAlpha: 0 30 | generateCubemap: 6 31 | cubemapConvolution: 0 32 | seamlessCubemap: 0 33 | textureFormat: 1 34 | maxTextureSize: 2048 35 | textureSettings: 36 | serializedVersion: 2 37 | filterMode: 1 38 | aniso: 2 39 | mipBias: 0 40 | wrapU: 0 41 | wrapV: 0 42 | wrapW: 0 43 | nPOTScale: 1 44 | lightmap: 0 45 | compressionQuality: 50 46 | spriteMode: 0 47 | spriteExtrude: 1 48 | spriteMeshType: 1 49 | alignment: 0 50 | spritePivot: {x: 0.5, y: 0.5} 51 | spritePixelsToUnits: 100 52 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 53 | spriteGenerateFallbackPhysicsShape: 1 54 | alphaUsage: 0 55 | alphaIsTransparency: 0 56 | spriteTessellationDetail: -1 57 | textureType: 1 58 | textureShape: 1 59 | singleChannelComponent: 0 60 | flipbookRows: 1 61 | flipbookColumns: 1 62 | maxTextureSizeSet: 0 63 | compressionQualitySet: 0 64 | textureFormatSet: 0 65 | ignorePngGamma: 0 66 | applyGammaDecoding: 0 67 | swizzle: 50462976 68 | cookieLightType: 1 69 | platformSettings: 70 | - serializedVersion: 3 71 | buildTarget: DefaultTexturePlatform 72 | maxTextureSize: 8192 73 | resizeAlgorithm: 0 74 | textureFormat: -1 75 | textureCompression: 1 76 | compressionQuality: 50 77 | crunchedCompression: 0 78 | allowsAlphaSplitting: 0 79 | overridden: 0 80 | ignorePlatformSupport: 0 81 | androidETC2FallbackOverride: 0 82 | forceMaximumCompressionQuality_BC6H_BC7: 0 83 | - serializedVersion: 3 84 | buildTarget: Standalone 85 | maxTextureSize: 8192 86 | resizeAlgorithm: 0 87 | textureFormat: -1 88 | textureCompression: 1 89 | compressionQuality: 50 90 | crunchedCompression: 0 91 | allowsAlphaSplitting: 0 92 | overridden: 0 93 | ignorePlatformSupport: 0 94 | androidETC2FallbackOverride: 0 95 | forceMaximumCompressionQuality_BC6H_BC7: 0 96 | - serializedVersion: 3 97 | buildTarget: iPhone 98 | maxTextureSize: 8192 99 | resizeAlgorithm: 0 100 | textureFormat: -1 101 | textureCompression: 1 102 | compressionQuality: 50 103 | crunchedCompression: 0 104 | allowsAlphaSplitting: 0 105 | overridden: 0 106 | ignorePlatformSupport: 0 107 | androidETC2FallbackOverride: 0 108 | forceMaximumCompressionQuality_BC6H_BC7: 0 109 | - serializedVersion: 3 110 | buildTarget: Android 111 | maxTextureSize: 8192 112 | resizeAlgorithm: 0 113 | textureFormat: -1 114 | textureCompression: 1 115 | compressionQuality: 50 116 | crunchedCompression: 0 117 | allowsAlphaSplitting: 0 118 | overridden: 0 119 | ignorePlatformSupport: 0 120 | androidETC2FallbackOverride: 0 121 | forceMaximumCompressionQuality_BC6H_BC7: 0 122 | - serializedVersion: 3 123 | buildTarget: Windows Store Apps 124 | maxTextureSize: 8192 125 | resizeAlgorithm: 0 126 | textureFormat: -1 127 | textureCompression: 1 128 | compressionQuality: 50 129 | crunchedCompression: 0 130 | allowsAlphaSplitting: 0 131 | overridden: 0 132 | ignorePlatformSupport: 0 133 | androidETC2FallbackOverride: 0 134 | forceMaximumCompressionQuality_BC6H_BC7: 0 135 | - serializedVersion: 3 136 | buildTarget: WebGL 137 | maxTextureSize: 8192 138 | resizeAlgorithm: 0 139 | textureFormat: -1 140 | textureCompression: 1 141 | compressionQuality: 50 142 | crunchedCompression: 0 143 | allowsAlphaSplitting: 0 144 | overridden: 0 145 | ignorePlatformSupport: 0 146 | androidETC2FallbackOverride: 0 147 | forceMaximumCompressionQuality_BC6H_BC7: 0 148 | spriteSheet: 149 | serializedVersion: 2 150 | sprites: [] 151 | outline: [] 152 | physicsShape: [] 153 | bones: [] 154 | spriteID: 155 | internalID: 0 156 | vertices: [] 157 | indices: 158 | edges: [] 159 | weights: [] 160 | secondaryTextures: [] 161 | nameFileIdTable: {} 162 | mipmapLimitGroupName: 163 | pSDRemoveMatte: 0 164 | userData: 165 | assetBundleName: 166 | assetBundleVariant: 167 | -------------------------------------------------------------------------------- /Runtime/Sample Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a7207e09a45c28418f24a889e6820fe 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Sample Scripts/DecalSpawner.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections.Generic; 3 | 4 | // to avoid naming conflicts with your project the decal system uses its own namespace. 5 | // (as this example is within the same namespace this "using" directive isn't actually needed) 6 | using SamDriver.Decal; 7 | 8 | namespace SamDriver.Decal.Sample 9 | { 10 | /// 11 | /// An example of creating decals during runtime. 12 | /// Responds to input button "Fire1" by (re)spawning a circle of decals and projecting 13 | /// them against a specified set of meshes. 14 | /// 15 | /// Projecting decals using this system is relatively slow, so using it to create decals 16 | /// during gameplay like this is generally discouraged. 17 | /// If you need decals that are cheap to spawn, search for view-space projection decals. 18 | /// 19 | public class DecalSpawner : MonoBehaviour 20 | { 21 | public int SpawnCount = 6; 22 | public float DecalScale = 0.4f; 23 | public float ProjectionDepth = 1f; 24 | public DecalAsset DecalToSpawn; 25 | public List MeshesToProjectAgainst = new List(); 26 | 27 | List spawnedDecals = new List(); 28 | 29 | void Update() 30 | { 31 | if (Input.GetButtonDown("Fire1")) 32 | { 33 | Clear(); 34 | Spawn(); 35 | } 36 | } 37 | 38 | void Spawn() 39 | { 40 | foreach (Vector3 localPosition in SpawningPattern(SpawnCount)) 41 | { 42 | spawnedDecals.Add(CreateDecal(localPosition.x, localPosition.y)); 43 | } 44 | 45 | foreach (var decal in spawnedDecals) 46 | { 47 | if (decal.HasMeshToProjectAgainst) 48 | { 49 | // because we're spawning several decals at once it's possible to take more than 50 | // 4 frames for all the jobs to complete. 51 | // (this changes how the temporary memory used by the jobs is allocated) 52 | bool mayTakeMoreThanFourFrames = true; 53 | 54 | // begin to perform the projection 55 | // if you want the decal mesh to be generated immediately use GenerateProjectedMeshImmediate, 56 | // but beware it can easily lock up the main thread and cause skipped frames. 57 | decal.GenerateProjectedMeshDelayed(mayTakeMoreThanFourFrames); 58 | } 59 | } 60 | } 61 | 62 | DecalMesh CreateDecal(float localX, float localY) 63 | { 64 | // create game object as child of the spawner 65 | GameObject decalObject = new GameObject($"Spawned Decal ({localX.ToString("F3")},{localY.ToString("F3")})"); 66 | decalObject.transform.SetParent(this.transform, false); 67 | 68 | // set the transform however you wish, keeping in mind that rotation affects how it'll be projected 69 | decalObject.transform.localPosition = new Vector3(localX, localY, 0f); 70 | decalObject.transform.localScale = new Vector3(DecalScale, DecalScale, ProjectionDepth); 71 | 72 | // needs a MeshFilter and MeshRenderer to render the decal 73 | decalObject.AddComponent(); 74 | var meshRenderer = decalObject.AddComponent(); 75 | 76 | // decals generally shouldn't cast shadows 77 | meshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; 78 | 79 | // create the DecalMesh component itself 80 | var decal = decalObject.AddComponent(); 81 | 82 | // provide it with a DecalAsset 83 | decal.DecalAsset = this.DecalToSpawn; 84 | 85 | // scale the decal's object to match selected decal's ratio 86 | // (same behaviour as clicking the "Scale to match decal shape" button) 87 | decal.ScaleToMatchDecalBoundsRatio(); 88 | 89 | // we can set any of the options available on the DecalMesh component, 90 | // here we'll horizontally flip some of them at random 91 | decal.IsFlipU = (Random.value > 0.5f); 92 | 93 | // SetupMaterialPropertyBlock should be called whenever the DecalAsset or 94 | // the per-decal options like flip and opacity are changed. 95 | decal.SetupMaterialPropertyBlock(); 96 | 97 | // set up what the decal will project against 98 | // if you skip this it'll default to projecting against any nearby static meshes 99 | decal.ShouldUseSceneStaticMeshes = false; 100 | decal.MeshesToProjectAgainst = this.MeshesToProjectAgainst; 101 | 102 | return decal; 103 | } 104 | 105 | void Clear() 106 | { 107 | foreach (var decal in spawnedDecals) 108 | { 109 | Destroy(decal.gameObject); 110 | } 111 | spawnedDecals.Clear(); 112 | } 113 | 114 | void OnDrawGizmosSelected() 115 | { 116 | // reuse the spawning pattern of the decals 117 | foreach (Vector3 localPosition in SpawningPattern(SpawnCount)) 118 | { 119 | // draw a line representing where each decal will be projected 120 | Vector3 worldStart = transform.TransformPoint(localPosition + Vector3.back * ProjectionDepth * 0.5f); 121 | Vector3 worldEnd = transform.TransformPoint(localPosition + Vector3.forward * ProjectionDepth * 0.5f); 122 | Gizmos.DrawLine(worldStart, worldEnd); 123 | } 124 | } 125 | 126 | /// 127 | /// Generate local positions distributed in a unit circle on the xy plane. 128 | /// 129 | IEnumerable SpawningPattern(int totalCount) 130 | { 131 | for (int i = 0; i < totalCount; ++i) 132 | { 133 | float angleRadians = ((float)i / SpawnCount) * Mathf.PI * 2f; 134 | yield return new Vector3( 135 | Mathf.Cos(angleRadians), 136 | Mathf.Sin(angleRadians), 137 | 0f 138 | ); 139 | } 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /Runtime/Sample Scripts/DecalSpawner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2e28df14acc31c74eb52dc07c80f90ab 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da3e4cacf515a44449a0a70fb2e0a26a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Shaders/Decal Diffuse Emissive.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 59b37409d15614f4394a4a3e17d82848 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Runtime/Shaders/Decal Diffuse Normal.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15b60a05a6bac9d4794b3819a9948862 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Runtime/Shaders/Decal Diffuse Unlit.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7089fcadafe293f48b06c9934274a7f1 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Runtime/Shaders/Decal Diffuse.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa8953bcd9bbb6b4f8e5f84887b0fdd2 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Runtime/Shaders/Decal Full PBR.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7591ee611af01534c8c674cbd4ea4972 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Runtime/Shaders/Decal PBR Metallic Unity Style.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3300cf2fd319c5a49aebe9d5355ecdb8 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Runtime/Shaders/Decal PBR Specular Unity Style.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c41e5a510502d094f8e9968c60e554bf 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Runtime/Shaders/Decal UV.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8da4001347b049449d154432a263c11 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Runtime/Shaders/Decal Untextured Unlit.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a85cb34c1498244f83d33290e90b149 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Runtime/Shaders/Fade by angle.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a44338d29627f7f4f992e48c47523162 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Runtime/Shaders/Fade near z bounds.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 275e4d64ce6651a4a92c7941fcf33c0b 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Runtime/Shaders/Flip normal.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b9aa37220e0f9f48a30fecf0a18cd69 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Runtime/Shaders/Offset in viewspace.shadersubgraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d8cae260a0c47d04aa9338a837ec29f6 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3} 11 | -------------------------------------------------------------------------------- /Runtime/Util.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9d6daafe51694a4b953457633d0cdd8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Util/Dimension.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SamDriver.Decal 4 | { 5 | internal enum Dimension 6 | { 7 | x, 8 | y, 9 | z, 10 | } 11 | } -------------------------------------------------------------------------------- /Runtime/Util/Dimension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20ea207a4c515db4f945341617beb0cb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Util/DirectionToVertex.cs: -------------------------------------------------------------------------------- 1 | namespace SamDriver.Decal 2 | { 3 | /// 4 | /// Immutable representation of difference between two points. 5 | /// 6 | internal struct DirectionToVertex 7 | { 8 | public readonly Vertex start; 9 | public readonly Vertex target; 10 | public readonly Float3 direction; 11 | public readonly float distancetoTarget; 12 | 13 | public DirectionToVertex(Vertex start_, Vertex target_) 14 | { 15 | this.start = start_; 16 | this.target = target_; 17 | 18 | var displacement = target_.Position - start_.Position; 19 | this.distancetoTarget = displacement.Magnitude; 20 | this.direction = displacement / distancetoTarget; 21 | } 22 | 23 | public bool RoughlyParallel(DirectionToVertex other, float fuzziness = 0.001f) 24 | { 25 | return this.direction.IsNearlyEqual(other.direction, fuzziness) || 26 | this.direction.IsNearlyEqual(other.direction * -1f, fuzziness); 27 | } 28 | 29 | public bool RoughlyEqualDirection(DirectionToVertex other, float fuzziness = 0.001f) 30 | { 31 | return this.direction.IsNearlyEqual(other.direction, fuzziness); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Runtime/Util/DirectionToVertex.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb08a269cf576904eac1ae171f71f1bb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Util/Edge.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Collections; 3 | 4 | namespace SamDriver.Decal 5 | { 6 | /// 7 | /// Immutable representation of an edge linking two vertices. 8 | /// 9 | internal struct Edge 10 | { 11 | [ReadOnly] public readonly Vertex A, B; 12 | 13 | public Edge(Vertex a_, Vertex b_) 14 | { 15 | this.A = a_; 16 | this.B = b_; 17 | } 18 | 19 | public Vertex GetVertexBetween(float tFromAToB) => 20 | Vertex.CreateFromExisting(A, B, tFromAToB); 21 | 22 | /// 23 | /// Find the scalar t such that using it to linearly interpolate 24 | /// from v0 to v1 would give goal value in specified dimension. 25 | /// 26 | public float InverseLerpDimension(float goalPositionInDimension, Dimension dimension) => 27 | Mathf.InverseLerp( 28 | A.Position.ComponentInDimension(dimension), 29 | B.Position.ComponentInDimension(dimension), 30 | goalPositionInDimension 31 | ); 32 | 33 | /// 34 | /// Linearly interpolates between positions of A and B, giving the value of just one dimension. 35 | /// 36 | public float LerpDimension(float t, Dimension dimension) => 37 | Mathf.Lerp( 38 | A.Position.ComponentInDimension(dimension), 39 | B.Position.ComponentInDimension(dimension), 40 | t 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Runtime/Util/Edge.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 28c6cfd54cb434a44948fbc98fe448fa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Util/Float2.cs: -------------------------------------------------------------------------------- 1 | using Unity.Collections; 2 | 3 | namespace SamDriver.Decal 4 | { 5 | /// 6 | /// Immutable Float2, suitable for use in Unity's job system. 7 | /// 8 | internal struct Float2 9 | { 10 | [ReadOnly] public readonly float x, y; 11 | 12 | public Float2(float x_, float y_) 13 | { 14 | x = x_; 15 | y = y_; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Runtime/Util/Float2.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a3a0efd2ca73b3418f3cfa68d433e9d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Util/Float3.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Collections; 3 | 4 | namespace SamDriver.Decal 5 | { 6 | /// 7 | /// Immutable Float3, suitable for use in Unity's job system. 8 | /// 9 | internal struct Float3 10 | { 11 | [ReadOnly] public readonly float x, y, z; 12 | 13 | float? _magnitude; 14 | public float Magnitude 15 | { 16 | get 17 | { 18 | if (!_magnitude.HasValue) 19 | { 20 | _magnitude = Mathf.Sqrt(MagnitudeSquared); 21 | } 22 | return _magnitude.Value; 23 | } 24 | } 25 | 26 | public float MagnitudeSquared { get => x * x + y * y + z * z; } 27 | 28 | public Float3(float x_, float y_, float z_) 29 | { 30 | this.x = x_; 31 | this.y = y_; 32 | this.z = z_; 33 | _magnitude = null; 34 | } 35 | 36 | public Float3(Vector3 source) 37 | : this(source.x, source.y, source.z) 38 | {} 39 | 40 | public Float3(Float3 source) 41 | : this(source.x, source.y, source.z) 42 | {} 43 | 44 | public bool IsNearlyEqual(Float3 other, float fuzziness = 0.0001f) 45 | { 46 | return 47 | Mathf.Abs(this.x - other.x) < fuzziness && 48 | Mathf.Abs(this.y - other.y) < fuzziness && 49 | Mathf.Abs(this.z - other.z) < fuzziness; 50 | } 51 | 52 | public float ComponentInDimension(Dimension dimension) 53 | { 54 | switch (dimension) 55 | { 56 | case Dimension.x: 57 | return this.x; 58 | case Dimension.y: 59 | return this.y; 60 | case Dimension.z: 61 | default: 62 | return this.z; 63 | } 64 | } 65 | 66 | public string ToString(string format) 67 | { 68 | return $"{x.ToString(format)}, {y.ToString(format)}, {z.ToString(format)}"; 69 | } 70 | public override string ToString() 71 | { 72 | return ToString("F2"); 73 | } 74 | 75 | public Vector3 AsVector3 { get => new Vector3(x, y, z); } 76 | 77 | public static explicit operator Vector3(Float3 a) => a.AsVector3; 78 | 79 | public static Float3 operator +(Float3 a) => a; 80 | 81 | public static Float3 operator -(Float3 a) => new Float3(-a.x, -a.y, -a.z); 82 | 83 | public static Float3 operator +(Float3 a, Float3 b) => new Float3( 84 | a.x + b.x, 85 | a.y + b.y, 86 | a.z + b.z 87 | ); 88 | public static Float3 operator -(Float3 a, Float3 b) => a + (-b); 89 | 90 | public static Float3 operator *(Float3 a, float b) => new Float3( 91 | a.x * b, 92 | a.y * b, 93 | a.z * b 94 | ); 95 | public static Float3 operator *(float a, Float3 b) => b * a; 96 | 97 | public static Float3 operator /(Float3 a, float b) => a * (1f / b); 98 | 99 | public static Float3 operator *(Float3 a, Float3 b) => new Float3( 100 | a.x * b.x, 101 | a.y * b.y, 102 | a.z * b.z 103 | ); 104 | 105 | public static Float3 CrossProduct(Float3 a, Float3 b) => new Float3( 106 | a.y * b.z - a.z * b.y, 107 | a.z * b.x - a.x * b.z, 108 | a.x * b.y - a.y * b.x 109 | ); 110 | 111 | public static float DotProduct(Float3 a, Float3 b) => 112 | a.x * b.x + a.y * b.y + a.z * b.z; 113 | 114 | public static Float3 Normalize(Float3 a) => 115 | Mathf.Approximately(a.Magnitude, 1f) ? 116 | a : 117 | (a / a.Magnitude); 118 | 119 | public static Float3 Lerp(Float3 a, Float3 b, float t) => new Float3( 120 | Mathf.Lerp(a.x, b.x, t), 121 | Mathf.Lerp(a.y, b.y, t), 122 | Mathf.Lerp(a.z, b.z, t) 123 | ); 124 | 125 | public static Float3 SetXZero(Float3 a) => new Float3(0f, a.y, a.z); 126 | public static Float3 SetYZero(Float3 a) => new Float3(a.x, 0f, a.z); 127 | public static Float3 SetZZero(Float3 a) => new Float3(a.x, a.y, 0f); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /Runtime/Util/Float3.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ccfc888f5a9daa84192166fbbf6e6e9f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Util/RawMesh.cs: -------------------------------------------------------------------------------- 1 | using Unity.Collections; 2 | using System; 3 | 4 | namespace SamDriver.Decal 5 | { 6 | /// 7 | /// Immutable representation of a mesh, ready to be used in the 8 | /// Unity job system. 9 | /// 10 | internal struct RawMesh : IDisposable 11 | { 12 | [ReadOnly] public readonly NativeArray Indices; 13 | [ReadOnly] public readonly NativeArray Positions; 14 | [ReadOnly] public readonly NativeArray Normals; 15 | 16 | public int TriangleCount { get => Indices.Length / 3; } 17 | 18 | public RawMesh( 19 | NativeArray indices_, 20 | NativeArray positions_, 21 | NativeArray normals_) 22 | { 23 | this.Indices = indices_; 24 | this.Positions = positions_; 25 | this.Normals = normals_; 26 | } 27 | 28 | public void Dispose() 29 | { 30 | Indices.Dispose(); 31 | Positions.Dispose(); 32 | Normals.Dispose(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Runtime/Util/RawMesh.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ceaa368de2a22f84fbd4937cd60a2f60 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Util/Square.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace SamDriver.Decal 5 | { 6 | /// 7 | /// Provides convenient access to positions of corners of a square. 8 | /// 9 | internal static class Square 10 | { 11 | public const int CornerCount = 4; 12 | 13 | static Float2[] _centeredUnitSquareCorners; 14 | public static Float2[] CenteredUnitSquareCorners 15 | { 16 | get 17 | { 18 | if (_centeredUnitSquareCorners == null || _centeredUnitSquareCorners.Length == 0) 19 | { 20 | _centeredUnitSquareCorners = SquareCorners(0f, 0f, 1f).ToArray(); 21 | if (_centeredUnitSquareCorners.Length != CornerCount) 22 | { 23 | throw new System.Exception($"{nameof(SquareCorners)} expected to give {CornerCount} values, but gave {_centeredUnitSquareCorners.Length}."); 24 | } 25 | } 26 | return _centeredUnitSquareCorners; 27 | } 28 | } 29 | 30 | public static IEnumerable SquareCorners(float midX = 0f, float midY = 0f, float size = 1f) 31 | { 32 | yield return new Float2(midX - size * 0.5f, midY - size * 0.5f); 33 | yield return new Float2(midX + size * 0.5f, midY - size * 0.5f); 34 | yield return new Float2(midX + size * 0.5f, midY + size * 0.5f); 35 | yield return new Float2(midX - size * 0.5f, midY + size * 0.5f); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Runtime/Util/Square.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1f459976a15d3e488561d4a858ed4a3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Util/Triangle.cs: -------------------------------------------------------------------------------- 1 | using Unity.Collections; 2 | using System.Collections.Generic; 3 | using System.Collections; 4 | 5 | namespace SamDriver.Decal 6 | { 7 | /// 8 | /// Immutable representation of a triangle, with several useful methods. 9 | /// 10 | internal struct Triangle : IEnumerable 11 | { 12 | [ReadOnly] public readonly bool IsPresent; // will default to false when struct is uninitialised 13 | [ReadOnly] public readonly Vertex A, B, C; 14 | 15 | /// 16 | /// The normal of the plane defined by this triangle. Note this may not be equal to the 17 | /// normal(s) stored on the vertices that make up this triangle. 18 | /// 19 | public Float3 GeometryNormal 20 | { 21 | get 22 | { 23 | if (!_geometryNormal.HasValue) 24 | { 25 | _geometryNormal = Float3.Normalize( 26 | Float3.CrossProduct( 27 | B.Position - A.Position, 28 | C.Position - A.Position 29 | )); 30 | } 31 | return _geometryNormal.Value; 32 | } 33 | } 34 | Float3? _geometryNormal; 35 | 36 | public Triangle(Vertex a_, Vertex b_, Vertex c_) 37 | { 38 | this.A = a_; 39 | this.B = b_; 40 | this.C = c_; 41 | _geometryNormal = null; 42 | IsPresent = true; 43 | } 44 | 45 | public IEnumerator GetEnumerator() 46 | { 47 | yield return A; 48 | yield return B; 49 | yield return C; 50 | } 51 | IEnumerator IEnumerable.GetEnumerator() 52 | { 53 | return GetEnumerator(); 54 | } 55 | 56 | public IEnumerable EnumerateEdges() 57 | { 58 | yield return new Edge(A, B); 59 | yield return new Edge(B, C); 60 | yield return new Edge(C, A); 61 | } 62 | 63 | /// 64 | /// Tests if a line defined by a y and z coordinate pair intersects this triangle. 65 | /// Equivalent to projecting the triangle onto the yz plane and testing for a point being inside. 66 | /// 67 | public bool IsAxialXLineWithin(float y, float z) 68 | { 69 | // projecting the triangle onto local yz plane just means setting x components to zero 70 | return IsProjectedVertexWithinTriangle( 71 | Float3.SetXZero(A.Position), 72 | Float3.SetXZero(B.Position), 73 | Float3.SetXZero(C.Position), 74 | new Float3(0f, y, z) 75 | ); 76 | } 77 | 78 | /// 79 | /// Tests if a line defined by a x and z coordinate pair intersects this triangle. 80 | /// Equivalent to projecting the triangle onto the xz plane and testing for a point being inside. 81 | /// 82 | public bool IsAxialYLineWithin(float x, float z) 83 | { 84 | // projecting the triangle onto local xz plane just means setting y components to zero 85 | return IsProjectedVertexWithinTriangle( 86 | Float3.SetYZero(A.Position), 87 | Float3.SetYZero(B.Position), 88 | Float3.SetYZero(C.Position), 89 | new Float3(x, 0f, z) 90 | ); 91 | } 92 | 93 | /// 94 | /// Tests if a line defined by a x and y coordinate pair intersects this triangle. 95 | /// Equivalent to projecting the triangle onto the xy plane and testing for a point being inside. 96 | /// 97 | public bool IsAxialZLineWithin(float x, float y) 98 | { 99 | // projecting the triangle onto local xy plane just means setting z components to zero 100 | return IsProjectedVertexWithinTriangle( 101 | Float3.SetZZero(A.Position), 102 | Float3.SetZZero(B.Position), 103 | Float3.SetZZero(C.Position), 104 | new Float3(x, y, 0f) 105 | ); 106 | } 107 | 108 | /// 109 | /// Given an yz position find z on the plane defined by this triangle. 110 | /// 111 | public float getXAtYZ(float y, float z) 112 | { 113 | // we have a plane defined by this triangle, and just need to find y given xz 114 | return (Float3.DotProduct(GeometryNormal, A.Position) - 115 | GeometryNormal.y * y - GeometryNormal.z * z 116 | ) / GeometryNormal.x; 117 | } 118 | 119 | /// 120 | /// Given an xz position find y on the plane defined by this triangle. 121 | /// 122 | public float getYAtXZ(float x, float z) 123 | { 124 | // we have a plane defined by this triangle, and just need to find y given xz 125 | return (Float3.DotProduct(GeometryNormal, A.Position) - 126 | GeometryNormal.x * x - GeometryNormal.z * z 127 | ) / GeometryNormal.y; 128 | } 129 | 130 | /// 131 | /// Given an xy position find z on the plane defined by this triangle. 132 | /// 133 | public float GetZAtXY(float x, float y) 134 | { 135 | // we have a plane defined by this triangle, and just need to find z given xy 136 | return (Float3.DotProduct(GeometryNormal, A.Position) - 137 | GeometryNormal.x * x - GeometryNormal.y * y 138 | ) / GeometryNormal.z; 139 | } 140 | 141 | /// 142 | /// Note! Assumes the given point is within the triangle. 143 | /// 144 | public Float3 InterpolateNormal(Float3 targetPoint) 145 | { 146 | Float3 u = B.Position - A.Position; 147 | Float3 v = C.Position - A.Position; 148 | Float3 n = Float3.CrossProduct(u, v); 149 | Float3 w = targetPoint - A.Position; 150 | 151 | // barycentric coordinates of the projection P' of P to plane of triangle 152 | float gamma = Float3.DotProduct(Float3.CrossProduct(u, w), n) / n.MagnitudeSquared; 153 | float beta = Float3.DotProduct(Float3.CrossProduct(w, v), n) / n.MagnitudeSquared; 154 | float alpha = 1f - gamma - beta; 155 | 156 | // normalP = α*normalA + β*normalB + γ*normalC 157 | Float3 interpolated = 158 | alpha * A.Normal + 159 | beta * B.Normal + 160 | gamma * C.Normal; 161 | return Float3.Normalize(interpolated); 162 | } 163 | 164 | public static bool IsProjectedVertexWithinTriangle( 165 | Float3 A, Float3 B, Float3 C, Float3 P) 166 | { 167 | // given triangle ABC and point P 168 | Float3 u = B - A; 169 | Float3 v = C - A; 170 | Float3 n = Float3.CrossProduct(u, v); 171 | Float3 w = P - A; 172 | 173 | // barycentric coordinates of the projection P' of P to plane of triangle 174 | float gamma = Float3.DotProduct(Float3.CrossProduct(u, w), n) / n.MagnitudeSquared; 175 | float beta = Float3.DotProduct(Float3.CrossProduct(w, v), n) / n.MagnitudeSquared; 176 | 177 | //NOTE: alpha is only a correct barycentric coordinate if point is within triangle 178 | float alpha = 1f - gamma - beta; 179 | 180 | // for reference: alpha is the weight of A, beta weight of B, gamma weight of C 181 | 182 | // P' is within triangle if barycentric coordinates are all in range 0 to 1 183 | return (alpha >= 0f) && (alpha <= 1f) && 184 | (beta >= 0f) && (beta <= 1f) && 185 | (gamma >= 0f) && (gamma <= 1f); 186 | } 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /Runtime/Util/Triangle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b60a215c1c651fe4a83c02b0d28bb73d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Util/Vertex.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Collections; 3 | 4 | namespace SamDriver.Decal 5 | { 6 | /// 7 | /// Immutable vertex with position and normal 8 | /// 9 | internal struct Vertex 10 | { 11 | [ReadOnly] public Float3 Position; 12 | [ReadOnly] public Float3 Normal; 13 | 14 | public Vertex(Float3 position_, Float3 normal_) 15 | { 16 | this.Position = position_; 17 | this.Normal = normal_; 18 | } 19 | 20 | public static Vertex CreateFromExisting(Vertex a, Vertex b, float tFromAToB) 21 | { 22 | tFromAToB = Mathf.Clamp01(tFromAToB); 23 | 24 | Float3 createdPosition = Float3.Lerp(a.Position, b.Position, tFromAToB); 25 | 26 | // spherical linear interpolation is probably more correct, 27 | // but I think linear interpolation gives consistency with rendering 28 | Float3 createdNormal = Float3.Normalize(Float3.Lerp(a.Normal, b.Normal, tFromAToB)); 29 | 30 | return new Vertex(createdPosition, createdNormal); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Runtime/Util/Vertex.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2fbe7ccd133647408806591032d9efa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ddb46129de094984b85effbbb2f07084 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Tests/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 598a2283a2a911e4caa5f790fe618ad8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Tests/Editor/DecalAssetTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using NUnit.Framework; 4 | using UnityEditor; 5 | using UnityEditor.TestTools; 6 | using UnityEngine; 7 | using UnityEngine.TestTools; 8 | 9 | namespace SamDriver.Decal.Test 10 | { 11 | public class DecalAssetTests 12 | { 13 | DecalAsset decalAsset; 14 | SerializedObject serializedDecalAsset; 15 | SerializedProperty uMin, vMin, uMax, vMax; 16 | 17 | [SetUp] 18 | public void PrepareDecalAsset() 19 | { 20 | decalAsset = ScriptableObject.CreateInstance(); 21 | 22 | serializedDecalAsset = new SerializedObject(decalAsset); 23 | 24 | uMin = serializedDecalAsset.FindProperty("uMin"); 25 | vMin = serializedDecalAsset.FindProperty("vMin"); 26 | uMax = serializedDecalAsset.FindProperty("uMax"); 27 | vMax = serializedDecalAsset.FindProperty("vMax"); 28 | } 29 | 30 | [TearDown] 31 | public void DestroyDecalAsset() 32 | { 33 | Object.DestroyImmediate(decalAsset); 34 | } 35 | 36 | void UVtoZeroOne() 37 | { 38 | uMin.floatValue = 0f; 39 | vMin.floatValue = 0f; 40 | uMax.floatValue = 1f; 41 | vMax.floatValue = 1f; 42 | serializedDecalAsset.ApplyModifiedPropertiesWithoutUndo(); 43 | serializedDecalAsset.Update(); 44 | } 45 | 46 | [Test] 47 | public void UMin_SetZero_Zero() 48 | { 49 | UVtoZeroOne(); 50 | Assert.That(uMin.floatValue, Is.EqualTo(0f)); 51 | } 52 | 53 | [Test] 54 | public void UMax_SetOne_One() 55 | { 56 | UVtoZeroOne(); 57 | Assert.That(uMax.floatValue, Is.EqualTo(1f)); 58 | } 59 | 60 | [Test] 61 | public void UMax_SetUMinHigherThanUMax_UMaxAlsoIncreased() 62 | { 63 | UVtoZeroOne(); 64 | uMin.floatValue = 2f; 65 | serializedDecalAsset.ApplyModifiedPropertiesWithoutUndo(); 66 | serializedDecalAsset.Update(); 67 | 68 | Assert.That(uMax.floatValue, Is.EqualTo(2f)); 69 | } 70 | 71 | [Test] 72 | public void BoundsAsVector4_UVZeroOne_RecreatedInVector4() 73 | { 74 | UVtoZeroOne(); 75 | 76 | Assert.That(decalAsset.BoundsAsVector4.x, Is.EqualTo(uMin.floatValue).Within(1).Ulps); 77 | Assert.That(decalAsset.BoundsAsVector4.y, Is.EqualTo(vMin.floatValue).Within(1).Ulps); 78 | Assert.That(decalAsset.BoundsAsVector4.z, Is.EqualTo(uMax.floatValue).Within(1).Ulps); 79 | Assert.That(decalAsset.BoundsAsVector4.w, Is.EqualTo(vMax.floatValue).Within(1).Ulps); 80 | } 81 | 82 | [Test] 83 | public void BoundsAsVector4_UVSmall_RecreatedInVector4() 84 | { 85 | uMin.floatValue = 0.5f; 86 | uMax.floatValue = 0.8f; 87 | vMin.floatValue = 0.2f; 88 | vMax.floatValue = 0.6f; 89 | serializedDecalAsset.ApplyModifiedPropertiesWithoutUndo(); 90 | serializedDecalAsset.Update(); 91 | 92 | Assert.That(decalAsset.BoundsAsVector4.x, Is.EqualTo(uMin.floatValue).Within(1).Ulps); 93 | Assert.That(decalAsset.BoundsAsVector4.y, Is.EqualTo(vMin.floatValue).Within(1).Ulps); 94 | Assert.That(decalAsset.BoundsAsVector4.z, Is.EqualTo(uMax.floatValue).Within(1).Ulps); 95 | Assert.That(decalAsset.BoundsAsVector4.w, Is.EqualTo(vMax.floatValue).Within(1).Ulps); 96 | } 97 | 98 | [Test] 99 | public void UVWidth_UVZeroOne_WidthOne() 100 | { 101 | UVtoZeroOne(); 102 | 103 | Assert.That(decalAsset.UVWidth, Is.EqualTo(1f)); 104 | } 105 | 106 | [Test] 107 | public void UVHeight_UVZeroOne_HeightOne() 108 | { 109 | UVtoZeroOne(); 110 | 111 | Assert.That(decalAsset.UVHeight, Is.EqualTo(1f)); 112 | } 113 | 114 | [Test] 115 | public void UVWidth_UVOffsetZeroOne_WidthOne() 116 | { 117 | UVtoZeroOne(); 118 | uMin.floatValue = 0.5f; 119 | uMax.floatValue = 1.5f; 120 | serializedDecalAsset.ApplyModifiedPropertiesWithoutUndo(); 121 | serializedDecalAsset.Update(); 122 | 123 | Assert.That(decalAsset.UVWidth, Is.EqualTo(1f)); 124 | } 125 | 126 | [Test] 127 | public void UVHeight_UVOffsetZeroOne_HeightOne() 128 | { 129 | UVtoZeroOne(); 130 | vMin.floatValue = 0.5f; 131 | vMax.floatValue = 1.5f; 132 | serializedDecalAsset.ApplyModifiedPropertiesWithoutUndo(); 133 | serializedDecalAsset.Update(); 134 | 135 | Assert.That(decalAsset.UVHeight, Is.EqualTo(1f).Within(1).Ulps); 136 | } 137 | 138 | [Test] 139 | public void UVWidth_UVSmall_WidthSmall() 140 | { 141 | uMin.floatValue = 0.5f; 142 | uMax.floatValue = 0.8f; 143 | vMin.floatValue = 0.2f; 144 | vMax.floatValue = 0.6f; 145 | serializedDecalAsset.ApplyModifiedPropertiesWithoutUndo(); 146 | serializedDecalAsset.Update(); 147 | 148 | Assert.That(decalAsset.UVWidth, Is.EqualTo(0.3f).Within(1).Ulps); 149 | } 150 | 151 | [Test] 152 | public void UVHeight_UVSmall_HeightSmall() 153 | { 154 | uMin.floatValue = 0.5f; 155 | uMax.floatValue = 0.8f; 156 | vMin.floatValue = 0.2f; 157 | vMax.floatValue = 0.6f; 158 | serializedDecalAsset.ApplyModifiedPropertiesWithoutUndo(); 159 | serializedDecalAsset.Update(); 160 | 161 | Assert.That(decalAsset.UVHeight, Is.EqualTo(0.4f).Within(1).Ulps); 162 | } 163 | 164 | [Test] 165 | public void HasAnyZeroSizedDimensions_NoZero_False() 166 | { 167 | UVtoZeroOne(); 168 | 169 | Assert.That(decalAsset.HasAnyZeroSizedDimensions, Is.False); 170 | } 171 | 172 | [Test] 173 | public void HasAnyZeroSizedDimensions_ZeroWidth_True() 174 | { 175 | UVtoZeroOne(); 176 | uMin.floatValue = 1f; 177 | serializedDecalAsset.ApplyModifiedPropertiesWithoutUndo(); 178 | serializedDecalAsset.Update(); 179 | 180 | Assert.That(decalAsset.HasAnyZeroSizedDimensions, Is.True); 181 | } 182 | 183 | [Test] 184 | public void HasAnyZeroSizedDimensions_ZeroHeight_True() 185 | { 186 | UVtoZeroOne(); 187 | vMin.floatValue = 1f; 188 | serializedDecalAsset.ApplyModifiedPropertiesWithoutUndo(); 189 | serializedDecalAsset.Update(); 190 | 191 | Assert.That(decalAsset.HasAnyZeroSizedDimensions, Is.True); 192 | } 193 | 194 | //TODO: would like to test availability of properties on Material, but 195 | // not sure how to make a fake material without needing a valid shader. 196 | // Could bundle a shader and material in the test directory..? 197 | 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /Tests/Editor/DecalAssetTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 42620c21d9ff5db48bf0e4efb93e03c0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Editor/SamDriver.DrivenDecals.EditorTests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SamDriver.DrivenDecals.EditorTests", 3 | "references": [ 4 | "UnityEngine.TestRunner", 5 | "UnityEditor.TestRunner", 6 | "SamDriver.DrivenDecals.Editor", 7 | "SamDriver.DrivenDecals.Runtime" 8 | ], 9 | "includePlatforms": [ 10 | "Editor" 11 | ], 12 | "excludePlatforms": [], 13 | "allowUnsafeCode": false, 14 | "overrideReferences": true, 15 | "precompiledReferences": [ 16 | "nunit.framework.dll" 17 | ], 18 | "autoReferenced": false, 19 | "defineConstraints": [ 20 | "UNITY_INCLUDE_TESTS" 21 | ], 22 | "versionDefines": [], 23 | "noEngineReferences": false 24 | } -------------------------------------------------------------------------------- /Tests/Editor/SamDriver.DrivenDecals.EditorTests.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2daa0d389d054fb4aa9b382bfd9569b7 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Tests/Editor/TriangleTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using UnityEngine; 3 | 4 | namespace SamDriver.Decal.Test 5 | { 6 | public class TriangleTests 7 | { 8 | // reminder you can mark a function with [SetUp] or [TearDown] to automatically 9 | // call it before or after each function marked with [Test] 10 | 11 | static Triangle BuildTriangle(Float3 posA, Float3 posB, Float3 posC, Float3 vertexNormal) 12 | { 13 | Vertex vertexA = new Vertex(posA, vertexNormal); 14 | Vertex vertexB = new Vertex(posB, vertexNormal); 15 | Vertex vertexC = new Vertex(posC, vertexNormal); 16 | return new Triangle(vertexA, vertexB, vertexC); 17 | } 18 | 19 | static Triangle PlanarXYTriangle() 20 | { 21 | return BuildTriangle( 22 | new Float3(0f, 0f, 0f), 23 | new Float3(1f, 0f, 0f), 24 | new Float3(0f, 1f, 0f), 25 | new Float3(1f, 0f, 0f) 26 | ); 27 | } 28 | 29 | static Triangle LiftedFromXYTriangle() 30 | { 31 | return BuildTriangle( 32 | new Float3(0f, 0f, 0f), 33 | new Float3(1f, 0f, 1f), 34 | new Float3(0f, 1f, 0f), 35 | new Float3(1f, 0f, 0f) 36 | ); 37 | } 38 | 39 | [Test] 40 | public void GeometryNormal_XYPlane_UnitVectorOnZAxis() 41 | { 42 | Triangle triangle = PlanarXYTriangle(); 43 | 44 | Assert.That(triangle.GeometryNormal.x, Is.EqualTo(0f)); 45 | Assert.That(triangle.GeometryNormal.y, Is.EqualTo(0f)); 46 | Assert.That(triangle.GeometryNormal.z, Is.EqualTo(1f)); 47 | } 48 | 49 | [Test] 50 | public void GeometryNormal_Nonplanar_OrthogonalUnitVector() 51 | { 52 | Triangle triangle = LiftedFromXYTriangle(); 53 | 54 | float halfSqrtTwo = 0.5f * Mathf.Sqrt(2f); 55 | Assert.That(triangle.GeometryNormal.x, Is.EqualTo(-halfSqrtTwo)); 56 | Assert.That(triangle.GeometryNormal.y, Is.EqualTo(0f)); 57 | Assert.That(triangle.GeometryNormal.z, Is.EqualTo(halfSqrtTwo)); 58 | } 59 | 60 | [Test] 61 | public void GetZAtXY_AtOriginCorner_Zero() 62 | { 63 | Triangle triangle = LiftedFromXYTriangle(); 64 | 65 | Assert.That(triangle.GetZAtXY(0f, 0f), Is.EqualTo(0f)); 66 | } 67 | 68 | [Test] 69 | public void GetZAtXY_AtLiftedCorner_One() 70 | { 71 | Triangle triangle = LiftedFromXYTriangle(); 72 | 73 | Assert.That(triangle.GetZAtXY(1f, 0f), Is.EqualTo(1f)); 74 | } 75 | 76 | [Test] 77 | public void GetZAtXY_HalfWayAlongEdgeTowardsLiftedCorner_Half() 78 | { 79 | Triangle triangle = LiftedFromXYTriangle(); 80 | 81 | Assert.That(triangle.GetZAtXY(0.5f, 0f), Is.EqualTo(0.5f)); 82 | } 83 | 84 | [Test] 85 | public void GetZAtXY_HalfWayAlongBodyTowardsLiftedCorner_Half() 86 | { 87 | Triangle triangle = LiftedFromXYTriangle(); 88 | 89 | Assert.That(triangle.GetZAtXY(0.5f, 0.1f), Is.EqualTo(0.5f)); 90 | } 91 | 92 | //TODO: should repeat above set with XAtYZ and YAtXZ 93 | 94 | [Test] 95 | public void IsAxialZLineWithin_InsidePlanarTriangle_True() 96 | { 97 | Triangle triangle = PlanarXYTriangle(); 98 | 99 | Assert.That(triangle.IsAxialZLineWithin(0.2f, 0.2f), Is.True); 100 | } 101 | 102 | [Test] 103 | public void IsAxialZLineWithin_OutsidePlanarTriangle_False() 104 | { 105 | Triangle triangle = PlanarXYTriangle(); 106 | 107 | Assert.That(triangle.IsAxialZLineWithin(0.8f, 0.8f), Is.False); 108 | } 109 | 110 | [Test] 111 | public void IsAxialZLineWithin_InsideLiftedTriangle_True() 112 | { 113 | Triangle triangle = LiftedFromXYTriangle(); 114 | 115 | Assert.That(triangle.IsAxialZLineWithin(0.2f, 0.2f), Is.True); 116 | } 117 | 118 | [Test] 119 | public void IsAxialZLineWithin_OutsideLiftedTriangle_False() 120 | { 121 | Triangle triangle = LiftedFromXYTriangle(); 122 | 123 | Assert.That(triangle.IsAxialZLineWithin(0.8f, 0.8f), Is.False); 124 | } 125 | 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /Tests/Editor/TriangleTests.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d5f8722bec11014cb5ef2bfcf263f64 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.samdriver.driven-decals", 3 | "version": "0.8.0", 4 | "displayName": "Driven Decals", 5 | "description": "A projected-mesh PBR decal system for the Universal Render Pipeline.", 6 | "unity": "2021.3", 7 | "dependencies": { 8 | "com.unity.render-pipelines.universal": "12.0.0" 9 | }, 10 | "keywords": [ 11 | "Decals", 12 | "URP", 13 | "Mesh Decals" 14 | ], 15 | "author": { 16 | "name": "Sam Driver", 17 | "url": "https://samdriver.xyz" 18 | }, 19 | "hideInEditor": false 20 | } -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 740fabaab987fa9428ea214cbef63346 3 | PackageManifestImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------