Search Unity

[RELEASED] Dynamic Decals

Discussion in 'Assets and Asset Store' started by DanielDickinson, Jan 12, 2017.

  1. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    Works for me in the editor on 2018.3.2f1:


    and in a Desktop build:


    (as always, works with Standard pipeline only)
     
  2. Rallix

    Rallix

    Joined:
    Mar 17, 2016
    Posts:
    139
    @BurningToad Sure. I just made a simple scene with a cube and a ProjectionRenderer and it worked except for WebGL (as mentioned in the other thread).
    To me, standalone PC build works just fine. Perhaps check your Quality/Graphics settings? I'm not sure.
     

    Attached Files:

  3. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Works for me in 2018.3, however, the "priority" setting for decals seems to have no effect. I don't know that it ever did, but it definitely isn't working for me in 2018.3.5f1.

    Also, I'm constantly getting an error warning; "Assets\Dynamic Decals\Scripts\Editor\DecalSettings.cs(388,32): warning CS0649: Field 'DecalSettings.draggedMaterials' is never assigned to, and will always have its default value null". No massive deal, but annoying.

    I'm looking for alternatives to Dynamic Decals and would recommend that you do the same. Stuff isn't going to get fixed and the situation will only get worse.
     
  4. Rallix

    Rallix

    Joined:
    Mar 17, 2016
    Posts:
    139
    @GfK You can put:
    #pragma warning disable 0649
    at the top of the file to make the warning go away.
    Or create a csc.rsp file in the root of the Assets folder containing
    -nowarn:0649
    to disable the warning globally, because many assets started doing this in the new Unity version.
    The new compiler in 2018.3 reports some false positives (like everything with the [SerializeField] attribute, which can also be fixed by assigning
    null
    or
    default
    to it).

    Personally, I'm going to stick with this asset as long as it lasts. With some help, I got it working in WebGL again and so far I didn't notice any other issues. There are apparently decals in HDRP, but that's a project-wide decision which will lock you out of most platforms apart from PCs and newest consoles.
     
    ceebeee likes this.
  5. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Hm, thanks. I'll give that a go.

    Another problem in Unity 2018.3.5 - has anybody else noticed that decals will suddenly stop being drawn in the Scene view?

    They draw fine in scene view IF the game is running, but when it's not, they're all invisible which makes placement practically impossible. I didn't even change anything - just played my game, then stopped it, BOSH - everything invisible.

    [edit] Oh, it transpires that the priority parameter doesn't work in deferred rendering mode. Didn't spot that in the docs, just trial/error.
     
  6. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Allrighty... I've reverted back to the original code for the latest version of Dynamic Decals and I don't *seem* to be having trouble with decals not drawing (your fix for the 0649 warning worked - thanks).

    So at the moment it's looking like the problem might have been my previous fixes for the glut of warnings that appeared in 2018.3.3 with PrefabType and GetPrefabType becoming deprecated in Unity.

    I have eight such warnings and if anybody can advise what I need to do in order to futureproof here, it'd be massively appreciated since it would appear I may have gotten something wrong before.
     
  7. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    I went ahead and made changes to the following code (ProjectionRenderer.cs, line 334 onwards):

    Code (CSharp):
    1.  
    2.         private bool Register()
    3.         {
    4.             if (this != null)
    5.             {
    6.                 #if UNITY_EDITOR
    7.                 PrefabType prefabType = PrefabUtility.GetPrefabType(gameObject);
    8.                 if (prefabType == PrefabType.ModelPrefab || prefabType == PrefabType.Prefab) return false;
    9.                 #endif
    10.  
    11.                 return DynamicDecals.System.Register(this);
    12.             }
    13.             return false;
    14.         }
    15.         private void Deregister()
    16.         {
    17.             if (this != null)
    18.             {
    19.                 #if UNITY_EDITOR
    20.                 PrefabType prefabType = PrefabUtility.GetPrefabType(gameObject);
    21.                 if (prefabType == PrefabType.ModelPrefab || prefabType == PrefabType.Prefab) return;
    22.                 #endif
    23.  
    24.                 DynamicDecals.System.Deregister(this);
    25.             }
    26.         }
    PrefabType is replaced with PrefabAssetType.
    PrefabUtility.GetPrefabType is replaced with PrefabUtility.GetPrefabAssetType.
    I've replaced PrefabType.ModelPrefab with PrefabAssetType.Model.
    I've replaced PrefabType.Prefab with PrefabType.Regular.

    These changes, while logical and correct in my mind, are causing decals contained within prefabs to NOT draw in the scene view. Which makes placing decals virtually impossible.

    This is driving me up the wall, if I'm honest...
     
  8. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    I *think* I've sussed it. For anybody else who comes across this, change the two methods above to:

    Code (CSharp):
    1.        private bool Register()
    2.         {
    3.             if (this != null)
    4.             {
    5.                 #if UNITY_EDITOR
    6.                 PrefabAssetType prefabType = PrefabUtility.GetPrefabAssetType(gameObject);
    7.                 if (prefabType == PrefabAssetType.Model) return false;
    8.                 #endif
    9.  
    10.                 return DynamicDecals.System.Register(this);
    11.             }
    12.             return false;
    13.         }
    14.         private void Deregister()
    15.         {
    16.             if (this != null)
    17.             {
    18.                 #if UNITY_EDITOR
    19.                 PrefabAssetType prefabType = PrefabUtility.GetPrefabAssetType(gameObject);
    20.                 if (prefabType == PrefabAssetType.Model) return;
    21.                 #endif
    22.  
    23.                 DynamicDecals.System.Deregister(this);
    24.             }
    25.         }
     
  9. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
    I didn't have to change anything and it worked in 2018.3 just fine. warnings are just that, warnings, I wouldn't worry about them until they become errors.
     
  10. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    True enough, but in this case I don't think it matters whether we fix it now or later - it's going to need doing.
     
  11. bulldog57rus

    bulldog57rus

    Joined:
    Nov 4, 2018
    Posts:
    2
    Man, I am very excited about native decals. But is there any way to create them for mobile, without HDRP? It is very needed for me, as Dynamic Decals has some bugs with Android 4.4.2 and 6 versions. I spent tens of hours to debug it but I am tired. Help me please((9((9
     
  12. Cosmas

    Cosmas

    Joined:
    Jan 9, 2010
    Posts:
    133
    Has anyone encountered issues mixing dynamic decals with particles?
    I'm getting this ZDraw issue whereby the decals below do not pass through particles.
    Seems to be consistent on both Deferred and Forward modes.
    Does anyone know how to get around this? It doesn't seem to be my particle systems as its consistent across all shader types.
     

    Attached Files:

    Last edited: Feb 25, 2019
  13. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    395
  14. Cobo3

    Cobo3

    Joined:
    Jun 16, 2013
    Posts:
    67
  15. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Hey guys,

    I'm having trouble getting the decals to render properly with a 3rd party terrain shader. I'm trying to display the decals directly on my terrain (i.e. the decals render on my terrain with all of it's hills and valleys etc...).

    Using the standard Unity shader it actually works fine. But when I use the CTS terrain shader it does not. I'm using 3rd party terrain shaders from the "CTS (Complete Terrain System)" asset store shaders. Any ideas?

    Also, I'm very sad to see this asset was deprecated as well. I am not going to go to the HDRP until they get actually good particle shaders going for it, and until SpeedTree can get it's trees working with it. But that could be months, if not a year away.


    I just purchased "Easy Decals" off the asset store to try to replace this asset, and the performance was TERRIBLE. This is the only decal asset that worked for my game. This puts me in a big bind. :(
     
    Last edited: Jun 2, 2019
  16. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    488
    Had the same issue some time ago, I think it was related to the CTS Cutout shader
    Basically I think you need to turn off the Cutout option on your CTS shader (bottom of the cts profile if I remember properly) and it should work on terrain
     
  17. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Thanks for the reply Necka. I looked at that option and it was already unchecked (not in use). I tested it with both the option checked and unchecked, but the decals still do not render on the terrain properly, unfortunately.

    Thank you for the suggestion though. It was worth a shot. :)
     
  18. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    I bought Easy Decal recently too. The thing you have to remember is that it's creating mesh decals on the fly, which is why it's slow - like native Decal projectors in older strains of Unity. You can make it faster by using plane instead of box projection, or you can bake decals and only update them when they move. Further, you can use screenspace decals (SSD) which are MUCH faster, like Dynamic Decals, but you do lose the ability to project decals onto specific layers. For me, all of it is a compromise and I don't know if Easy Decal is anywhere near a replacement for this. It's OK if you aren't moving a load of stuff around, but if you are - forget it. For me, the compromises I'd have to make are proving too much of an ask right now. If you could use SSDs with Unity layers in the same way as Dynamic Decals handles it, that'd be fine. It's possible, clearly, but they just haven't done it.

    I don't mind using Unity 2019 (without HDRP/LWRP, obvs) with Dynamic Decals, BUT, I've noted an issue where on the first run, the decal projection flashes white before it renders properly. If it's going to do that when a user first runs my game then it's completely unusable.

    The author really needs to pick up support again, or open-source it. There is still a huge demand for this.
     
  19. h00man

    h00man

    Joined:
    Apr 17, 2017
    Posts:
    54
    hey guys,dose any one know how to change the projection render properties through script?
    for example how do i inscres the emissive slider value in projection component
     
  20. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    Just curious, is anyone using this asset in a game that is built in Unity 2017?

    I purchased it a while back, but took it out of my game because of performance reasons (I’m making a VR game and there were issues in single pass stereo rendering.

    I originally tried it in Unity 5.6, but haven’t tried it since...
     
  21. h00man

    h00man

    Joined:
    Apr 17, 2017
    Posts:
    54
    im using it in unity 2019.1 and no problem so far(using it blood decals).
    i just do know how to change the projection render parameters through script
     
  22. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    First...
    Code (CSharp):
    1. using LlockhamIndustries.Decals;
    Next, you need a reference to the ProjectionRenderer:

    Code (CSharp):
    1. private void Awake()
    2. {
    3.     ProjectionRenderer PR = GetComponent<ProjectionRenderer>();
    4. }
    then...
    Code (CSharp):
    1. public void setDecalColor(Color newColor)
    2. {
    3.     PR.SetColor(0, newColor); //or whatever (0 is the property index for color)
    4.     PR.UpdateProperties(); //Nothing will change if you don't do this
    5. }
     
    h00man and Rallix like this.
  23. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    I’ve re-installed Dynamic Decals to give it a try again in Unity 2017.4.

    I’ve noticed that the previous “issue” (when I was using 5.6, is still there. Not sure if this is a true issue though.

    If you look at the render textures in the memory section of the Profiler...it’s over 275 GB! It also says not saved...so not sure if those are temp render reporting don’t mean anything.

    Obviously 275 GB couldn’t be saved...just wanted to make sure others were aware of this...should this be of concern?
     

    Attached Files:

    Last edited: Jul 21, 2019
  24. h00man

    h00man

    Joined:
    Apr 17, 2017
    Posts:
    54
    thanks man that one helped :)
     
    Last edited: Jul 22, 2019
  25. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    338
    Dynamic Decals is used for the blood pools in Frontline Zed

    www.frontlinezed.com using Unity 2017.4
     
  26. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    Good to know it’s being used in production
     
  27. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    I'm noticing that if I have Cast Shadows on for any particle effect in a scene when any dynamic decal is active in the same scene, it won't billboard properly.

    Just wanted to put it out there in case anyone has this issue.
     
    Rallix likes this.
  28. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Getting about half a dozen warnings with Dynamic Decals in Unity 2019.2. Anybody know how to fix this?

    • Assets\Dynamic Decals\Scripts\Core\DynamicDecals.cs(1372,98): warning CS0618: 'InputTracking.GetLocalPosition(XRNode)' is obsolete: 'This API has been marked as obsolete in code, and is no longer in use. Please use InputTracking.GetNodeStates and look for the XRNodeState with the corresponding XRNode type instead.'
     
  29. leoamaro

    leoamaro

    Joined:
    Jul 28, 2018
    Posts:
    13
    Hi:
    Great system, but I have a problem:
    It isn't working with materials in transparent rendering mode, even if the object is fully opaque, only works with opaque and cutout rendering modes, no idea why. Anyone knows anything about this?
    Thanks in advance!
     
  30. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    Being fully opaque doesn't change the fact that transparent materials are fairly different and incompatible with many effects because of their sorting order, inability to affect depth etc. I'd recommend changing the material or material mode to cutout in cases where this has no visual effect.
     
  31. leoamaro

    leoamaro

    Joined:
    Jul 28, 2018
    Posts:
    13
    Not quite a solution but thanks anyway, I'll just have to make the same system they made for rainbow six siege, which is REALLY cool, you should look it up by the way, it is somewhat inspiring
     
  32. akareactor

    akareactor

    Joined:
    Apr 6, 2015
    Posts:
    108
    Have you any lags while instantiating ProjectionRenderer?
     
  33. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    338
    The game is out on the 26th of September, so wishlist, buy it, and see for yourself how it functions :)

    No lags, no, the whole thing has been pretty performant.
     
    Last edited: Sep 19, 2019
  34. mons00n

    mons00n

    Joined:
    Sep 18, 2013
    Posts:
    304
    Anyone know how to get this working on instanced terrain in 2018.3+ (or where to learn about how to modify the shaders)?
     
  35. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    Does anyone know how to get the projections to work with baked lighting? I'm trying to use them for blood in my scenes and they only show red if there is a realtime or mixed light on them....otherwise they show black.

    Any help would be appreciated.
     
    Rich_A likes this.
  36. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    151
    Did you figure this out?
     
  37. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    I had to move on to other things, so I did not figure it out yet
     
  38. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    151
    So I think I figured it out. The default shader is set to metallic so you need to set it to an unlit shader. It might also work by turning down mettalic to 0.
     
    Rallix and FiveFingerStudios like this.
  39. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    Ahh...I’ll go ahead and try and t out tomorrow...thanks!
     
  40. Roritamashi

    Roritamashi

    Joined:
    Jan 27, 2018
    Posts:
    8
    Hello, there is a ways to fix the shader for 2019.3, some proyections work like the unlit but the metalic and additive dont work
     

    Attached Files:

  41. BloodLetter

    BloodLetter

    Joined:
    Aug 30, 2020
    Posts:
    3
    Hello, I had Dynamic Decals and after a long time I started using it. It works well in 2019.3.3f, but I can't figure out how to use the masking layers. Can someone help me out here?

    Edit: I got it to work, just go to Windows->Decals->Setting and specify the layers.
     
    Last edited: Aug 30, 2020
  42. gonzalitosk8

    gonzalitosk8

    Joined:
    Jun 30, 2013
    Posts:
    31
    I leave this valuable information for whoever needs it:

    change texture:
    object.GetComponent<ProjectionRenderer>().Renderer.sharedMaterial.maintexture = yourTexture;
    change main color:
    object.GetComponent<ProjectionRenderer>().Renderer.material.color = yourColor;
    change color instantiated:
    object.GetComponent<ProjectionRenderer>().SetColor(0, yourColor);
    get instantiated color:
    yourColor = object.GetComponent<ProjectionRenderer>().Properties[0].color
     
  43. DanielDickinson

    DanielDickinson

    Joined:
    Aug 4, 2013
    Posts:
    278
    Hey guys, author here.

    I've just stumbled back onto this thread for the first time in awhile. I see a lot of calls for this asset to be made open source.

    It seems to be holding up somewhat better than anticipated & more people are sticking to the original pipeline than I expected. I don't have the time to maintain the package & definitely have no intentions of ever monetizing it again.

    If anyone's happy to host, manage & maintain a GitHub repo I give complete permission for the asset to be made open source & shared freely.
     
    Whatever560, Recon03, Griffo and 12 others like this.
  44. gonzalitosk8

    gonzalitosk8

    Joined:
    Jun 30, 2013
    Posts:
    31
    It was the only asset that could meet what I needed!
    the other assets could not do what they wanted to do ...
    incredibly I have to thank you.
    It is very easy to understand, and very friendly if you do not have knowledge.
    I share what I was able to achieve!
    it's all i needed.



    If I can help you with anything, count on me!
     
    Griffo and DanielDickinson like this.
  45. PixelLifetime

    PixelLifetime

    Joined:
    Mar 30, 2017
    Posts:
    90
    I haven't used the asset in a while, so I don't remember it - is source code available in it? If not, could you please release it under open source license on github, so we would be able to fork it? Thank you in advance!
     
  46. clownhunter

    clownhunter

    Joined:
    May 26, 2013
    Posts:
    61
    Thank you so much! I've used this asset for years and it's been great. I really appreciate you making it open source. I'll host it on my GitHub but happy to add anyone as project maintainer.

    https://github.com/EricFreeman/DynamicDecals
     
    Recon03, PixelLifetime, zyzyx and 3 others like this.
  47. rasmusreplay

    rasmusreplay

    Joined:
    Apr 8, 2021
    Posts:
    3
    Anyone know, if this can be used to project dynamic text (text mesh pro if possible) onto the mesh of 3D models? The specific use case is to project the names and numbers onto the back of football players in a football simulation software made in Unity.
     
  48. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    263
    No it wouldn't be appropriate for that. Consider rendering the text onto the uniform in an offscreen render texture + shader that composits?
     
    rasmusreplay likes this.
  49. rasmusreplay

    rasmusreplay

    Joined:
    Apr 8, 2021
    Posts:
    3
    Hi @benthroop, thx for the fast answer... Yeah the render texture with dedicated camera is the other solution we are considering. But the flexibility of the decal seemed delicious
     
  50. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    263
    I don't see any advantage to runtime deferred decals for player numbers. Plus trying to make TMP work with this would not be simple. You'd end up rendering the TMP to a texture anyway, and then paying the cost of compositing them each frame, possibly losing coherence at odd angles. Go with the RT method and cache the result. Practically free.
     
    rasmusreplay likes this.