Search Unity

[RELEASED] Decalicious – Deferred Decal System

Discussion in 'Assets and Asset Store' started by Daerst, Nov 21, 2016.

  1. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Hey cowtrix, we're working on a fix to get Unity 5.4 working again - nothing too fancy, we should get it done in a couple of days. Please also send an e-mail to our support adress info@three-eyed-games.com so we can send you the fix as soon as it's ready. One caveat though: CommandBuffer.DrawMeshInstanced has been introduced with Unity 5.5 and is required by Decalicious to use instanced rendering. Without instanced rendering, you should not go overboard with the number of decals you use, or you might run into performance problems.
     
    Martin_H likes this.
  2. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Just wanna let you know that Decalicious 1.3.1 is on its way, adding an option to disable instanced drawing (automatically disabled if your GPU doesn't support it) and restoring compatibility with Unity 5.4. The example scene was built in Unity 5.5 and won't open in Unity 5.4, but I'm taking good care of the handbook, and if you have any questions, I'm here to help ;)

    I'll push the update to the store tomorrow, usually it's about 2 weeks until it's accepted and available for you guys. If you're in a hurry, drop me a message.
     
    Martin_H likes this.
  3. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,141
    So I bought Decalicious and I must be the only one having this problem but... I can't get decals to draw at all? Please tell me I didn't do something stupid like accidentally buy a DX11 asset when I do all my work on my Mac.

    It's happened before.
     
  4. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    Are you using the deferred rendering path or forward rendering? It only works in deferred.
     
  5. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,141
    Deferred. I double checked that first.
     
    Martin_H likes this.
  6. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,141
    Okay, with a bit of experimentation I kinda got it to work. It took some running through my debug shaders BUT it turns out I had to rotate the decal box 270º along X to properly align it with the plane I was projecting on to. That's... a little weird, but I guess I can script around it.

    edit: This seems to be an export issue with my mesh. Further experimentation is needed

    edit 2: Sure enough, the rotation should have been a dead giveaway. It's because of how Unity handles Blender's FBX exporting system.
     
    Last edited: Jan 14, 2017
  7. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    The Y-axis of your mesh should point roughly in the direction of the normal of the underlying surface. If you add an empty GameObject and add the Decal script, it's good to draw on a floor, or anything with very roughly upright normals. Does this help?
     
  8. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,141
    Yeah, that seems to handle everything perfectly. Thanks for the quick reply!
     
    Daerst likes this.
  9. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    For what it's worth these are the export settings I use in Blender:

    2017-01-15-a.JPG
     
  10. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    We are getting reports of decals flickering when the camera is moved, both in editor scene view and play mode. Seems to happen when strong ambient light is present, but so far, I have not been able to reproduce this issue.

    Does anyone here experience this issue and could provide an example scene that shows this error?
     
  11. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    I've noticed some bright pixel seams around meshes placed in front of dark decals. Any chance that could be related?
     
  12. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Probably not, but interesting nevertheless - could you provide screenshots?

    I've identified ShadeSH9 (DecaliciousDeferredDecal.shader:79) in combination with precomputed real-time GI as the culprit. It seems that the probe being used is dependent on the camera position or whatever and thus can change, which leads to unexpected lighting changes. I'm looking into it.
     
  13. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    This is the one I had saved:
    2017-01-14-d.JPG

    And one from today with all other post effects disabled.
    2017-01-24-a.JPG

    It almost looks like it's using something at half resolution without any interpolation.

    p.s. pictures taken from game view but I see it in scene view as well.
     
  14. gian-reto-alig

    gian-reto-alig

    Joined:
    Apr 30, 2013
    Posts:
    756
    Hi

    Just started using decalicious, noticed some weird behaviour.... seems when the camera gets cose to the decals I have in the scene, they dissapear.

    Its reproducible, and happens with all the decals I have tested so far.

    Any idea what could lead to this?
     
  15. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Thanks for posting this - I can't reproduce it. Not sure I see the bright outline with the other post-effects disabled though - it's hard to tell what's decal and what not :D I don't have any problems with Decalicious and new Post-Processing Stack.
    The entire dark background is a huge black-ish decal:
    norep1.jpg


    Can't reproduce, even if I get super-close to my decals.
    norep2.jpg
    The sink is a decal in this example :) What is your Unity version, system and graphics card?
     
  16. gian-reto-alig

    gian-reto-alig

    Joined:
    Apr 30, 2013
    Posts:
    756
    Well, problem solved... how? I.. don't know really.

    After trying to reproduce the problem in a separate scene and failing to do so, I went into the original scene and created a new Decal GameObject from scratch. Everything worked fine. Even as I finally scaled and transformed the new Decal to the exact position and rotation of the decals that gave me these problems it still worked, with the same material and settings.
    On the other hand, the original decal gameobject in the scene would always disappear at close range no matter what I changed.

    So finally I just replaced the original gameObjects with new ones and these seem to work fine.

    What exactly was broken with the original Decal gameObject IDK. Couldn't find a difference really. So I guess if someone has the same problem as me with Decalicious: Just recreate your decal gameObjects from scratch.
     
  17. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Interesting... If you still happen to have a scene with a broken decal, I'd love to take a look at it!
     
    gian-reto-alig likes this.
  18. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Working on a fix for this right now. It seems that the interpolated light probe is not set correctly when the decal is rendered (which kinda makes sense, since decals are rendered after the GBuffer is done, and thus will probably use the interpolated light probe of the last object being rendered during regular Unity rendering). Will push an update soon :)
     
  19. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    Hi!
    I use Unity version 5.4.1f1
    How can I download the shader?
    The asset store asks for 5.5 and does not display the purchase button.
     
  20. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Can anyone who is using Decalicious with Unity 5.4 provide help? I imagine that you can buy it from a web browser and, once bought, probably maybe download it in Unity 5.4. I'll make sure to submit the next package with 5.4 to get rid of the "requires Unity 5.5" message.
     
  21. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    I really wish there was a browser download option on the assetstore in general. It would make the whole plattform a lot more usefull for non-unity buyers too.


    Today I've seen the decal flickering for the first time. I could not figure out what caused it though. But it was not possible to overlook, all decals flickered in sync, like they all get turned off for 1 frame at the same time every couple dozen frames or so. I'll keep an eye out in hope to find the cause.
     
  22. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    I have found a fix for the indirect light flickering issues. Notice how the decal at first flickers between a neutral and blue tint when I move the camera, and later is shaded correctly.

    There is some code under the hood, so don't try to set Light Probes to 'Blend Probes' right now - it's not gonna help, yet ;) I will polish the solution and push it to the store soon.

    DqShcYkVoH.gif
     
    Martin_H likes this.
  23. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    Looks good. I don't use lightbaking and I'm not aware of using light probes (not exactly sure about how they work though, so maybe I have one somewhere and just didn't realize. I've disabled baking though, that one I'm sure of. Also iirc my camera was static during the flickering. Do think it could still be related?
     
  24. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    May potentially be, yeah... Though decals actually only should flicker (i.e. change color) if the camera is moved or if scene objects move. Hmm... I'll investigate :)
     
  25. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
    The flicker seemed more like visible/not visible instead of different colors though.
     
  26. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    Ok, already downloaded from browser.

    I have this shader error:
    unrecognized identifier 'UNITY_VERTEX_INPUT_INSTANCE_ID'

    Looking in the shader code I can see:
    #if UNITY_VERSION >= 550
    UNITY_VERTEX_INPUT_INSTANCE_ID
    #else
    UNITY_VERTEX_INPUT_INSTANCE_ID
    #endif

    It's Ok?

    How to fix to use it with Unity 5.4.x ?

    Thanks.
     
  27. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    Done!
    Removed the second UNITY_VERTEX_INPUT_INSTANCE_ID

    I will test more, but now appears to work nice.
     
  28. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    // Upgrade NOTE: replaced 'UNITY_INSTANCE_ID' with 'UNITY_VERTEX_INPUT_INSTANCE_ID'

    Damn Unity auto-upgrader broke it ;) Try this in both structs (appdata and v2f):

    #if UNITY_VERSION >= 550
    UNITY_VERTEX_INPUT_INSTANCE_ID
    #else
    UNITY_INSTANCE_ID
    #endif


    Will fix this in the next update, sorry.
     
  29. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    Ok ;)

    Another question...
    I have a second camera to draw a map, so I don't want Decalicious Renderer script on it.
    The problem is the auto insert when it was deleted.
    Any fix for that?
     
  30. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Just deactivate (instead of delete) the script on the camera you don't want to render decals :)
     
  31. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    When deactivate, the performance is very bad.
    Thanks anyway, I can let it activate an find another solution for my personal case
     
  32. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Decal.cs, replace lines 85 - 87 by:
    Code (CSharp):
    1. if (renderer != null)
    2.   renderer.Add(this, LimitTo);
    Then just manually add the DecaliciousRenderer component to the cameras that should render decals :)
    I wonder why performance is bad with a deactivated renderer though, I'll check that out..
     
  33. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    Thank you! ;)
     
    Daerst likes this.
  34. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    I'm triying to use "LimitTo" to restringe the draw to a gameobject only, but doesn't work, simply disappear the decal. Any idea?
     
  35. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Is the GameObject you are trying to restrict to a MeshRenderer (not SkinnedMeshRenderer)? This is the only kind supported right now - working on it.
     
  36. Sovogal

    Sovogal

    Joined:
    Oct 15, 2016
    Posts:
    100
    @Daerst Super glad I found this. Just bought it, even though I can't use it yet. Any rough ideas when you might add VR support? I assume it'll be less performant since it won't use deferred rendering in VR.
     
  37. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    I haven't started thinking about VR support, and have no ETA, sorry. That said, Decalicious is a deferred decal system, and there is no way that the core of Decalicious could work with forward rendering. Even in VR you'd have to stick to deferred rendering, which is probably not optimal because of missing MSAA.
     
  38. exltus

    exltus

    Joined:
    Oct 10, 2015
    Posts:
    58
    I have problem with applying decals on lightmap static object in baked scane. Any solution plz?
    http://c2n.me/3HgiBBD
     
  39. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Interesting, I will look into it. Would you mind sending this test project of yours to info@three-eyed-games.com? Thanks!
     
  40. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Can not reproduce. Left platform is static, baked GI is enabled. Since decals are dynamic, they don't adopt the light from the lightmap, but are rendered just fine. What Unity version are you using?

    error.jpg
     
  41. exltus

    exltus

    Joined:
    Oct 10, 2015
    Posts:
    58
    I have send you email with example scene where it is not working. here is video how to reproduce it in that scene http://c2n.me/3HhDyA7
     
  42. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Decalicious doesn't play well with Mixed light sources, or maybe I should say Mixed light sources don't play well with deferred rendering. With Mixed lighting, static objects are actually rendered in the Forward Opaque queue. Setting your light source to Realtime or Baked both solves the problem. I hope this is acceptable for you. If not, you will unfortunately have to wait for the Unity guys to come up with a fix - nothing I can do from here :(

    EDIT: I'll make sure to include some details in the user manual. Thanks for bringing this to my attention!
     
    Last edited: Feb 8, 2017
  43. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    455
    When this magic will happens? I'm using baked light and it's pain for my eyes :confused:
     
    Last edited: Feb 13, 2017
  44. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    To be clear, are you using precomputed realtime GI? This is what this fix is meant for. I'll pretty occupied right now, but hope to finish it next week.
     
  45. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    455
    Actually not realtime GI, just baked lightmaps with light probes, but it's glithches too... just like in those gif
     
  46. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    300
    Hi,

    I have bought your assets a few days ago. Setup was easy and I am currently only using unlit decals mainly for selection, mouse over stuff etc.

    Its working as expected in the editor, but the decals are not rendered when making a build for PC. I have tried 3 different PC with older and newer graphic cards (all on Windows 10) without success. Build was done with Unity 5.5.1.

    Camera and the graphics setting are set to deferred, 100% sure.

    Any idea what I am doing wrong?
     
  47. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Sorry for not replying to your mail so far, I'm kinda low on time these days. To your problem: This is weird, and I currently have no idea what is causing this. I will investigate. If you can, please send me a test project (via e-mail) that doesn't work when built. Thanks!
     
  48. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    300
    I have found the issue. I don't think you need a test project. Just add an unlit or deferred decal to your scene and set "LimitTo" GameObject and it will not show in the build. As soon as "LimitTo" is empty, it's working fine.

    I first thought it would be a problem, if the gameobject does not have a mesh, but that does not fix the problem.

    It's not only hiding the decal, it also prevents other decals to be drawn at all. We really need a fix for this soon.

    As I wrote in my mail, it would really be good, if you use the layer system for limiting decals. Doing this with gameobjects is not a convenient solution.

    This may sound a little harsh, but I would expect that such basic features are tested before it's submitted to the asset store. I lost half a day to this, because I thought I am doing something wrong. :(
     
    Last edited: Feb 23, 2017
  49. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    Can confirm, thanks for pointing this out. Haven't tested Decalicious in a build for some time. Gonna fix asap.

    I'm still looking for a good universal solution. As has been previously stated in this thread, layers might not be the perfect solution either (overlap with physics use), but I will try to implement them soon. Sorry to waste your time.
     
  50. Daerst

    Daerst

    Joined:
    Jun 16, 2016
    Posts:
    275
    @DwinTeimlon Here is a quick fix for your problem: it seems that Unity does not include "Hidden/*" shaders in the build.
    1. In DecaliciousRenderer.cs, change the line (found in function DrawLimitToGameObjects)
      _materialLimitToGameObjects = new Material(Shader.Find("Hidden/Decalicious Game Object ID"));
      to
      _materialLimitToGameObjects = new Material(Shader.Find("Decalicious/Decalicious Game Object ID"));
    2. In DecaliciousGameObjectID.shader, rename it from "Hidden/Decalicious Game Object ID" to "Decalicious/Decalicious Game Object ID" (change the first line).
    Again, sorry for the inconvenience. I'll push this fix to the store soon, together with the light probe fix. Next I'll work on the layer-based limiting functionality.