Search Unity

[RELEASED] Dynamic Decals

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

  1. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,303
    @Llockham-Industries Just wanted to let you know I purchased your system in order to place RTS unit selection decals underneath my RTS units in my game. I was having trouble with framerate lag using normal Unity projectors. After implementing your system, the selection/highlighting effect works great, and I have very little noticeable framerate drops! Even when selecting a lot of units at once.

    In other words, it works exactly as I was hoping -- with great performance. I'm glad I purchased this asset :) Thank you!
     
    Llockham-Industries and blitzvb like this.
  2. PixelMind

    PixelMind

    Joined:
    Aug 16, 2013
    Posts:
    100
    Alright, that seems fair. Thanks for fast reply. I sent you an e-mail.
     
    Llockham-Industries likes this.
  3. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Having problems upgrading to 2.0.5.

    "Assets/Dynamic Decals/Scripts/Core/DynamicDecals.cs(1159,38): error CS0103: The name `Misc' does not exist in the current context"

    Where is "Misc" meant to be defined?

    [edit] I removed the Dynamic Decals folder completely and reimported everything - it worked.

    Deleted the "Demos" folder from my project as I don't need it - then the above error comes back? Dunno what's going on but looks like the core of the Dynamic Decals system has become somehow dependent on the existence of something in the Demos folder??
     
    Last edited: Jan 27, 2018
    hippocoder likes this.
  4. Llockham-Industries

    Llockham-Industries

    Joined:
    Aug 4, 2013
    Posts:
    262
    @GfK - Apologies. The misc namespace is what I use for debugging, the showcase scene now has a debug UI to help me easily debug issues with customers. I'll remove this dependency in the next build. For now, just comment out the lines causing the error; they're not essential.
     
    GfK likes this.
  5. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    Ah, right. Thx!
     
  6. Ceyl

    Ceyl

    Joined:
    Sep 9, 2015
    Posts:
    9
    Hi there,

    Just want to warn that since the friday 26th update performances are worst in VR. And I lose like 40 fps with the shader replacement (it was already bad in VR but now I lose more fps). Settings are set to VR.

    Cheers,
     
  7. Ceyl

    Ceyl

    Joined:
    Sep 9, 2015
    Posts:
    9
    If needed:

    Debug Information (Copy and Paste)

    General
    OS : Windows 10 (10.0.0) 64bit
    Graphics device : NVIDIA GeForce GTX 970
    Graphics API : Direct3D11

    Camera
    Rendering path : Forward
    Is orthographic : False

    Shader Replacement
    Method : SingleTarget

    VirtualReality : True
    VR API : OpenVR
    VR device : Vive MV
    Stereo rendering path : SinglePass
     
  8. GfK

    GfK

    Joined:
    Aug 15, 2014
    Posts:
    107
    The "Misc" bug is sorted via commenting out the five occurences of it, but now there's a new error in the metallic shader - I have virtually zero experience of shader programming so no idea what's wrong here:

    Shader error in 'Projection/Decal/Standard/Metallic/Forward': failed to open source file: '../../../Cginc/ForwardProjections.cginc' at line 52 (on d3d11)

    Compiling Vertex program with DIRECTIONAL SHADOWS_SCREEN _CustomDepthNormals _AlphaTest
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME
     
    mrBeam likes this.
  9. Ceyl

    Ceyl

    Joined:
    Sep 9, 2015
    Posts:
    9
    @GfK You should close unity to prevent reimport from .meta files, delete Dynamics Decals folder and reimport it. It worked for me.
     
    mrBeam and Llockham-Industries like this.
  10. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    359
    Bummer to see that VR single pass is still not performing well.

    I had to remove it from my project because the performance was way too bad in my game.
     
    Fletcher-Studios likes this.
  11. cadpeople

    cadpeople

    Joined:
    Nov 6, 2014
    Posts:
    20
    Hey I'm using Dynamic Decals to display a sort of "outline" around objects in an RTS like project, but I'm having trouble with performance. Are you disabling culling on hte decal layers? I'm getting weird numbers just rendering 10 projectors. Obviously the performance decrease is much more noticable on less powerful computers.

    https://imgur.com/a/0XrBI

    It seems like it's rendering the rest of the scene, even though it should be outside of the cameras render area. (Note the 100k extra tris when Dynamic Decals is turned on.) Thoughts?

    Edit: Camera.FireOnPreCull on the bottom left was supposed to say 8.7% Must have deleted it by accident.
     
    Last edited: Feb 2, 2018
  12. MylesLambert

    MylesLambert

    Joined:
    Dec 31, 2012
    Posts:
    33
    Apologies if this has already been asked,
    How much control do you have per decal instance? I can see albedo and emissive colours but can you tint anything else?
    Also is there any control over how the normal map is combined with underlying geometry? For example if I want it to override the existing normals or be additive?
     
    ledbetterman likes this.
  13. kk99

    kk99

    Joined:
    Nov 5, 2013
    Posts:
    77
    I just purchased this and I have trouble to get it work on TERRAINS.

    Do I miss something? uhmmm
     
  14. kk99

    kk99

    Joined:
    Nov 5, 2013
    Posts:
    77
    ok never mind.

    its working now
     
    Nateply and Llockham-Industries like this.
  15. Llockham-Industries

    Llockham-Industries

    Joined:
    Aug 4, 2013
    Posts:
    262
    @MylesLambert - You can also control masking, tiling and offset values. What else would you like to see?
    Currently, normals override underlying normals.

    @Ceyl - There is a VR or Packed shader method in the options menu. It's still experimental, and won't work in all situations, but should operate significantly faster. I'm not convinced this is the correct way to approach optimizing screen-space decals for VR, but I would recommend trying it.
     
  16. MylesLambert

    MylesLambert

    Joined:
    Dec 31, 2012
    Posts:
    33
    Specular & Smoothness tinting would be useful.
    It would be very nice to have an overlay/ additive normal mode :)
     
    Last edited: Feb 17, 2018
  17. sgtkoolaid

    sgtkoolaid

    Joined:
    May 11, 2010
    Posts:
    847
    I get 3 separate errors with the latest unity 2017.3.1f1

    Assets/Dynamic Decals/Scripts/Core/DynamicDecals.cs(702,74): error CS0117: `CameraType' does not contain a definition for `SceneView'

    Assets/Dynamic Decals/Scripts/Core/DynamicDecals.cs(715,70): error CS0117: `CameraType' does not contain a definition for `SceneView'

    Assets/Dynamic Decals/Scripts/Core/DynamicDecals.cs(1139,49): error CS0117: `CameraType' does not contain a definition for `SceneView'

    i take it this requires a hot fix?
     
  18. Ranter1337

    Ranter1337

    Joined:
    Nov 4, 2015
    Posts:
    15
    Getting an error on Unity 2017.2.0p2, Just bought and imported in, when trying to create a new decal i get the error:
    ArgumentOutOfRangeException: StartIndex must be less than the length of the string
    this seems to be caused by putting the system into a subfolder, so relative pathing is not being used

    Also a lot of different GUI errors caused from just about anything that you click on in the instanced editor: GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced) happened 26 times from 1 Button press, the current version of the asset is extremely bugged
     
    Last edited: Feb 20, 2018
  19. SlicedCube-Games

    SlicedCube-Games

    Joined:
    Nov 11, 2014
    Posts:
    6
    I found some interestin error. If u use metallic decal, with all maps, and look to the glossines when blend mode enabled, it will work only at 100% opaque pixels of decal. All other is using underlying glossiness, so decal looks bad. Need fix )
     
  20. Llockham-Industries

    Llockham-Industries

    Joined:
    Aug 4, 2013
    Posts:
    262
    @sgtkoolaid - Sent you an email :).

    @Ranter1337 - You can move the system where ever you wish, just be sure not to have it operating in the active scene while you do so. I'd recommend creating an empty scene, moving the system where you wish it, then opening your old scene again. If you get any cginc. could not be found errors reimport the Shaders folder (Inside DyanmicDecals > Resources) until Unity decides it's imported everything in the correct order.

    I'm also unable to recreate any GUI bugs, this may again, be the result of moving the system while it is active, try re-importing it (while you have an empty scene open). Cheers :).

    @SlicedCube-Games - Got a fix for this in the next build, nice find!
     
  21. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    368
    Last edited: Feb 26, 2018
  22. AbhimanyuAryan

    AbhimanyuAryan

    Joined:
    Apr 22, 2015
    Posts:
    21
    Does this package contain entire source code? How this has been written?
     
  23. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    384
    It has full source code, it's in C#, and of course HLSL shader language.
     
    Llockham-Industries likes this.
  24. Ramezov

    Ramezov

    Joined:
    May 2, 2017
    Posts:
    8
    Hello,
    I'm developing 2D platformer game and using Ferr2D Terrain to build its platforms, I wonder if Dynamic Decal would works for me to render decals especially on the edges of the platforms ( to show the parts of the decal that is within the platform edge and hide the ones outside the platform edge).
     
    Llockham-Industries likes this.
  25. Bulwark-Studios

    Bulwark-Studios

    Joined:
    Sep 20, 2013
    Posts:
    18
    @wadewt - The system relies on shader replacement, which has very strict standards on how shaders need to be built to work with it. a RenderType tag must be present and all the properties of the shader must use standardized names (_MainTex, _Color, _Cutoff). Send me an email (Support@LlockhamIndustries.com) with your shader attached and I'll take a look at it for you :).

    Hi!
    I have exactly the same issue here. Did you find a workaround ?

    Thanks!
     
    Last edited: Mar 2, 2018
  26. ivanbolcina

    ivanbolcina

    Joined:
    Oct 27, 2013
    Posts:
    41
    Hi.
    I am having trouble. If I have a directional light, then decals are white. If I dont have a directional light, then they are OK. Whats the matter?
     
  27. ivanbolcina

    ivanbolcina

    Joined:
    Oct 27, 2013
    Posts:
    41
    It has something to do with light in skybox and intensity multiplier....
     
  28. LunaTrap

    LunaTrap

    Joined:
    Apr 10, 2015
    Posts:
    105
    Any plans on developing a better atlas tool, having to move the texture UV coordinates is a big pain in the ass.
     
  29. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    316
    I'm heavily using Decals for a current project, however I run into visual/overlap issues with custom vertex shaders. After digging into the code, it seems Decals renders it's own depth/normals pass, instead of relying on the existing GBuffer (for deferred shading). That seems a) prohibitively expensive b) breaks all vertex shader modifications that decals should project on:
    - vertex noise
    - tesselation/displacement
    - custom stuff

    Am I missing something, should there be a way to use the existing GBuffers instead of calculating new ones?
     
  30. Llockham-Industries

    Llockham-Industries

    Joined:
    Aug 4, 2013
    Posts:
    262
    @AbhimanyuAryan - Full source code is included, pretty thoroughly commented too, also a tutorial on writing custom projections, though currently, it is not an intuitive process.

    @Bulwark-Studios - The solution I came to with him was to switch to mobile shader replacement and rely on material based masking, which he was happy with. If you're having a similar issue, make sure your shader uses the standardized names, and if you still can't see decals projecting correctly send me an email with your shader attached and I'll try to debug it for you :) (Support@LlockhamIndustries.com, also usually respond a lot faster via support email than thread).

    @Flurgle / ivanbolcina - Would rather find and solve the source of the issue than include their workaround. On it.

    @LunaTrap - I am aware of this, you're not the only person to give me this feedback, but it's currently not a priority.

    @fherbst - You aren't missing anything, currently the system doesn't support projections cast onto tesselation or vertex displaced meshes (vertex wind etc). As decals are rendered during onto the Gbuffers, we can't read from and write to them at the same time, and there are also no G-buffers in forward rendering, or for objects that are rendered via forward rendering after deferred (Which this system also needs to support). The same problems plague any post-process effect that relies on the depth-normal shader replacement built into Unity.

    Luckily in the HD pipeline (SRP) Unity have (Or will have, normals currently aren't in yet (Why screen-space reflection isn't working yet)) custom passes built into there shaders to output custom depth and normals, alongside motion vectors and other goodness. And as they are built into the shaders, they can account for tesselation and vertex manipulation (Like the current Shadow/Depth pass does now). This means we get these buffers for free, with much more performant shader replacement in the HD pipeline :).
     
  31. Llockham-Industries

    Llockham-Industries

    Joined:
    Aug 4, 2013
    Posts:
    262
    I also feel like I should disclose (not that it's a secret, and I'm basically shooting myself in the foot here) that Unity is currently implementing what I believe to be a screen-space decal system into the HD pipeline similar to this one. So if you are buying this package with the sole intent of using it in the HD pipeline, currently I still do plan to move this to support the relevant pipelines, but Unity could be providing an alternative, that may or may not be better, but will probably be free.

    Obviously, that's with the caveat that everything to do with those pipelines is experimental, (I haven't been able to get it to work yet, and don't see how it could until the normal pass is implemented) I have no control or influence whatsoever over those projects, this is just what I've gathered looking through the code and it seems ethical that I share it with you, given that I'm providing a similar service.
     
  32. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,930
    Your solution will probably be ahead of theirs for at least a while. Furthermore, I have heard - don't know if it is true - that the HD pipeline won't be ready for use for maybe a year.
     
  33. SlicedCube-Games

    SlicedCube-Games

    Joined:
    Nov 11, 2014
    Posts:
    6
    Tried to build project. DOSENS of errors, and no build finished (((

    What source does it wants? I am only deleted demos folder, that i dont need. Is there some working files? If it is true, i think you should move them to another place, from DEMO folder.

    Clip2net_180314144120.png
     
  34. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    384
    I don't know about a year. They just published their Fontainebleau demo with HD pipeline files in it:

    https://blogs.unity3d.com/2018/03/1...aking-real-world-objects-into-digital-assets/

    You can download the full project there and it has the whole HD pipeline included.
     
  35. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,930
    I was trying to quote what I remembered a Unity staff person saying about it. But - even if that's an accurate quote - the truth is that it won't be done till it's done. ;)

    I think this same Unity person also advised to think of the current edition of HD pipeline as a "toy."
     
  36. Llockham-Industries

    Llockham-Industries

    Joined:
    Aug 4, 2013
    Posts:
    262
    @SlicedCube-Games - Unity can't find the related cginc. files, you need to re-import them (right click - re-import), until it knows where to look. You may also need to restart Unity.

    @ceebeee / @hopeful- I expect they'll be showing something off at GDC in a few days, and the HDRP is eye-candy like we've never seen before, I imagine they'll want to show it off. Should hopefully have a decent idea of where they're at with it by the end of the show.
     
    hopeful likes this.
  37. Straafe

    Straafe

    Joined:
    Oct 15, 2012
    Posts:
    54
    Is there any way this tool can (or do you know of any other tool that can) project an image onto a 3D object, and then be able to save out a bitmap of the projected image applied to the UVW coordinates of the object it was projected onto?
     
  38. ceebeee

    ceebeee

    Joined:
    Mar 7, 2017
    Posts:
    384
    Substance Painter can do that.
     
    Llockham-Industries likes this.
  39. Llockham-Industries

    Llockham-Industries

    Joined:
    Aug 4, 2013
    Posts:
    262
    @Straafe - This tool cannot, it generates decals at run-time in the shader itself.
     
  40. spinaljack

    spinaljack

    Joined:
    Mar 18, 2010
    Posts:
    892
    How do I create a new decal from an image at runtime?
     
  41. Straafe

    Straafe

    Joined:
    Oct 15, 2012
    Posts:
    54
    Sorry, I guess I wasn't clear. I need a tool that can do this inside of my app, during runtime,
     
  42. morphinegames

    morphinegames

    Joined:
    Mar 13, 2015
    Posts:
    32
    Hey there! I love your product but I'm running into an issue where the decals are being drawn on top of meshes that have been drawn using DrawMeshInstanced. I made 100% sure that I am specifying a layer that is specifically excluded in the settings but it still draws on top of them. Is this a known issue and are there any workarounds?
     
  43. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    2,014
    Sorry if this has been answered (I didn't see mention of it in this thread), but is there a trick to getting decals to appear on transparent surfaces? If I try to place a decal on an object that's using the Standard Shader (transparent), I'm unable to get any decals to show up, regardless of which projection I use. Is this not supported?

    Also, is there any option I'm missing to have decals add to, but not completely override, the normal map of the surface they're being placed on? For example, if I put a "dirt" decal on some tiles, the decal's normal map completely overrides the normal map of the tiles. Ideally the decal would blend its normal with the surface its covering. I'm not sure if that's possible.

    Thanks,

    -Dan
     
    Last edited: Apr 4, 2018
  44. tspk91

    tspk91

    Joined:
    Nov 19, 2014
    Posts:
    89
    Hello, when placing Dynamic Decals inside the Assets/Plugins folder it causes shader compilation errors. This is because of the #includes of cginc archives using relative paths, which expect to be three folders below Assets, but inside Assets/Plugins it is actually under four.

    I have to move the shaders folder one level up so I can maintain the scripts in the Plugins folder for the sweet compilation time speedup. It would be great if it was under Plugins by default or another format for relative path was found that didnt require the number of folder levels to be exactly the same.
     
  45. glitchers

    glitchers

    Joined:
    Apr 29, 2014
    Posts:
    52
    Hello,

    I think this is a great plugin, very well structured. I've added a few new projection types without much hassle.

    @Llockham-Industries
    One issue I am having is with Ambient Light not being applied to decals. I am using them in deferred mode and they are very dark. I have no baked lighting currently. What can I do about this? I've tested with the supplied decal shaders and my own but the problem is on both.
     
  46. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    414
    Hi, I'm trying to use Dynamic Decals to do shadows on my mobile AR project which has a transparent plane as the floor so as to be able to show the real world behind it. Is there a way to project the decals on a transparent surface and have them show up? Thx!
    @Llockham-Industries
     
    Last edited: Apr 11, 2018
  47. tagoth

    tagoth

    Joined:
    Jan 21, 2017
    Posts:
    2
    I'm trying to avoid this

    Any chance to blend normals? I took a quick look and found where you calculate the decal normals but I'm not familiar with how to get the underlying normals.

    What I'd like to have is a common pool of blood, not have newer stains draw on top of each other. Maybe it's possible with the masking options? But I can't get them to work. It either draws on everything or on nothing regardless of what layers and layermasks are selected in the settings and the decal instance.
     

    Attached Files:

    Last edited: Apr 12, 2018
  48. morphinegames

    morphinegames

    Joined:
    Mar 13, 2015
    Posts:
    32
    I wanted to follow up on this for anyone that runs into this issue. To recap - the issue is that DrawMeshInstanced (even when using the correct layer settings with your decals) will be drawn on top of by the decals so you'll have all these decals drawn over things you don't want. The solution was to use the Materials masking mode (Window > Decals > Setting > Masking drop down). You can use either Material or Both and then drag all the materials that need to be excluded from the decals onto the area)

    Please also note that there is a bug in the current version and you will get a null reference exception when trying to do this. To fix that - double click the error and in DecalSettings.cs line 388 change

    Code (CSharp):
    1. private List<Material> draggedMaterials;
    to

    Code (CSharp):
    1. private List<Material> draggedMaterials = new List<Material>();
     
    Last edited: Apr 15, 2018
    mrBeam and Mauri like this.
  49. applicattura

    applicattura

    Joined:
    Mar 28, 2017
    Posts:
    8
    Wanted to check the showcase scene and I am getting lots of errors. After resolving it I am getting rendertexture temp buffer problem :<
    2017.2.0p2 iOS platform
     

    Attached Files:

  50. gshape

    gshape

    Joined:
    Aug 8, 2012
    Posts:
    94
    Hello, I love this asset it does works great in non-VR projects.

    However, for the latest version of this asset with Unity 2017.3.1f1, VR single pass is still not performing well. It drops about 50 FPS with even only one decal in the scene. Already selected VR shader method in the options menu.