Search Unity

Easy Decal - Decals everywhere

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

  1. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Patch 1 is downloadable from our website. The tangent calculation is now available again. Please let us know if this solved the issue on the terrain.
     
  2. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Thank's - it's not my day today but it looks like your website is broken too!

    Can't remember my password to login, tried to reset it and the site's saying:

    Notice
    SMTP Error! Could not authenticate.

    ×
    Error
    Failed sending email.
     
  3. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    There was an SMTP connection problem. Please try again. :)
     
  4. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Thanks. I'm logged in now, but must be going blind because I can't see where to download any patches?

    [edit] Oh, refreshed the page and an account tab appeared. Tried putting my unity invoice number in but it looks like that doesn't work either - nothing happens when I click "add".
     
    Last edited: Aug 8, 2019
  5. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Just send me your invoice number and I'll drop you a voucher code to add it to your account.
     
  6. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Thx - just sent you a message.
     
  7. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Patch 1 looks to have fixed the problem with black decals on terrains. Thanks!
     
  8. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,445
    I'll request the source when I get back to solid internet, kinda traveling at the moment. But would like to hear what new mechanism the "new patch" uses.
     
  9. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Think I've found a new problem in the latest version released today - I know SSDs are still beta but nothing at all renders using either the Multiply SSD or Deferred SSD shaders, on any geometry.

    Untitled.png

    Note under the Easy Decal/Stats section for this decal it says:

    Visible by Camera: No (?! - the game camera is looking right at it)
    Vertices: 286 (?! - the bit of terrain it's on is completely flat)
    Faces: 308 (see above)

    The project/camera is set to deferred rendering.

    I'm just playing around with Easy Decal today and my current project doesn't use SSDs so no big deal, personally. Might affect others though?

    [Unity 2019.2.0]

    [edit] Reported this (and something else) on issue tracker.
     
    Last edited: Aug 9, 2019
  10. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Thanks for the reports. Does the SSD show up in play mode?
     
  11. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Sorry for the delay. No, nothing in scene view, game view, or anywhere, in either play or edit mode - just what you see in the screenshot.
     
  12. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    This couldn't be reproduced on our side yet. We are on it. If you have further information just let us know. Thanks!
     
  13. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Been having a dig around with this, and there's good news and bad news. Good news is, I've got it to render something. The bad news.... well, I don't know where to begin so I just took a video of it. Default camera with project settings set to deferred render, simple plane and cube primitive.

    This starts out as a box decal, everything working normally. Then I switch it to SSD and... well... have a look.
    (might be best to go fullscreen so you can see what I'm doing).

    Notice how when I move the scene view towards the end, what there is of the decal seems to stay in the same screen space.

    PC spec is well above what you'd need for this to work, I assume.
    Windows 10 Home, Intel i9-9900k CPU, GeForce RTX2070 8GB GPU, 32GB RAM.
     
  14. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Thanks for the video. One thing I can immediately see, is that the camera should not be orthographic, because Unity will then fallback to forward rendering. The other thing has maybe to do with the new static optimization the can (currently) not be disabled with the SDD technique, only with the deferred one. I'll keep you posted.
     
  15. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Yeah, good point! Changed the scene view back to perspective, but it hasn't made any difference.

    However, if I close Unity, then reopen it (therefore, with the decal already set to SSD), it works perfectly. Seems to be something happening when changing from Plane/Box projection to SSD as the same thing happens.

    I don't know the ins and outs of this stuff, but it looks to me like it's trying to project the geometry of (what was) the Box Projection, rather than a flat image.

    Untitled.png
     
  16. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Was a regression of the optimized deferred projector. Reproduced and fixed. Thanks for reporting!
     
    GfK likes this.
  17. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    .....No idea what you're talking about, but glad it helped. :D
     
  18. Aergo

    Aergo

    Joined:
    Jun 27, 2016
    Posts:
    4
    Unity 2019.1 has problems
     

    Attached Files:

  19. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Thanks for reporting. However, we were not able to reproduce this in Unity 2049.1.14f1.
    Can please provide more information on this issue? What workflow do you use (LWRP, HDRP, default)? On what platform are you? When did this issue occur (after instantiating a decal, after..)? Does it happen in a fresh project?
     
  20. Aergo

    Aergo

    Joined:
    Jun 27, 2016
    Posts:
    4
    Use LWRP, Windows 10 x64. This happens when work with easy decal objects in hierarchy move, enable/disable object or interact with easy decal ui.
     
  21. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Is it working in a completely fresh project with only Easy Decal imported? We can still not reproduce it on our side (see video). If you experience z-fighting in LWRP, you can download the Lit Decal shader from our website or the one attached below.

     

    Attached Files:

    JBR-games likes this.
  22. Aergo

    Aergo

    Joined:
    Jun 27, 2016
    Posts:
    4
    Thank you!. I will try Unity version 2019.1.14f1 or greater version. Hope this help.
     
  23. Aergo

    Aergo

    Joined:
    Jun 27, 2016
    Posts:
    4
    New Project with easy decal for 2019.1 version. LWRP. Just walking in hierarchy 10-15 times selected any gameobject with easy decal script
    [Update] Different PC Unity 2019.2 raw and new project. In easy decal demo scene walking in hierarchy selected gameobjects with scrip, same problem after 10-15 selection.
     

    Attached Files:

    Last edited: Aug 21, 2019
  24. Evgenius

    Evgenius

    Joined:
    Sep 4, 2013
    Posts:
    21
    @Aergo @Sycoforge I confirm that this bug exist on Unity 2019.1 and above.
     
  25. AMAT_Sooraj

    AMAT_Sooraj

    Joined:
    Sep 20, 2018
    Posts:
    6
    I want to use Easy Decals to create a dotted/dashed highlight box on a 2D plane for which I can set the dimensions. I got this to work, except that the dashed box image now stretches to fit the required dimensions. Is there a way to tile it without using new materials?
     
  26. AMAT_Sooraj

    AMAT_Sooraj

    Joined:
    Sep 20, 2018
    Posts:
    6
    Anyone has any idea about this? @Sycoforge ?
     
  27. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    I would do this with a shader rendering a solid color a grid mask with world space UVs.
     
  28. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Successfully reproduced. For some reason, Unity fails to recreate the default material editor. We are on it. Thanks for reporting!
     
  29. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Seems to be a Unity bug. We have reported this issue to Unity.
     
  30. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Aergo likes this.
  31. DWO_

    DWO_

    Joined:
    Feb 19, 2014
    Posts:
    26
    Hey, so I have a problem with the decal animation component. I'm trying to create a decal animation where blood slowly drips down a wall. I set everything up with the decal animation component by following the guide in the documentation. It all worked fine until I tried to recycle the decals using an external pool manager. From the testing I've done, if the decal moves at all at runtime, it turns into this:

    Screenshot_8.png

    The long streaks of blood on the wall is what the decal is supposed looks like at the end of the animation. But, when the decals get reused it turns into what you can see as the entire sprite sheet on the wall for some reason. On the right is the settings for the decal prefab. I've looked through the documentation for the DecalAnimation class and could not find anything. It looks like it doesn't matter if a decal is at the start/middle/end of its animation when it gets recycled it always ends up like this. I don't know what the problem is here. Along with that, if I select or move the decal in the editor it again turns into the entire sprite sheet.
     
  32. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Have you tried to reset the decal once it got recycled? You can find a simple example online. Also, don't forget to call Reset() on the animation component. Please let us know if this solved your issue! :)
     
  33. DWO_

    DWO_

    Joined:
    Feb 19, 2014
    Posts:
    26
    Hey, sorry for the late reply, I've already implemented the PoolInstantiation code like was shown in the example you linked:
    Code (CSharp):
    1. private static EasyDecal PoolInstantiation(GameObject decalPrefab, GameObject parent, Vector3 position, Quaternion rotation)
    2.     {
    3.         string PoolName = decalPrefab.name;
    4.         EasyDecal clone = EZ_Pooling.EZ_PoolManager.GetPool(PoolName).Spawn(decalPrefab.transform, position, rotation).GetComponent<EasyDecal>();
    5.         clone.Reset(true);
    6.  
    7.         return clone;
    8.     }
    Along with that, when the decal is spawned I call decalAnim.Reset() in the OnSpawned method to reset the animation component like below:
    Code (CSharp):
    1. void OnSpawned()
    2.     {
    3.         originalPosition = transform.position;
    4.         decalAnim.Reset();
    5.     }
    Unfortunately, I still get the same outcome.

    Edit: Just a side note, I forgot to mention that this problem happens no matter the type of the animation: One Time, One Time Reverse, Loop, Loop Reverse. My use case for this would be One Time though.
     
    Last edited: Sep 10, 2019
  34. DWO_

    DWO_

    Joined:
    Feb 19, 2014
    Posts:
    26
    Here is a video of the problem so you can get a better idea:
     
  35. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Does the EZ_PoolManager call the Start() method when respawning an object? If not, try to call Start() (on the animation object) manually in the OnSpawned() method after you have rest it.
     
  36. DWO_

    DWO_

    Joined:
    Feb 19, 2014
    Posts:
    26
    That has seemed to have worked. The animation no longer breaks whenever it is recycled. However, now when the animation ends the decal just goes blank. The GameObject itself doesn't disappear, it's still there, but instead of the animation ending and then staying on the last frame it goes blank. I checked my sprite sheet to make sure there wasn't any empty blank space that it could have been using and there wasn't.
     
  37. BitAssembler

    BitAssembler

    Joined:
    Jul 13, 2017
    Posts:
    90
    Have you checked the columns and rows settings, do they match? Does this only occur after recycling the decal or also the first time it got spawned? Is the TweenType set to "OneTime"?
     
    Last edited: Sep 11, 2019
  38. DWO_

    DWO_

    Joined:
    Feb 19, 2014
    Posts:
    26
    Okay so I've done some testing and the problem only happens the first time that decal game object is spawned from the pool and when the decal is recycled mid animation.

    When I put in a simple boolean to make sure that .Reset() and .Start() don't execute when it's the first time that decal has been spawned in this game instance it seems to work perfectly:
    Code (CSharp):
    1. bool firstTime = true;
    2.  
    3. void OnSpawned()
    4.     {
    5.         originalPosition = transform.position;
    6.         if (!firstTime)
    7.         {
    8.             decalAnim.Reset();
    9.             decalAnim.Start();
    10.         }
    11.         firstTime = false;
    12.     }
    This fixed the issue when the decal was first spawned. However, the problem still happens when the decal gets recycled mid animation. When that does occur the animation seems to run at almost double the speed and then goes blank at the end like explained before. Would there be a way to check if the animation has finished before running the .Reset() and .Start() commands?
     
    Last edited: Sep 11, 2019
  39. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    You could use the IsFinished() method on the animation class.
     
  40. DWO_

    DWO_

    Joined:
    Feb 19, 2014
    Posts:
    26
    That worked! Everything works perfectly now. Thank you so much for your help! I'll definitetly be supporting you in your future projects!
     
    Sycoforge likes this.
  41. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Glad to read! We'll add an OnFinished event in a future release for convenient recycling when the animation finished. Keep us updated with your great-looking shooter! :)
     
  42. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Just playing around with the latest version and everything seems to be working fine, but I've had a couple of issues that slowed me down a bit today when trying to fade decals.

    First, I couldn't get fading to work at all because it doesn't seem to support Unity 2018's Standard shader. I had to switch to one of the EasyDecal shaders. No massive deal I guess, but shouldn't it work with the Standard shader?

    Second, the term "FadeOutTime is confusing", since it also dictates the duration of easyDecal.StartFade(FadingMode.In)! It'd make more sense if it were just called FadeTime, OR if we could have separate fade times/curves for fading in/out. I know you can change it in script as you want it, but it'd be nice if you could just set it all up in the editor and forget about it as you don't always want things fading in/out at the same speed.
     
  43. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Thanks for connecting! The fading is done using the vertex color alpha. Unfortunately, the Standard shader does not read/process this. The FadeOutTime is indeed somehow confusing. It's a legacy from a time where only the fade-out functionality was present. A separate fade-in time has been put to our to-do list as a separate feature and to keep integrity and consistency.
     
  44. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    Unfortunately, Unity decided to not fix the bug in the near future with its editor drawing class.

     
  45. akareactor

    akareactor

    Joined:
    Apr 6, 2015
    Posts:
    108
    What if my PoolManager has a fixed size pool? In this case, my custom instantiation method returns null and I got exception. EasyDecal.Instantiation must not return null?
     
  46. BitAssembler

    BitAssembler

    Joined:
    Jul 13, 2017
    Posts:
    90
    When a decal gets recycled, you have to call Reset() and Start() on the decal object when respawning. When do you receive a null pointer exception, can you further explain please?
     
  47. akareactor

    akareactor

    Joined:
    Apr 6, 2015
    Posts:
    108
    This is a case with a limited number of bullet decals. Here a snippet:

    Code (CSharp):
    1. public void Awake() {
    2.        EasyDecal.Instantiation = PoolInstantiation;
    3. }
    4.      
    5. private static EasyDecal PoolInstantiation (GameObject decalPrefab, GameObject parent, Vector3 position, Quaternion rotation) {
    6.        EasyDecal ret = null;
    7.        GameObject pooled = instance.GetObjectFromPool(decalPrefab.name, position, rotation);
    8.        if (pooled) {
    9.               ret = pooled.GetComponent<EasyDecal>();
    10.               ret.Reset(true);
    11.        }
    12. return ret;
    13. }
    My pool has a fixed size. When exceeding the limit, PoolInstantiation returns null and rises exception. Can you help me to figure out a way, please?
     
    Last edited: Sep 19, 2019
  48. Sycoforge

    Sycoforge

    Joined:
    Oct 6, 2013
    Posts:
    751
    I would recommend using a large enough pool size and ring buffer data structure (modulo n, where n := size) that returns the oldest decal for recycling.
     
  49. akareactor

    akareactor

    Joined:
    Apr 6, 2015
    Posts:
    108
    Already done.

    Alas I cannot make a good prediction how much decals will be on the scene. I'd like to reserve use-case with limited number of decals. It's a practical and convenient optimization way. Concept is very easy: stuffed pool = lack of recycled items = no extra decals in scene. Simple and safe.

    But an EasyDecal.Instantiation (via injected custom instantiating method) enforcing me to provide a live decal instance, unfailingly and ever. Of course, there is always some bypass with handy control of free pool items, - however making an injection delegate useless.
     
  50. BitAssembler

    BitAssembler

    Joined:
    Jul 13, 2017
    Posts:
    90
    If I understood your use case right, you should probably rethink your spawning strategy. In the most cases the most recent decal is the also the most important one (e.g., a bullet hole just created by the player) and the older a decal gets, the less important it gets for the player. So, not spawning a new decal in the world because the pool is empty makes the player feel like a bug while respawning/recycle the oldest one seems legit. The consequence of this is that the pool should always return an object/decal, and never null. For example, you could create a routine that dynamically begins to fade out and recycle decals once a certain threshold (fill level) got reached. A ring buffer pool seems right here.
     
    akareactor likes this.