Search Unity

Projected Decals

Discussion in 'Web' started by creative_nap, Oct 11, 2018.

  1. creative_nap

    creative_nap

    Joined:
    Sep 12, 2018
    Posts:
    5
    Hi,

    We are working on a WebGL game which contained the asset pack 'Dynamic Decals' to project decals onto objects (https://assetstore.unity.com/packages/tools/utilities/dynamic-decals-76410) which worked perfectly in 2017.2 . Now we are trying to upgrade our game to 2018.2/2018.3b but the decals don't work anymore. Also the asset pack is no longer supported.

    Therefore we tried other decal packs: 'Simple Decal System' and '3D Decals' but they don't work either.
    Does anyone know if there is a functional asset pack available? Or are there other ways to project decals onto game objects since HDRP is not available for WebGL?

    Thanks a lot!
     
    Last edited: Oct 11, 2018
  2. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,071
    creative_nap likes this.
  3. itsDrew

    itsDrew

    Joined:
    Aug 16, 2017
    Posts:
    32
    Not sure if this is what your looking for but...

    I modified the stuff I learned from this: https://www.patreon.com/posts/rendertexture-15961186

    to do this:


    Knew very little shader code before digging in to that, and had only used render textures a couple times before for camera stuff.

    The performance is great, the game runs like butter on older mobile devices (if you turn the ads off). And runs fine in webGL. Shameless plug: check it out on armor games on oct 25th.
     
  4. kou-yeung

    kou-yeung

    Joined:
    Sep 5, 2016
    Posts:
    30
  5. creative_nap

    creative_nap

    Joined:
    Sep 12, 2018
    Posts:
    5
    Thanks @itsDrew i will try that out :) @kou-yeung maybe it's the same issue, i will follow these threads
     
  6. kou-yeung

    kou-yeung

    Joined:
    Sep 5, 2016
    Posts:
    30
  7. creative_nap

    creative_nap

    Joined:
    Sep 12, 2018
    Posts:
    5
    Thanks for the update! Do I have to change some specific settings? Otherwise my problem isn't the same :(
     
  8. kou-yeung

    kou-yeung

    Joined:
    Sep 5, 2016
    Posts:
    30
    not have to change any specific settings.just update to 2018.3.0b6.
    if have same problem.maybe not same issue...sorry for that:(
     
  9. Rallix

    Rallix

    Joined:
    Mar 17, 2016
    Posts:
    139
    I don't know, I also use Dynamic Decals in a WebGL project and can't remember them being broken – and I went through most of the 2018.3 beta releases.

    Decals.png

    They work fine for me. Perhaps there's a problem somewhere else?
     
  10. creative_nap

    creative_nap

    Joined:
    Sep 12, 2018
    Posts:
    5
    Did you try to build the game? I created a new blank project with just the Dynamic Decals package and built the demo scenes (Goos and Classic scene) for WebGL but the decals didn't work, they are invisible. Everythink but the decals seemed to be working properly. Maybe it's the build settings? Can you try to build your game and tell me if it's working?

    Edit: In the editor and when in play mode the decals are working too, strange...
     
  11. Rallix

    Rallix

    Joined:
    Mar 17, 2016
    Posts:
    139
    Hm, now that you mention it, I didn't try to build the game for a while and no – in the build, the decals are gone.
    I remember that for an unrelated project and asset, I had to manually put some shaders in "Always Include Shaders" under graphics settings for it to work… but Dynamic Decals have a plenty of shaders and trying to include some of them which I believe I'm using (e.g. Projection/Metallic/Deffered) didn't help much.

    In the browser console, it's spamming this warning:
    [.WebGL-000001A7BC6E6950]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
    even though I'm not sure if it's even related to this problem.

    You could probably write to the author since even though the asset is very unfortunately deprecated, in the last post he wrote, he says he at least still intends to 'support' it.
    Or maybe it's Unity's issue.
    I'd say it's reasonable to believe that whatever works as expected both in Scene View and Playmode should probably work in builds as well.
     
    Last edited: Nov 6, 2018
    creative_nap likes this.
  12. Rallix

    Rallix

    Joined:
    Mar 17, 2016
    Posts:
    139
    @creative_nap – Hi, I've been wondering, did you eventually manage to solve this problem?
     
  13. creative_nap

    creative_nap

    Joined:
    Sep 12, 2018
    Posts:
    5
    @Rallix no unfortunately not, tried many things but the problem does still exist. What I didn't do is to write the author for 'support'. Im sorry...
     
  14. BurningToad

    BurningToad

    Joined:
    Aug 14, 2013
    Posts:
    56
    We are having this problem as well now with Dynamic Decals showing up in the 2018.3 editor, but not in builds. @creative_nap @Rallix still no luck I'm guessing? Have either of yall created a bug report yet? This issue exists on regular standalone windows builds as well.
     
  15. Rallix

    Rallix

    Joined:
    Mar 17, 2016
    Posts:
    139
    @BurningToad I created a bug report only last week (so there's no reply yet), based on the fact that the same package used to work in a previous version of Unity, but doesn't work anymore (as Schubkraft suggested).

    WebGL builds spam
    "[.WebGL-…]RENDER WARNING: texture bound to texture unit 1 is not renderable. It maybe non-power-of-2 and have" incompatible texture filtering. "
    in Google Chrome, and the same build opened in Edge:
    "WEBGL11163: clear: Invalid framebuffer operation."
    "[2x] WEBGL11163: drawElements: Invalid framebuffer operation."


    However, a standalone PC build works fine for me. To report the bug, I made just a simple "cube on a plane" scene and slapped a ProjectedDecal component on it. Worked in the Editor, in the Standalone build but not in WebGL.

    I'll let you know if I get a reply.
     
  16. PieterAlbers

    PieterAlbers

    Joined:
    Dec 2, 2014
    Posts:
    242
    We also use Dynamic Decals (shame its been deprecated btw) in our WebGL projects - our latest
    game https://www.miniclip.com/games/police-pursuit-2/en/#t-l-gs1-H is working just fine with it. The car shadow blobs as well as the lightspots (HD settings - first campaign mission) use Dynamic Decals.

    I do always have to fiddle around with it to make it work though - and I do recall as well that before 2018 it wasn't as much of a hassle to get it to work.

    Now for webgl I have to make sure the Shader Method (Window > Decals > Setting) is set to Mobile and you have to make sure depthnormals are being rendered for your active camera. If they are disabled you would have to force them on somewhere.

    I am not sure if this is the proper setup or just a workaround for another issue - hope it helps though
     
    Rallix likes this.
  17. Rallix

    Rallix

    Joined:
    Mar 17, 2016
    Posts:
    139
    @PieterAlbers Thank you so much for the tip! Yes, that's what did the trick for me – switching the shader method to Mobile and also making sure Force Forward option is selected.
    I was already using the depth normals mode for my main camera before, so I'm not sure whether it impacted anything.
     

    Attached Files:

  18. PieterAlbers

    PieterAlbers

    Joined:
    Dec 2, 2014
    Posts:
    242
    @Rallix No thanks :)
    I still think it's a workaround since I can't recall doing this for some of our older games with Dynamic Decals built in 2017 or at least before 2018.2. Unfortunately I don't have a lot of spare time to get to the inner workings and see what is going on.
     
  19. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    Has anyone got this working for 2018.3? I used it in 2017 and it works great,but not with 2018.3 + Also, I made my own system and when I get time I plan to see what I can do to get it working with my system .. with 2018 and 2019. because right now, we don't have anything..... Unless you use Unity new Rendering, which is still a ways away...for production work.... so if anyone, had got this working let me know. or plans to work with it still for new versions. :) Thanks!
     
  20. Rallix

    Rallix

    Joined:
    Mar 17, 2016
    Posts:
    139
    Sure.
    I think people in the official thread said there's no problem with functionality except for a few new warnings which you need to fix (mostly related to the new prefab system).
    I personally tested PC/Windows on a small project, too; which worked all right. WebGL didn't work until I did what PieterAlbers proposed – now it's working fine for me.

    If it doesn't work for you for some reason, you could try the same fix – change shaders to Mobile (even if you're not making the game for mobile) to see if it helps.