Search Unity

Easy Decal - Decals everywhere

Discussion in 'Assets and Asset Store' started by Sycoforge, Oct 28, 2014.

  1. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    153
    In the asset store it says "Version 1.6.5 will support projection to skinned meshes. Price will be increased to 39$. "
    But it also lists that 1.6.5 is the current version. But it does not cost $39.

    So does it support skinned meshes? What about terrain? Lastly, can I apply decals at runtime or only via the editor?
     
  2. PixelNAUTS_Alex

    PixelNAUTS_Alex

    Joined:
    Sep 14, 2012
    Posts:
    51
    Hey there,

    Love using this asset so far! It has really impacted our environment art design.

    I have a question about Combined Decals and Asset Exporting. Here is what I'm trying to do:

    I have a prefab, such as a barrel. I add multiple decals on it. I want to save this as a prefab.

    1. Decal Atlas
    I want to combine all these decals into an atlas and a single mesh. Using the Decal Manager I create a combined group. This creates a Decal Atlas under my Decal Root object. This is now one mesh and material, perfect! But if I try to add this Decal Atlas to a prefab, it doesn't work. Placing this prefab in a new scene result in a missing mesh.

    2. Save as Asset
    This feature works great but I can only do it to one decal at a time. This takes a long time when using multiple decals.

    Is there a way to create an asset from the Decal Atlas or save out the Decal Mesh?
     
  3. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    You are completely free in chosing a shader/material when using one of the mesh-based projection techniques. So yes, when chosing a shader that actualy reads the lightmaps this will work. Since version 1.6.5 the deferred decals are also taking the baked light information into account. But there will be some major changes in version 2.0 (beta will be available in a few weeks to owners of the 1.x version).

    Please let me know if you need more information.
     
  4. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Yes.

    Yes. But currently you have to use one of the exclusion/masking shaders included in the package. This will be changed in version 2.0 with a simple layer mask system, at the expense of one more masking draw call.

    Yes. We will be offering a Pro version in the future. Basically, we'll be offering a Basic, Standard (current) and Pro version of the plugin.

    Currently, you have the possibility to hook custom code to several exposed events and/or write some custom mesh postprocessor and inject them into the projection pipeline.
     
  5. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Yes, we forgot to change the price in the rush of the GDC preparation. :) So we decided to stay at the current price for another cycle.

    Yes. But this feature is currently in a beta state. Currently, you also have the limitation of just one skinned mesh renderer per decal instance.

    This is possible. But mesh-based decal do not reflect changes in the built-in LOD system of the terrain as this information is not accessible.

    Both cases are supported.
     
  6. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Thank you! :)

    We planned some more advanced prefab workflows, but haven't them implemented yet. But with some lines of code you can create your own prefab helper.

    I have attached a possible solution for your use case below.
    1. Add the script in a folder named "Editor"
    2. Select a game object with some decals as children
    3. Trigger the prefab creation using the "Assets/Create Prefab from Selection" menu point.
    Please let us know if this is what you were after.

    Code (CSharp):
    1. using ch.sycoforge.Decal;
    2. using UnityEditor;
    3. using UnityEngine;
    4.  
    5. public static class DecalPrefabWindow
    6. {
    7.     //--------------------------------
    8.     // Methods
    9.     //--------------------------------
    10.  
    11.     [MenuItem("Assets/Create Prefab from Selection")]
    12.     private static void CreatePrefab()
    13.     {
    14.         CombineSelected();
    15.     }
    16.  
    17.     private static void CombineSelected()
    18.     {
    19.         GameObject selected = Selection.activeGameObject;
    20.  
    21.         if (selected != null)
    22.         {
    23.             bool deleteSources = EditorUtility.DisplayDialog("Delete", "Should the original decals be deleted?", "Yes", "No");
    24.             EasyDecal[] decals = selected.GetComponentsInChildren<EasyDecal>();
    25.  
    26.             GameObject container = BatchDecals(decals);
    27.  
    28.             if(deleteSources)
    29.             {
    30.                 DeleteDecalSources(selected.transform);
    31.             }
    32.  
    33.             if (container != null)
    34.             {
    35.                 container.transform.SetParent(selected.transform);
    36.  
    37.                 string path = EditorUtility.SaveFilePanelInProject("Save prefab", selected.name + ".prefab", "prefab", "Select path in your project");
    38.                 string pathMesh = path.Replace(".prefab", "_mesh.asset");
    39.  
    40.                 Mesh mesh = container.GetComponent<MeshFilter>().sharedMesh;
    41.  
    42.                 AssetDatabase.CreateAsset(mesh, pathMesh);
    43.  
    44.                 Object prefab = PrefabUtility.CreateEmptyPrefab(path);
    45.                 PrefabUtility.ReplacePrefab(selected, prefab);
    46.                 AssetDatabase.Refresh();
    47.             }
    48.         }
    49.     }
    50.  
    51.     private static GameObject BatchDecals(EasyDecal[] decals)
    52.     {
    53.         GameObject combinedRoot = null;
    54.  
    55.         if (!(decals == null && decals.Length == 0))
    56.         {
    57.             CombineInstance[] toCombine = new CombineInstance[decals.Length];
    58.  
    59.             MeshFilter combinedFilter;
    60.             MeshRenderer combinedRenderer;
    61.  
    62.             // Create root container
    63.             combinedRoot = new GameObject("Combined Root");
    64.  
    65.             // Add needed components
    66.             combinedFilter = combinedRoot.AddComponent<MeshFilter>();
    67.             combinedRenderer = combinedRoot.AddComponent<MeshRenderer>();
    68.  
    69.             Mesh mesh = new Mesh();
    70.  
    71.             for (int i = 0; i < decals.Length; i++)
    72.             {
    73.                 EasyDecal decal = decals[i];
    74.  
    75.                 toCombine[i].mesh = decal.SharedMesh;
    76.                 toCombine[i].transform = decal.transform.localToWorldMatrix;
    77.             }
    78.  
    79.             // Add renderer and assign material
    80.             combinedRenderer.material = decals[0].DecalMaterial;
    81.  
    82.             // Create new mesh and combine          
    83.             mesh.CombineMeshes(toCombine);
    84.  
    85.             combinedFilter.mesh = mesh;
    86.         }
    87.  
    88.         return combinedRoot;
    89.     }
    90.  
    91.     private static void DeleteDecalSources(Transform parent)
    92.     {
    93.         EasyDecal[] decals = parent.GetComponentsInChildren<EasyDecal>();
    94.  
    95.         foreach(EasyDecal decal in decals)
    96.         {
    97.             GameObject.DestroyImmediate(decal.gameObject);
    98.         }
    99.     }
    100. }
    101.  
     
    PixelNAUTS_Alex likes this.
  7. PixelNAUTS_Alex

    PixelNAUTS_Alex

    Joined:
    Sep 14, 2012
    Posts:
    51
    Holy cow!!! This is amazing support!!!! That did exactly what we needed too! Thanks soooooo much, you're the best!!
     
  8. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    You are very welcome! :)
     
  9. IkaBika

    IkaBika

    Joined:
    Jul 23, 2013
    Posts:
    37
    Not allowed to access colors on mesh 'Combined Mesh (root: scene) 25'
    UnityEngine.Mesh:set_colors(Color[])
    ch.sycoforge.Decal.Projectors.Projector:UpdateVertexColor()
    ch.sycoforge.Decal.EasyDecal:Update()

    Start getting those in console when used on object with planar projection. How can I fix this errors ?
     
  10. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Have you accidentally set the decal to static? If not, what is your use case and setup?
     
  11. IkaBika

    IkaBika

    Joined:
    Jul 23, 2013
    Posts:
    37
    yeap and already figured out. Great asset and support as always ! :)
     
    Sycoforge likes this.
  12. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Glad to hear! :)
     
  13. ZorbaTHut

    ZorbaTHut

    Joined:
    Mar 19, 2014
    Posts:
    20
    Just picked up EasyDecal to replace a package that has given us pretty serious headaches. EasyDecal seems to work great . . . when it works. Unfortunately it does not always work :)

    We're using a totally generic Skinned Box decal. I recognize that this is still beta, but that's the feature we need. On one model, this seems to work fine as long as the box doesn't cover the model's hips; if it does, it starts spamming the following error:

    IndexOutOfRangeException: Array index is out of range.
    ch.sycoforge.Decal.Projectors.Geometry.DynamicSkinnedMesh.OnProcessVertexIndex (Int32 index, Boolean valid)
    ch.sycoforge.Decal.Projectors.Geometry.DynamicMesh.AddMeshData (IList`1 vertices, IList`1 normals, IList`1 tangents, IList`1 uvs, Matrix4x4 localToWorld)
    ch.sycoforge.Decal.Projectors.Geometry.DynamicMesh.Add (IList`1 triangles, IList`1 vertices, IList`1 normals, IList`1 tangents, IList`1 uvs, Matrix4x4 localToWorldMatrix)
    ch.sycoforge.Decal.Projectors.Geometry.DynamicMesh.Add (UnityEngine.Mesh mesh, Matrix4x4 localToWorld)
    ch.sycoforge.Decal.Projectors.Geometry.DynamicSkinnedMesh.Add (UnityEngine.Mesh mesh, UnityEngine.Transform[] bones, Matrix4x4 localToWorld)
    ch.sycoforge.Decal.Projectors.SkinnedBoxProjector.AddMesh (UnityEngine.Mesh mesh, UnityEngine.SkinnedMeshRenderer renderer, UnityEngine.Transform receiver)
    ch.sycoforge.Decal.Projectors.SkinnedBoxProjector.ProcessReceiver (UnityEngine.GameObject receiver, Int32 recursiveStepUp, Int32 recursiveStepDown)
    ch.sycoforge.Decal.Projectors.SkinnedBoxProjector.Project ()
    ch.sycoforge.Decal.EasyDecal.Update ()

    We've updated to the version available on the website, but that didn't change the error (it *may* have helped; I thought it didn't work at all, and then I updated, and it worked on the head and the feet. But I may just not have thought to test that before updating.)

    Any way I can help you get a fix?
     
  14. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Could it be that your character has more than one skinned mesh renderer attached? The current version supports only one skinned mesh renderer. This is one of the limitation currently present in the beta version.

    Could you please send us a simple example causing this error, if said limitation doesn't apply to your use case?

    Thank you for the report! :)
     
  15. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    104
    based on the bullet holes example provided I bought the asset, and started adding it to my project tonight. All the holes are disappearing after a few seconds, I currently am doing target practice testing, so I need them to never go away, but I don't see an option to get them to not fade out.
     
  16. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    You can disable the fade out in the Constraints tab.

    ed-fade-out.jpg
     
  17. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,475
    Is there a way to get current scene decals?

    like instead of me doing something this

    int decalCount = 0;
    foreach (var item in EasyDecalManager.SceneDecals) {
    decalCount++;
    }

    is it stored somewhere I can get access too that is more efficient than the above :)

    had another question but have totally forgotten it now
     
  18. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Yes sure. :) The exposed property is a generic IEnumerable<EasyDecal> interface so you can just get the decal count like the following:

    Code (CSharp):
    1. int count = EasyDecalManager.SceneDecals.Count();
    2.  
    Hope this helps.
     
  19. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,475
    I tied that before, no dice it has no definition for Count :S

    fff nvm System.Linq :)
     
    Last edited: Mar 23, 2017
  20. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Those extension methods... :)
     
  21. SimonsCat

    SimonsCat

    Joined:
    Mar 11, 2015
    Posts:
    19
    Hi,

    Im using ED Box Projection with ED Standard (Specular , Vertex Alpha) shader.
    My problem is that I want the decals to receive shadows but the current shader does not allow them I guess. Can I have this type of decals and get shadows on them?

    What about SSD shader that behave like Standard shader (material with albedo, specular, normal, transparency + receiving shadows)?

    Thanks.
     
  22. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Hi,

    Unfortunately, materials using real transparency can not receive realtime shadows in Unity. However, Cutout transparency can.

    So basically you can either use one of the included cutout shaders or switch to the deferred workflow.

    That's will work when setting the Buffer property to Everything. Although the deferred workflow is still in beta it will handle almost every lighting case.

    ed_decal_shadow.jpg
     
  23. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    100
    Hi,

    I opened the demo scene, and cannot see the skinned decal as shown in the following screenshot. If I try to move the decal, Unity will crash immediately. I am using the latest EasyDecal and Unity 5.5.0f3. Any idea? Thank you.
     

    Attached Files:

  24. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    100
    Hi,
    How would you handle the case when, for example, a bullet hole is projected on the edge. From the pictures you posted on the first page look nice, but the bullet hole looks weird when it is almost at the same angle as one of the face (if 45 degree it looks fine). However we cannot control the shooting angle if I just use hitInfo.normal. I am using Box technique. Thank you.
     

    Attached Files:

  25. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Just tried to reproduce in Unity 5.5.0 without luck. Could it be that you accidently have set the layer mask to Nothing?

    ed_skinned_mask.jpg
     
  26. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    100
    Thank you for quick reply. I played around with EasyDecal for a while and check back the demo scene. The skinned decal is correctly shown now. However everytime I start dragging the decal transform, Unity will crash immediately. I can just see access violation from the error log. Any idea? Thank you.

     
  27. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    You could constrain the projection angle in the Constraints tab or average the surface normals as shown in the Advanced Bullet Hole example.

    ed_constraints_angle.jpg
     
  28. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    This sounds strange as Easy Decal just operates in the managed lands and has no native methods.

    Does this only occure with the skinned decals? Are the grafitti decals in the demo scene movable without any problems?
     
  29. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    100
    Yes, all other decals are movable without any problem. Also, if I change any of them to skinned decal, Unity will crash immediately when I click "Skinned Box" from the combined check box.
     
  30. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    I guess that there's a problem with the Kyle-Model.fbx file. Probably Unity messed something up while importing it. Try to reimport everything under the following path: Assets/nu Assets/Easy Decal/Demo/Object/Kyle
    After reimporting please check if the Read/Write Enabled option is checked on the Kyle-Model.fbx file's import settings.
     
  31. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    100
    I finally figured out I have turned on GPU skinning in Player Setting. If I turn it off, it works without crash. FYI. Thank you.
     
    Last edited: Mar 30, 2017
    hopeful likes this.
  32. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Successfully reproduced. Thank you for the report.

    What happens if you switch to play mode? Are the skinned decals still not visible?

    This error message is related to the Plane projection grafitti decal. This is most likely a deserialzation problem caused by the lower unity version the scene was saved in. Moving said decal and resaving the scene will most likely solved this issue.
     
  33. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    100
    I deleted all Atlases now it works.

    Sorry for another issue, I use the Sci Fi skinned decal on my own model, it shows nothing. My model is one skinned mesh with group of colliders. Any idea? Thank you.
     

    Attached Files:

  34. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Does the decal's projection box intersect the actual skinned mesh? When using Smart Placement the decal gets oriented based on the collider's surface which sometime leads to non-intersecting placements (depending on the collider/decal transformation).

    ed_skinned_intersection.jpg
     
  35. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    100
    Since I use ragdoll for my model, so I have group of box colliders and capsule colliders. Is it ok?
     

    Attached Files:

  36. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    The current beta version needs the colliders to be on the same level as the SkinnedMeshRenderer, this will change in the upcoming version. If you you like to live dangerous you could send us an email (including your invoice no) and request a recent development built. :)
    The current dev build includes a new component called SkinnedMeshLink which allows bone-to-mesh bindings.
     
    Last edited: Mar 30, 2017
  37. stevenwanhk

    stevenwanhk

    Joined:
    Jul 20, 2016
    Posts:
    100
    I just added code to project skinned decal in runtime. I noticed some of decals can be shown ingame, but it creates many AABB errors at the same time and it lags heavily.
    Since we will be in production soon. I guess we will now forget this feature first. We look forward to next version. Thank you for your support!
     
  38. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Runtime instantiation of skinned decals is not officially supported in the beta, but not restricted because of the shared API. The lag itself is basically caused by the log interupt. This issues will all be solved until the skinned decals are out of the beta state.

    We'll post here when the next version is available.
     
  39. yezzer

    yezzer

    Joined:
    Oct 30, 2009
    Posts:
    143
    @nu-assets I'm currently using the SSD and Multiply SSD shader - are there any other variations of this shader? I'd like to have something with normal, metallic, smoothness, height - is this even possible? I'm not a shader programmer, but if it's feasible I could probably find someone..
     
  40. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    The multiply screen space shader is currently the only SS shader for the forward rendering path. This will change in a future version with the coming unified (Unity Standard) shader workflow.

    But when in the deferred path, you can utilize Albedo, Normal, Spec and Emission maps. Height is currently not possible in screen space. But we may find a reasonable (performance wise) to pixelwise height interpretation.

    ed_deferred_ssd.jpg
     
  41. yezzer

    yezzer

    Joined:
    Oct 30, 2009
    Posts:
    143
    Thanks! Sadly I have to use forward rendering for VR. Do you know when the unified (Unity Standard) shader workflow is due?
     
  42. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Hard to say when it's officially available. It will took some weeks I guess. We have a lot of conferences on our schedule ( Fantasy Basel, World VR Forum, Nordic Games, etc) in the next weeks so we cannot deliver as fast as usual.
    If you happen to be at one of those events it would be great to meet you there.
     
  43. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    @yezzer If you need static decals you could also switch to the classic mesh decals as they support each and every shader and update when the new shader core will be available.
     
    yezzer likes this.
  44. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Is it feasible to create an ingame editor so players can customize vehicles with decals and have them saved?
     
  45. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Yes. That's possible. But Easy Decal just provides features for rendering, managing, placing and texturing decals. Things like runtime serialization and a runtime decal editor can be developed on top of the decal framework, but are not included in the package.

    I have attached a basic example project showing a simple possible implementation.
     

    Attached Files:

    TooManySugar likes this.
  46. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    169
    Any plans to release this asset with source code?
     
  47. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    635
    Please excuse the late reply. We are currently at the World VR Forum in Crans Montana.

    Yes. There are plans.
    Easy Decal comes bundled in a dll not to hide information, it's just more convenient for (almost) every stakeholder in a module driven environment. Currently you can easily decompile the lib as we have not protected nor obfuscated the source. :)
     
  48. Michael-Ryan

    Michael-Ryan

    Joined:
    Apr 10, 2009
    Posts:
    149
    When building our project in Visual Studio, we receive the following warnings:

    The primary reference "ch.sycoforge.Decal" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.

    The primary reference "ch.sycoforge.Decal.Editor" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.


    What can be done to fix or remove these warning so they do not constantly appear when building in Visual Studio?
     
  49. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    284
    Hi !
    Before buying your asset I would like to know if I can make a decal (like a blood splatter) on the ground and easily ignore the character when he will walk on it (the character is a skinned mesh). And if it's possible at what cost ?
    We are using right now the plugin called "Dynamic Decals" and when you want to mask an object (specially a skinned mesh) from the decal system, you got a spike of like 2ms on pc (which is not acceptable imo).

    Thanks !
     
  50. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,646
    [Off-Topic]
    Salut Cayou. :cool:
    [/Off-Topic]
     
    Sycoforge and cAyouMontreal like this.
unityunity