Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Easy Decal - Decals everywhere

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

  1. joz_nascimento

    joz_nascimento

    Joined:
    Oct 24, 2017
    Posts:
    29
    HI, can i use EasyDecal to draw texturized lines on objects? Like a road center line.

    cheers
     
  2. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    I've inherited a project with Easy Decals.

    Is it possible to get a DLL that doesn't generate garbage every frame?
     
    Ramsdal likes this.
  3. Shiyao

    Shiyao

    Joined:
    Nov 27, 2013
    Posts:
    23
    Dose this plugin work with Unity 2018.1, Thanks.
     
  4. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    The current release is not submitted with 2018 but it should all work flawlessly. You could also request an evaluation version by sending us an email. This way you can try it before buy it in your project's environment. :)
     
  5. Shiyao

    Shiyao

    Joined:
    Nov 27, 2013
    Posts:
    23
    Good to know I can try it before buy. Thanks for your information.
     
  6. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    So... no-go for the garbage?
     
  7. BitAssembler

    BitAssembler

    Joined:
    Jul 13, 2017
    Posts:
    90
    When using one of the mesh-based decals it's not possible to work with zero heap activity. This is due the engine design. When you access mesh data, Unity allocates memory to pass the data from the unmanaged to the managed land.

    When you bake the (mesh) decal you have zero-activity on the heap, meaning zero garbage.
     
  8. BitAssembler

    BitAssembler

    Joined:
    Jul 13, 2017
    Posts:
    90
    Technically possible, but this will maybe generate to much overhead as you have to split the line into segments and then draw a decal for every segment. :)
     
  9. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Can you point me to the Unity call you're using that generates garbage? Unity have been trying a lot to add non-garbage methods everywhere for quite a while now. Right now, in a moment where nothing is happening, 2kb+ of garbage per frame is not normal.
     
  10. BitAssembler

    BitAssembler

    Joined:
    Jul 13, 2017
    Posts:
    90
    If you don't bake the mesh decal, the system will frequently access the mesh data the intersects the bounding box (projection volume) of the decal. One cannot create an array without heap allocation. The functions in question are mainly mesh access functions:
    unity_heap_alloc.jpg

    But if you need no dynamic mesh decal, you can bake it (at design time or on awake). Please have a look at the embedded video showing this.

     
  11. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    If I look at GetTriangles: https://docs.unity3d.com/ScriptReference/Mesh.GetTriangles.html

    There's 2 overload that uses a List<Vector3> to avoid heap allocation.
    And if you pre-warm the List to a large enough size, you will never hit a List re-sizing.

    There is no excuse for heap allocation every frame.
     
    ratking likes this.
  12. M-Hanssen

    M-Hanssen

    Joined:
    Sep 8, 2014
    Posts:
    34
    We've been using easy decal for quite some years now. Performance using box projection has always been an issue.
    Lately we're apparently pushing easy decal to it's limits. We currently project +/- 165 decals as a static score overlay on some scene objects (bake on awake enabled) and also spawn a random +/- 800 box projected decals on hit impact (also bake on awake enabled) We sometimes get spikes of 4mb GC alloc accompanied by a stunning 280ms lag per frame.
    Below I posted a screenshot of a random frame when having 161 decals inside the scene and spawning another 4 (taking 451kb GC alloc accompanied by 88ms lag). Can anyone please make some educated assumptions about this problem? Is this an internal Easy decal issue or can we do something about this growing heap memory and ridiculous GC calls?
     

    Attached Files:

  13. LasseWestmark

    LasseWestmark

    Joined:
    Mar 18, 2014
    Posts:
    12
    Hi, we have a bit of a special setup in our project where the main camera is in a master scene and decals are in another. Both scenes are loaded at the same time.
    We get the error "Easy Decal: No main camera found in scene. Deferred decals cannot be rendered. Please tag your camera as 'MainCamera'." as the deferred decal can't find the main camera across scenes.
    The decals still work tho. We just have that annoying error popping up.
    It would be nice if the decal could search across loaded scenes.
     
  14. KospY

    KospY

    Joined:
    May 12, 2014
    Posts:
    153
    Hi, does it possible with this asset to only draw a decal on one mesh only?
    My objective is to add decals on skinned and classic meshs without them projecting into each others if they are at proximity. I can't use layers as will need to put each objects on a specific layer.
     
  15. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    easy decal is not working on unity 2017.4.1???
     
  16. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    Unity 2017.4 == Unity 2017.3. It works on 2017.3, so it does work on 2017.4.
     
    BitAssembler likes this.
  17. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    No its not working. However, i am using gamma color space and forward rendering with android build settings, could this be the problem ? Also when i place built in decal prefab to the plane it renders some black bars.
     

    Attached Files:

    Last edited: Jun 12, 2018
  18. arzi42

    arzi42

    Joined:
    Sep 16, 2016
    Posts:
    12
    Hi, I updated the plugin today after we upgraded to Unity 2018.1, and there are several warnings with the plugin. We have a zero warning policy in the company, so having to fix warnings in a plugin is quite annoying and makes the plugin's code itself feel sloppy.

    Assets/Plugins/nu Assets/Easy Decal/Scripts/Editor/EDStandardShaderGUI.cs(11,17): warning CS0612: `UnityEditor.ColorPickerHDRConfig' is obsolete

    Assets/Plugins/nu Assets/Easy Decal/Scripts/Editor/EDStandardShaderGUI.cs(182,35): warning CS0618: `UnityEditor.MaterialEditor.TexturePropertyWithHDRColor(UnityEngine.GUIContent, UnityEditor.MaterialProperty, UnityEditor.MaterialProperty, UnityEditor.ColorPickerHDRConfig, bool)' is obsolete: `Use TexturePropertyWithHDRColor(GUIContent label, MaterialProperty textureProp, MaterialProperty colorProperty, bool showAlpha)'

    Assets/Plugins/nu Assets/Easy Decal/Scripts/Editor/EDStandardShaderGUI.cs(182,35): warning CS0618: `UnityEditor.MaterialEditor.TexturePropertyWithHDRColor(UnityEngine.GUIContent, UnityEditor.MaterialProperty, UnityEditor.MaterialProperty, UnityEditor.ColorPickerHDRConfig, bool)' is obsolete: `Use TexturePropertyWithHDRColor(GUIContent label, MaterialProperty textureProp, MaterialProperty colorProperty, bool showAlpha)'
     
  19. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    647
    Hello I have a question, how to set lightmap parameters for decal if I can not see it mesh renderer?
     
  20. chalitnc

    chalitnc

    Joined:
    Aug 9, 2012
    Posts:
    13
    On 2018.2.0f1, decal animations don't seem to reset properly (using PoolManager, with DecalAnimation.Reset inside OnSpawned() doesn't seem to work, it just shows the full spritesheet).
     
  21. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi @Sycoforge

    I have your asset Easy Decals and I have made a build for PS4 with a sample scene that you have in your asset, and I throw these errors:
    ProblemEasyDecalPS4.jpg

    The build is made, but the decals that use the "Technique" Deferred on the PS4 come out in pink.

    Please, please indicate how we can solve it.

    I am looking forward to your response. a greeting
     
  22. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    They (the decals) seem to be not correctly aligned. Have you checked their orientation?
     
  23. BitAssembler

    BitAssembler

    Joined:
    Jul 13, 2017
    Posts:
    90
    Of course, you are right. Obsolote warnings are warnings too and when one does frequently update the engine this will be come an exception soon or later. But having dozens of preprocessor directives to grant backward compatibility is a real mess and leads to badly readable code.
     
  24. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Those warings will get fixed in the next update. Thank you for reporting.
    Edit: Sorry for the inconvenience.
     
    Last edited: Aug 7, 2018
  25. BitAssembler

    BitAssembler

    Joined:
    Jul 13, 2017
    Posts:
    90
    This seems indeed somehow weird. Have you large combined meshes in said scene? Actually, the mesh cutter receives all mesh objects intersecting a bounding box and when one of the meshes is very large this could be the cause of this massive spikes.
     
  26. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    You can s
    It's recommended to bake this kind of static decals to a mesh asset by pressing ALT + C. This method also saves you some performance as you don't have a script overhead.
     
  27. BitAssembler

    BitAssembler

    Joined:
    Jul 13, 2017
    Posts:
    90
    Can you manually reset the animation? What happens when you manually call Start() before the call to the Reset() method?
     
  28. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    yeah, i have checked the orientation, it alright, may be this is bug from your side.
     
  29. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    We'll check this. Thank you for the report.
     
    ftejada likes this.
  30. BitAssembler

    BitAssembler

    Joined:
    Jul 13, 2017
    Posts:
    90
    It would be great if you could post a video showing exactly what is happening because I wasn't able to reproduce this behavior. Thx!
     
  31. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    We have this on the roadmap under point "Custom exclusion list for Box projector".
     
  32. BitAssembler

    BitAssembler

    Joined:
    Jul 13, 2017
    Posts:
    90
    he
    Those new (available since Unity 2017.x) overloadings would be indeed helpful in reducing some of the allocations. Of course you know that there's a trade-off between memory extravagance (large buffer sizes) and CPU time/heap allocations. Finding the right balance is not always an easy task. But keeping buffers around to allow the creation of some smaller/average sized decals will be beneficial for the system.
     
  33. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi @Sycoforge
    One question: How can I make the decals adapt to the normal map of the wall or the ground where I put them?

    Other Asset:
    DecalsConNormal.jpg
    EasyDecals:
    DecalsSinNormal.jpg

    I have looked at the manual and its examples and I do not see how to get it.

    I await your response, greetings
     
  34. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    You have to switch to the deferred projection mode to let the decal write to the g-buffer.
     
    hopeful likes this.
  35. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi @Sycoforge
    The "Projection Mode" parameter does not have any "Deferred" option, it only has the options "Surface Normal and Projection Normal.

    So I assume that you refer to putting the "Tecnique" parameter in Deferred and I already tried that and it did not work for me. Also in my project I need in the decals an option to exclude some layers, (which is why I use your asset), and in the Deferred Technique there is no option to exclude layers ...
    If not your asset I can not use it for my project.
    On the other hand there is the problem that I mentioned in a post above:

    And I can not put that mode until you fix it so they work on PS4 and an option to exclude some layers en deferred tecnique. So I need a solution for both problems. An urgent patch would be very grateful

    What solution do you give me? Because for me it is very important to be able to use your asset in my project. And the end of the development should be at the end of this month of August, to send it to Sony.

    I leave video:


    I await your response, greetings
     
  36. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    My bad, actually it should be "Projection Technique". The deferred technique is the only technique that can write to g-buffers. This is not supported by mesh decals.

    Keep in mind, when using the deferred decals you need to change the material to "Easy Decal/SSD/Deferred SSD" and when there's a rendering artifact you may have to change to the Play Mode to force an initialization of the internal buffers.
     
  37. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    Hey hope a screenshot will do the trick.
     

    Attached Files:

  38. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Thanks for the screenshot. In your case, the decal's projection direction is parallel to the receiver's surface, so this is expected behaviour since the projection direction is in the negative y-axis. Please enable the "Show Projection Direction" in the Extras tab to get visual help for the projection direction.

    Hope this helped! :)
     

    Attached Files:

    lolclol likes this.
  39. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    ok that worked . Thanks :D
     
  40. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Have disabled the "Fade Out" option?
     
    lolclol likes this.
  41. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    yeah, sorry, i am very new at this . :D
     
  42. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    Whats this line on the decals ?

    Edit: I found out enabling bake on awake solved the artifact,
     

    Attached Files:

    Last edited: Aug 13, 2018
  43. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Hey, no problem at all! Glad it works on PS4 now. :)
     
    lolclol likes this.
  44. BitAssembler

    BitAssembler

    Joined:
    Jul 13, 2017
    Posts:
    90
    Nice!
     
  45. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    @Sycoforge
    I have also tried changing the material to "Easy Decal/SSD/Deferred SSD"
    But unless I add the normal map of the wall to the material of the decal, I can not get the decal to adapt to the reliebe of the normal wall.
    Which makes it unworkable for me.

    On the other hand I do not understand what you want to say to me with:
    It means that you can not add a LayerMask to exempt the Player on Deferred Technique ???

    Regards
     
  46. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    You have to use one of the provided Standard Shader Mask shader variants to mask out things. For example, you can use "Easy Decal/SSD/Standard DSSD Mask (Metallic)" for your character.

    It means that you cannot read the underlying normal information to properly light the decal material as it's possible with the Screen Space deferred technique.
     
  47. BitAssembler

    BitAssembler

    Joined:
    Jul 13, 2017
    Posts:
    90
    Also, make sure to slide down the "Decal Masking" shader property until it disappears.
     
    ftejada likes this.
  48. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    @Sycoforge
    I have tried to put the SSD technique to the Decal of the wall and with the only Shader that works it is with "EasyDecal / SSD / Multiply SSD". With this combination the Decal if it adapts to the reliebe of the wall.

    But I have put the Player Standard DSSD Mask (Metallic) shader, but the decal on the wall continues to paint on top of the Player. On the other hand I have to check that the "EasyDecal / SSD / Multiply SSD" shaders and
    EasyDecal / SSD / Standard DSSD Mask Do not give errors on PS4

    I have also tried to reduce the Shader EasyDecal / SSD / Standard DSSD Mask parameter to zero, "Decal Masking" in the Player shader as it said @BitAssembler , but it only works when I have the Deferred technique and the EasyDecal / SSD / Deferred Shader SSD.

    But the Deferred Technique and EasyDecal / SSD / Deferred Shader SSD shader, does not manage to adapt the Decal to the reliebe of the wall and neither compiles for PS4 ...

    Regards
     
  49. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    Is it possible to only design the level with easy decal and not providing the actual scripts attached to it? So that source remain to the owner only.
     
  50. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    I'm not sure if I understand you correctly but you could convert all decals to Unity meshes and ship the product like that.