Search Unity

Easy Decal - Decals everywhere

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

  1. SimonsCat

    SimonsCat

    Joined:
    Mar 11, 2015
    Posts:
    49
    Hi, I have few questions:

    How EasyDecal handles decal overlapping? Is there any flickering if the decals overlap? How do you set the z-order - render priority?
    Thanks for the answers ;)
     
  2. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    When using a shader that ships with Easy Decal the z-order gets "controlled" by the offset property in the shader. Each (mesh) decal can also by offsetted along the surface normal to control the z-ordering by the geometry itself.

    Upcoming versions will also include a shader to allow boolean overlapping/discarding. Especially interesting for bullet holes.

    Hope that helped. :)
     
  3. sdtfhsthsrt

    sdtfhsthsrt

    Joined:
    Sep 7, 2012
    Posts:
    1
    Hey, great asset for what we want it to do. We are, however, getting this problem opening the editor decal manager in Unity 5.4



    Any idea what it is?
     
  4. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Have you already downloaded the latest patch for version 1.6.0 from our website? It includes some minor changes for Unity versions above 5.3.6.

    Please let me know when the issues remain.
     
  5. FractalCore

    FractalCore

    Joined:
    May 15, 2009
    Posts:
    151
    Is Easy Decal suitable for someone who doesn't know how to program and only needs it for real time bullet holes, blood splatters etc?

    I use Playmaker and can easily instantiate a prefab at any location facing any direction. So can I create some kind of decal "spawner" prefab, that I can bring in at runtime wherever I want a decal, and have it do it's thing?

    I read you're planning on adding Playmaker support later, but this might be simple enough without it.
     
    Last edited: Aug 8, 2016
  6. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Basically, yes. For the most cases this would be sufficient. But for some edge cases you have to calculate the average orientation to minimize stretching etc. The (bullet hole) decal also have to be baked after the first projection cycle to save performance.

    What you could do, until Playmaker is officially supported, is attaching the script below to every of your decal prefabs and let the forward axis look in projectiong direction while instantiating. This way the decal gets instantiated using the API saving you some tricky steps.

    Code (CSharp):
    1. using ch.sycoforge.Decal;
    2. using UnityEngine;
    3.  
    4. public class ProjectBake : MonoBehaviour
    5. {
    6.     //------------------------------------
    7.     // Exposed Fields
    8.     //------------------------------------
    9.     public GameObject DecalPrefab;
    10.  
    11.     //------------------------------------
    12.     // Unity Methods
    13.     //------------------------------------
    14.     private void Start()
    15.     {
    16.         Ray ray = new Ray(this.transform.position, this.transform.forward);
    17.         RaycastHit hit;
    18.  
    19.         // Check if ray hit something
    20.         if (Physics.Raycast(ray, out hit, 5))
    21.         {
    22.             EasyDecal instance = EasyDecal.ProjectAt(DecalPrefab, hit.collider.gameObject, hit.point, -ray.direction.normalized);
    23.         }
    24.     }
    25. }
     
  7. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Showreel 2016

     
    Bhanshee00 and ZJP like this.
  8. PartyBoat

    PartyBoat

    Joined:
    Oct 21, 2012
    Posts:
    97
    Hey nu-assets,

    I have a quick question about Easy Decal. I'm looking for a system that will allow me to create bullet hole decals dynamically when I shoot at a wall. I also need to be performance-conscious because I'm working on a VR game, so I also need to know if Easy Decals is optimized for low draw calls/dynamically batched and if these decals can be dynamically placed on static objects.

    Thanks!
     
  9. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Hi,
    Depending on the geometry settings (mainly vertex attibutes) of the decal, the decals get auto-batched by Unity (more info here). The upcoming version (see roadmap) inlcudes the ability to batch decals per objects. This means if a game object has a DecalReceiver component attached the decals placed on said object will be automatically combined to a shared mesh (provided they share the same material).

    The successful decal projection to static objects (static meshes) mainly depends on the used projection technique and receiver setup. On our website you'll find more information abot projection targets and in the documenation on page 12+ you'll find pros and cons about the different techniques.

    Hope that helped. :)
     
  10. PartyBoat

    PartyBoat

    Joined:
    Oct 21, 2012
    Posts:
    97
    Thank you for the fast reply,

    Anyways, I've got a couple more questions. It looks like from what I'm reading that only the plane projection technique allows for the use of the "edge bleeding" feature that would keep bullet impacts, blood splatters, etc, from sticking out out over the edge of an object. It also seems like from what you linked that box projection is the only technique that works with static objects. :(

    So basically does this mean that you can't stop bullet decals from sticking out over edges when using static objects for your environment? Would there be some other way to avoid that visual error with Easy Decals when working (almost) exclusively with static objects?

    Lastly, I assume that your asset is fairly performance friendly, but I'd like to be sure that I'm not getting an asset that is going to tank my framerate (it's pretty challenging to keep the required 90FPS+ for VR). Do you have any benchmarks or any kind of information on the general performance impact of placing decals dynamically into the scene? If I take a significant FPS hit just from 50-100 or so bullet decals then I think I'll have to skip out on them altogether for my game.

    Sorry for all the questions! Thanks again!
     
  11. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    No. All the techniques prevent the decals from overlapping an object. Edge bleeding in this context is the ability to fade-out the decal at its borders.

    No. Planar projected decals will also work provided that a MeshCollider or a perfect fitting BoxCollider is present. But this also applies to the Box projector. Screen space decals work everywhere.

    No. :)
     
  12. PatrickLipo

    PatrickLipo

    Joined:
    Mar 14, 2015
    Posts:
    36
    Hi there. I'd been evaluating a few solutions for putting simple roads on a terrain mesh for a top-down procedurally-generated world. I purchased Easy Decal and did a naive test to get a sense of quality, and results were pretty good even with temp art, which is exciting:


    However, as I said, my first attempt was pretty naive, and unsurprisingly I took a pretty big frame rate hit. I'm eager to move to using atlases to see if it can save me. However, the atlas system isn't particularly well documented...

    The language of the document suggests that the program might construct the atlas for me... The instructions suggest I create a new atlas, but so far I assume I can only pick an atlas that already points to an atlas (and shader) that I've already constructed? Or is the "From Sprites" button supposed to do something? (I don't know what to drag in there: not materials or textures...)

    Well, even working with a pre-made atlas texture, unfortunately I'm stuck. As you can see above, I need decals with very specific sizes, so in order to create them with precision, I need to enter values directly into the region edit. Unfortunately these numbers are not consistently read... they tend to (mostly) get thrown out after you hit "Apply". I think I can only adjust the size by manipulating the marquee directly in the window. This unfortunately is not precise. The manual more or less just guided me through opening an already-created atlas, so I'm not sure I didn't miss something.

    Thanks!
     
    jimmy_doodle likes this.
  13. PatrickLipo

    PatrickLipo

    Joined:
    Mar 14, 2015
    Posts:
    36
    Okay, I managed to edit the Atlas asset directly with notepad. But it's definitely a bug I'd appreciate y'all saving me from in the future.
     
  14. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Indeed! Really love your use case! :)

    It's very important to bake the decals (when using the API at runtime this gets automatically done). When placing them at design time in the editor: Use an atlas and combine them using the decal manager (Window/Easy Decal Manager).

    The atlas editor's purpose is (currently) only to define and manage UV regions in an atlas texture. An texture atlas creator is currently under development.

    When firstly introduced the atlas editor in Easy Decal many users already have done their atlases using the default Unity sprite editor. To prevent the user from losing all the previous work, the sprite converter was added to the Easy Decal framework. What this function actually does is converting UV regions defined in Unity sprite editor to an atlas that Easy Decal can consume.

    To allow any material/shader to be used for the decal rendering, the atlas asset, as Easy Decal in general, needs a reference to a material. The atlas editor automatically uses the texture slotted to the materials main texture.

    This issue was introduced with the last editor update (thanks for reporting this). This has been fixed on today's sunday-patch :)
    You can download the latest patch from our website. Just link the Unity invoice number to your account here.

    Currently, when working with an atlas the workflow is as the following:
    1. Create your atlas texture in the program of your choice
    2. Create a material with the shader of your choice
    3. Create a new atlas asset using Easy Decal
    4. Define all the regions that you need with the Easy Decal atlas editor
    5. Assign the atlas to all your Easy Decal prefabs that should use this specific atlas
    Hopefully, I could shed some light to your issue.
     
    jimmy_doodle likes this.
  15. PatrickLipo

    PatrickLipo

    Joined:
    Mar 14, 2015
    Posts:
    36
    Thanks for the help so far! Y'all are responsive and I certainly appreciate that.

    I definitely saved some perf by using atlases (5-10 FPS), but baking had the biggest impact, bringing FPS from ~22 to ~50 (in editor). I set Baking=true after my terrain generator got done moving all the decals around, but had some quirks with some decals not lining up with the ground until I realized that some but not all of my decals went through a render before Baked=true (so they weren't yet in position). A bit of fiddling with Script Execution Order took care of that.
     
  16. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    The projection phase is the most performance-hungry part of a (mesh) decal.

    Upcoming versions will expose a LateBake() method to better fit into procedural and more complex workflows. Load balancing and multithreading functionalities are currently under development.
     
  17. Karkazaz

    Karkazaz

    Joined:
    Mar 11, 2014
    Posts:
    32
    I can't seem to use the EasyDecal deferred rendering. It is not visible in any way I use it.
    The deferred multiply rendering is however visible, but it are too dark. Anyone with the same problem?
     
  18. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Can you see the two SSD graffity decals (green box) in the "scene_demo.unity" scene?
     
  19. jimmy_doodle

    jimmy_doodle

    Joined:
    Nov 8, 2015
    Posts:
    22
    I can see the all the 4 grafiti decals. But I can confirm that I can not see the diffuse tex of the bullet hole prefab (ssd mul also works). Although I can see the normal map? I thought I could remember seeing the bullet decals when 1.6.0 came out.
    @nu-assets
    Did Unity change something in the 5.4 version?
     
  20. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    We'll further investigate. @jimmy_doodle Can you provide us your system specs?
     
  21. Karkazaz

    Karkazaz

    Joined:
    Mar 11, 2014
    Posts:
    32
  22. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
  23. Karkazaz

    Karkazaz

    Joined:
    Mar 11, 2014
    Posts:
    32
  24. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    The setup seems to be right.

    Most likely the decal is not showing up because you are in play mode and the main camera doesn't "see" the decal right now. The deferred pipeline currently works as the following:

    • There's not optimization while in edit mode (no culling)
    • The decals get rendered foreach camera (scene, player, preview)
    • When entering play mode, only the decals get rendered that are currently visible to the main camera.
    Please let me know if you were not in play mode.
     
  25. Karkazaz

    Karkazaz

    Joined:
    Mar 11, 2014
    Posts:
    32
  26. Karkazaz

    Karkazaz

    Joined:
    Mar 11, 2014
    Posts:
    32
  27. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    @Doodlemeat Ok. Got the issue. Under some conditions the decal root gets not automatically created. Follow the steps below to force the system to create one.

    1. Drag any decal to the scene that uses an atlas (e.g. one of the graffiti prefabs)
    2. Open the decal manager
    3. Go to the Atlas Groups tab and click to the combine button
    4. Now there should now be new game object called [Decal Root]
    5. The combined mesh can now be released in the Combined Groups tab
    ed-decal-root.jpg

    The clipped decal seems to a result of too large value on the Distance property. Try keeping the distance as low as possible.

    ed-decal-distance.jpg

    Please let me know if it's working now. :)
     
  28. Karkazaz

    Karkazaz

    Joined:
    Mar 11, 2014
    Posts:
    32
    Thx for help.
    It was indeed too large of a distance.
    But I don't think I will use deferred decals, seems too be like to much work to get it done properly. The decal root was actually in the scene the whole time, so it has to be something else.

    Anyway, the standard way of rendering works as good, if not better.
    Although I got some more problems :)

    1. When creating decals in 90 corners, the look like this:
    And I figured I can fix this problem by lowering the angle in "Constraints". However, it would be nice if the bullet hole continued on the other wall. and not went stretching. The way I am instantiating the decals is like this:
    Code (CSharp):
    1.  
    2. EasyDecal bulletHole = EasyDecal.ProjectAt (bulletDecal, gameObject, e.point, e.normal);
    3. bulletHole.SendMessageUpwards("Update"); // I had to update the decal before setting baked to true, else it wont work
    4. bulletHole.Baked = true;
    5.  


    2. The decals are not properly responding to light.
    I guess you'll need more information to figure out what's the issue here?


    I appreciate all the help <3
     
  29. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    When it comes to rectangluar edges the result completely depends on the right orientation. Basically one have to find the average surface orientation. A simple example can be found here.

    With the patch 4 you can also do it like this:

    Code (CSharp):
    1. bulletHole.LateBake(1);
    This will bake the decal before entering the next dynamic geometry update.

    Depending on the used shader one have to enable the Calculate Normals and Calculate Tangets options in the Geometry tab. If those options are enabled, it's very likely a lightmap issue.

    Appreciate your reports and updates! :)
     
  30. jimmy_doodle

    jimmy_doodle

    Joined:
    Nov 8, 2015
    Posts:
    22
    @nu-assets Thanks for the patch it's working great! :)
    @Doodlemeat I have found out that the Unity deferred path doen't work with orthographic cameras.
     
  31. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Unfortunately, that is true. See here.
     
  32. Karkazaz

    Karkazaz

    Joined:
    Mar 11, 2014
    Posts:
    32
    I am using a perspective camera :)

    @nu-assets
    But I suspect the light issues with the decal has to do something with what this guy explains here:

    "The albedo is just relevant for direct lighting"

    Which is also maybe why when I look at my decals in the game, I can see the very very bright reflections when facing the sun angle. This happens even when I am inside an enclosed room xD

    My shader is correct(the standard easy decal shader). Also my normals and tangents looks correct.
     
  33. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    The video is about the deferred pipeline. Unfortunately, this does not apply to the good old mesh decals.

    Dynamically instantiated mesh decals and statically baked lightmaps can lead to this result. I'll keep you updated about this.
     
  34. Karkazaz

    Karkazaz

    Joined:
    Mar 11, 2014
    Posts:
    32
    Okay, then I understand :)
    It would be awesome to be able to instantiate decals and have them respond correctly to lighting
     
  35. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    @Kemonono @FractalCore
    An initial set of PlayMaker actions and a demo project is available for download on our website.

    Just make an account and link your Unity invoice number to your account to get instant access.

     
    Bhanshee00 likes this.
  36. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    The problem is that baked lightmaps are actually no "real" lights. Tomorrow's build will come with initial light probe support.

    Comparison in a low-light area:

    ed-light-probes.jpg
     
  37. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Version 1.6.1 available for download.

    Changelog

    Features

    • Atlas Editor: Centered zoom functionality added.
    • General: More decal fade modes added to the API.
    • General: Added LateBake() and LateUnbake() method.
    • General: Added advanced raycasters for surrounding surface examination.
    • General: Added initial light probe support.
    • Inspector: Added warnings when material needs shader keywords activated.
    • DSSD: Added fade out support to the deferred screen space shader.

    Fixes
    • UI: Fixed Lifetime property also changes FadeoutTime property.
    • DSSD: Fixed 'Diffuse Only' not working properly.
    • DSSD: Fixed DSSD decals not working when the material has not been inspected/changed.
    • Mesh Processors: Fixed vertex colors changes don't get applied in custom mesh processor.
    • Atlas Editor: Fixed manual changes get not applied.
    • Atlas Editor: Fixed click to active region does not trigger region changed event.

    Changes
    • SSD: Screen space decal culling has been disabled in the editor while not in play mode.
    • Demo: Added Light Probe Group to tunnel demo.
    • Gizmo: Scene gizmo shows whether a decal is baked or not.
    • Inspector: Removed functions and options that have no effect on a prefab in the project view.
     
    Last edited: Sep 22, 2016
  38. habsi70

    habsi70

    Joined:
    Jan 30, 2013
    Posts:
    25
    Hi,

    for an upcoming small project I am evaluating decal solutions on the asset store and your product seems to be the closest fit to me. I would need to project decals at runtime and be able to reposition them. I read in your docs that I can instantiate a decal projection. Is ist possible to drag it afterwards, like it seems to be possible in the editor?

    Thank you
    habsi
     
  39. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Yes, that's possible. But the simplified positioning functionalities are only available in the editor.

    When projecting a decal using the API the decal gets automatically baked after the projection has been finished. So when you have to reposition the decal you have to unbake the respective decal instance.

    The workflow could be like the following:

    Project decals using the API and store the instance reference.
    Code (CSharp):
    1. EasyDecal instance = EasyDecal.ProjectAt(...);
    Once you need to move the decal unbake the geometry.
    Code (CSharp):
    1. instance.LateUnbake();
    When done bake it again.
    Code (CSharp):
    1. instance.LateBake();
    The same could be achieved using the Bake property but the LateBake() and LateUnbake() methods are taking care that the dynamic geometry gets updated at least once.

    These methods are part of the 1.6.1 update which is not yet available in the store, but can be downloaded using the UAS invoice number here.
     
    habsi70 likes this.
  40. habsi70

    habsi70

    Joined:
    Jan 30, 2013
    Posts:
    25
    Wonderful, thanks for the fast reply! Easy Decals it is then :)
     
  41. angeliapayne

    angeliapayne

    Joined:
    Jul 13, 2012
    Posts:
    30
    Hi, new user to Easy Decals here. I'm using decals in Unity 5.3.2p3, forward - linear rendering. When I add a decal to a building wall and use the Easy Decal Standard shader, I get some reflectivity on the decal from certain angles (despite setting both by Metallic and Smoothness properties of my decal material to 0. I don't appear to have this issue in gamma mode. I'd like to stick with linear - any insights?

    Drip decal applied to wall and white louvres - orthagonal view


    Drip decal applied to wall and white louvres - angled view (Note "reflective" properties on left decal)
     
  42. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Thank you for getting in touch. I guess that's a relic from the early Unity 5 days. The said shader is an extended CG clone of the Unity Standard Metallic shader. We are in the process of rewritting those to surface shaders using the standard lighting model. The patch 2 of version 1.6.1 - which we will release tomorrow - will include an initial version of those new shaders.
    I'll give you a ping when the patch is available on our website.
     
    angeliapayne likes this.
  43. angeliapayne

    angeliapayne

    Joined:
    Jul 13, 2012
    Posts:
    30
    Sounds great, thanks! Also, just so you are aware, the effect lessens when you increase the Smoothness property of the material to 1. It seems counter intuitive since that should make the material more mirrored but it's like it has an opposite effect. (again in forward-linear mode). Just thought I'd let you know.
     
  44. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    @angeliapayne
    Patch 2 of version 1.6.1 is alive and can be downloaded from or website. Have a look at the FAQ's on how to download the latest versions and patches.

    Please update to version 1.6.1 before applying patch 2 (just for the case that you haven't already updated).

    Please test your case with one of the following shaders:
    • Easy Decal/ED Standard (Metallic, Vertex Alpha)
    • Easy Decal/ED Standard (Specular, Vertex Alpha)

    Please let us know when the problem persists and/or you need further assistance.
     
  45. angeliapayne

    angeliapayne

    Joined:
    Jul 13, 2012
    Posts:
    30
    That did the trick! Thank you! To optimize draw calls, you recommend combining textures into a few atlases and also baking. Do you mean lightbaking or "Bake Geometry?" What does Bake Geometry achieve?

    Thanks again for the quick turnaround.
     
  46. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Glad to read! :)

    For dynamic decals (e.g. runtime instances etc) the "Bake Geometry" option should be enabled. When instantiating using the API, you don't have to worry about this. The API will automatically take care about the (soft) baking.

    The "Bake Geometry" option performs a so called "soft bake". This means that no further geometry updates are performed, which saves a lot of CPU time. But the decal can be easily unbaked to let the system update the decal's geometry again.

    The other option is to combine decals that share the same atlas. This is useful for static and environment decals placed at design time in the editor. All combined decals will share the same draw call at runtime. This is called "hard bake" and the result is a standard Unity mesh object with no additional logic overhead. The combining gets done using the decal manager window (Window/Easy Decal Manager).

    The combining workflow is non-destructive, so combined decals can be unbaked and edited at every stage.

    You are very welcome!
     
  47. angeliapayne

    angeliapayne

    Joined:
    Jul 13, 2012
    Posts:
    30
    Great information, thanks again!
     
  48. angeliapayne

    angeliapayne

    Joined:
    Jul 13, 2012
    Posts:
    30
    I've created an atlas of different white smudge transparent textures however when I try to Combine the atlas groups - it appears to change either my material or my base image texture. I am using the ED Standard Metallic Vertex Alpha for the Materials. Everything appears to combine under the Decal root and also grays out the original decal. Let me know if you need more info.
     
  49. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    @angeliapayne
    Do you use baked lights? To me it looks like an indirect color change caused by light bounces. The combined decals get set to static by default.

    How does your lighting setup look? Do you have realtime, baked or mixed light sources?
     
  50. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Version 1.6.2 available for download.

    Changelog

    Features

    • Shaders: Added two new decal shaders.
    • Inspector: Added material editor for current atlas/material.
    • Baking: Added auto UV2 generation when combining the decals using the Easy Decal Manager.

    Fixes
    • Atlas: Fixed that an changed atlas in editor doesn't get reflected until entering play mode.
    • Multi-editing: Fixed multi-editing issue with the selected atlas region.
    • Multi-editing: Fixed that the 'Select Random' action only was applied to the last selected decal.
    • Multi-editing: Fixed that the selected atlas index was sometimes not serialized.