Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[RELEASED] Dynamic Decals

Discussion in 'Assets and Asset Store' started by Llockham-Industries, Jan 12, 2017.

  1. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    377
    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:
    63
    @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:
    101
    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:
    63
    @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:
    101
    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:
    101
    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:
    101
    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:
    101
    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:
    377
    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:
    101
    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:
    377
  14. Cobo3

    Cobo3

    Joined:
    Jun 16, 2013
    Posts:
    63
    Subliminum, trojanfoe123 and Flurgle like this.
  15. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,280
    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:
    370
    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,280
    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:
    101
    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:
    42
    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:
    352
    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:
    42
    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:
    101
    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:
    352
    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:
    42
    thanks man that one helped :)
     
    Last edited: Jul 22, 2019
  25. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    154
    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:
    352
    Good to know it’s being used in production
     
  27. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    352
    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:
    101
    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.'