Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Official 2D Renderer in Universal Render Pipeline in 2019.3

Discussion in '2D Experimental Preview' started by rustum, Feb 17, 2020.

Thread Status:
Not open for further replies.
  1. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    As a small side-note to my previous post, it appears there is a typo in the in-line help for Camera Sorting Texture.
    Note how in the image "Layers" is plural, but every place else I've seen reference to this it is not.
    CSL.PNG

    That could cause some confusion. :)
     
    Last edited: Mar 13, 2021
    AlexVillalba likes this.
  2. eduardooriz

    eduardooriz

    Unity Technologies

    Joined:
    May 28, 2018
    Posts:
    97
    Hi Jeff
    Have you tried unchecking the box "exposed" in the Graph Inspector? when it's unchecked _CameraSortingLayerTexture can be picked up
     
  3. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    I tried it checked and unchecked and every other way I could think of. :) It just doesn't seem to be picking up the _CameraSortingLayerTexure.

    I even created a brand new URP project and tried with that. Still nothing.
     
  4. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    FYI, I created a bug report for this issue and attached a very simple project that shows the issue.
    Find it here: https://fogbugz.unity3d.com/default.asp?1321997_b2jfjm4k0fr29eiv
     
  5. eduardooriz

    eduardooriz

    Unity Technologies

    Joined:
    May 28, 2018
    Posts:
    97
    hey Jeff

    Let me share the nodes that I used here, I'm using one of the recent 2021.1 betas, and our latest 2D demo Dragon Crashers. This is a quick video.
    And the nodes can be found here, is there anything that is set up different to your project?
     

    Attached Files:

    Last edited: Mar 16, 2021
  6. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Thanks @eduardooriz. Currently I can't see your image.
     
  7. eduardooriz

    eduardooriz

    Unity Technologies

    Joined:
    May 28, 2018
    Posts:
    97
  8. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    My current setup seems to be very similar to yours and I feel like it is setup correctly. I have checked and double checked everything many times. Is it possible to download this sample you have? I'd like to see if it works for me.
     
  9. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Here is a l link to the sample project I sent with my Unity Bug Report.

    This is a simple URP project with 2D Renderer. (Unity 2021.1.b11)
    It has 3 Sprites. One to act as "Water" and 2 that sit behind the water and show the distortion effect.

    For me, I get no distortion. It just acts as though the _CameraSortingLayerTexture does not exists as a global shader variable.

    Here is the link (from my One Drive account): https://1drv.ms/u/s!ArCOhzCNfm7ckOtJST9p0A3ChjeiSg?e=PMziLM
     
  10. eduardooriz

    eduardooriz

    Unity Technologies

    Joined:
    May 28, 2018
    Posts:
    97
    It worked for me when I changed the material type to Sprite-Lit, video I think somebody from the R&D 2D team will be able to confirm about how it works with Sprite Unlit, one thing I noticed is that the sorting layers should be ordered from Background (layer 0) to Foreground (layer 1)
     
  11. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    Hmmm. Ok, I'll try again on my end and report back. Thanks for taking the time to look at this.

    Oh, and to be clear. You think this should be work-able with Sprite Unlit as well.... if setup correctly? The scene in my game is mostly Unlit.
     
  12. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    An update for anyone else struggling with this.

    I have everything working now. (Thanks @eduardooriz)
    After a lot of tinkering I found that Sprites and the Water shader can indeed be Unlit... with a caveat.

    In order for the _CameraSortingLayerTexture to work... even for UnLit sprites and shaders graphs, you HAVE to add at least one light. What is interesting is the light doesn't need to have any sorting layers set and its intensity can be set to zero.

    Here is the only light in my game (My game is all Unlit). This was added just to make the _CameraSortingLayerTexture work:

    Screen Shot 2021-03-17 at 7.58.31 AM.png

    Note the target sorting layer is "None" and intensity is 0.

    My only thought is that having this light in the scener triggers something internal to make the _CameraSortingLayerTexture start working.

    Hope this helps someone else.

    -Jeff
     
    midsummer, NotaNaN and AlexVillalba like this.
  13. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    257
    Oh no, that's not good. I'll look into this.
     
  14. undevable

    undevable

    Joined:
    Dec 25, 2020
    Posts:
    140
    I tried using the 2D renderer, and two problems with it. One, I can't apply a skybox to it. Two, each time I pan around in the scene view, some weird trail comes on my image (a picture of this is below). However, But, when I used a Forward Renderer instead, everything worked perfectly and fine.
     
  15. undevable

    undevable

    Joined:
    Dec 25, 2020
    Posts:
    140
    Oh nevermind. Using the forward renderer meant that I couldn't use 2D lights.
     
  16. algumacoisaqq

    algumacoisaqq

    Joined:
    Apr 7, 2014
    Posts:
    4
    THANK YOU!!!
    I have been trying to figure this out for 3 days now. As someone not so experienced with programming or shaders, I had no idea if the bug was my fault or something on the pipeline not working. It is working as it should now. Working on 2020.3.0f1, upgraded to 2020.3.1f1 but is still wouldn't work, until you mentioned adding that light.
     
  17. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    356
    @Chris_Chu I just noticed that the 2D Renderer and the 2D Lights don't have the "Experimental" tag anymore in 2021.1. But the scripts still seem to be in the Experimental namespace. So, is the 2D Renderer production-ready now?
     
    RemDust, NotaNaN and AlexVillalba like this.
  18. undevable

    undevable

    Joined:
    Dec 25, 2020
    Posts:
    140
    Since there is no Experimental tag anymore, will the 2D renderer work for me? Because I have been having that trail issue and that I can't apply a skybox...
     
  19. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    257
    It's still considered experimental, but I have fixed the trail issue (if it's the one I'm thinking of).

    I think it should be in 2021.1 f1. I did backport it as well to I think 10.4? But I'm not sure off hand.

    As for skybox we still don't support it. Do you need one? If so what sort of game are you making for that needs it
     
  20. AlexVillalba

    AlexVillalba

    Joined:
    Feb 7, 2017
    Posts:
    346
    Last edited: Mar 26, 2021
    NotaNaN and MousePods like this.
  21. undevable

    undevable

    Joined:
    Dec 25, 2020
    Posts:
    140
    If I apply a skybox the trail still appears. So I removed it (because you said the 2D renderer doesn't support a skybox), and the trail effect doesn't show up anymore.

    So I think that fixed the problem
     
  22. Zephus

    Zephus

    Joined:
    May 25, 2015
    Posts:
    356
    Isn't this really confusing? You removed the "experimental" suffix, so now it looks like it's production-ready. If I didn't come here to ask I would've just assumed that it's out of experimental status.
     
    undevable likes this.
  23. undevable

    undevable

    Joined:
    Dec 25, 2020
    Posts:
    140
    Agreed. Removed experimental when it's still experimental.
     
  24. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    257
    I can see how this would be confusing. I can't remember the reason we removed experimental from all the menu items, but I think it was a matter of it shouldn't have been there in the first place.

    All the code is still in the experimental namespace. Which granted, not everyone looks at.
     
    undevable likes this.
  25. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    257
    So I understand your issue with this feature being removed. The main reason why things were simplified was to have less code maintenance/bugs.

    The idea behind this change was that in the Sprites could replace this functionality better. There are definitely some things about using offset that don't look very good.

    The problem is that Sprite Lights currently don't respect sprite pivot and that's an issue since shadows projection, and normal maps lighting calculations use the lights origin. I'm going to make a fix for this, and try to backport that fix. However, I need to finish a few things before I get to it.
     
  26. AlexVillalba

    AlexVillalba

    Joined:
    Feb 7, 2017
    Posts:
    346
    Thank you so much for your explanation, you are very kind. So, for me to understand it properly, are you saying that the Falloff offset property is going to reappear in the future, once you make the fix you mention?

    And Bonus question: Based on what you describe, could the Falloff offset property be enabled for Freeform lights only, so it does not produce wrong results with other types of light like Sprite lights?

    Thank you again.
     
  27. kloot

    kloot

    Joined:
    Mar 14, 2018
    Posts:
    78
    Oh, so I take it the URP 2D Renderer is still experimental after all... Any (ballpark) idea when it will be considered production-ready?

    Thanks
     
  28. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
    I really hope they fix shader graph bugs before considering it being *not* experimental anymore.
     
  29. AlexVillalba

    AlexVillalba

    Joined:
    Feb 7, 2017
    Posts:
    346
    Hi guys, sorry for insisting but is there anything you can tell us in advance about this? I have to make some important decisions soon and some of them depend on whether we will have a replacement for this visual effect in the future or not (whenever it comes, I don't need a date). Thank you.
     
    NotaNaN and kloot like this.
  30. Charlivi

    Charlivi

    Joined:
    Feb 1, 2021
    Posts:
    8
    Hi!
    I was wondering if the Emission integration to the Sprite-Lit Shader Graph as been planned for upcoming releases? Even an approximation would be appreciated. I can't see it in the road maps and we would really need it to reach the visual target of our project.

    Thanks a lot!
     
    NotaNaN and EvOne like this.
  31. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
    3 month passed since the URP lighting got broken for shader graph created shaders. Any updates on that one? Would love to update my project to 2021 but without a workaround or fix, I can't upgrade.
     
    NotaNaN likes this.
  32. RemDust

    RemDust

    Joined:
    Aug 28, 2015
    Posts:
    432
    More than a year has passed since I've been told that Depth of Field for 2D renderer and 2D objects will be on the roadmap... :/

    Any news ? :)

    Thanks !
     
    NotaNaN likes this.
  33. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    257
    Thats strange I though it got fixed. I had your project, and thought I fixed the issue. Can you resubmit a bug for it.


    The near-term solution will be related to using sprite lights. I will make a bug fix it so the sprite lights respect the sprite pivot. That way users can specify where in the sprite the light's origin is (for shadow casting and normal maps). What do you think about this?
     
  34. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    257
    The work I did on this got put on hold, unfortunately. I'll think about this though, maybe I can post an unofficial solution to this if I have some free time.


    So this has been something people have been asking for. This can be done with shadergraph with most versions of the 2D renderer, provided you do not need normal maps. But we have added a new shadergraph master node that should be in the next release, that will let you also have normal maps.

    I'll see if we can get a sample shadergraph shader that can show how to do this.
     
    Charlivi, NotaNaN and RemDust like this.
  35. AlexVillalba

    AlexVillalba

    Joined:
    Feb 7, 2017
    Posts:
    346
    That may work, yes. :)
    It's not perfect since it forces me to create a sprite that fits perfectly the shape of the light, which takes much more time, but it's something. Freeform with falloff offset would be the perfect solution.
     
    Last edited: Apr 19, 2021
  36. RemDust

    RemDust

    Joined:
    Aug 28, 2015
    Posts:
    432
    Thanks for the quick reply Chris,

    That would be nice =)
    We've been waiting so long for this, DOF is so important for non pixel-art games !
     
  37. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
    Sure thing. I've submitted a new bug report case 1330228 for you. This time with 2021.1.3f1 and with URP 11.0. Let me know if you need any other info from me.
     
  38. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    517
    Saddened that the depth mesh branch was closed. Was looking forward to those improvements to fill rate by utilizing depth testing as well as improvements to to the tessellation. I am disappointed with progress on the 2D renderer for over a year of development. It feels like dev has been super slow on improvements, changes, and getting out of preview. Not sure what the priorities are internally but cancelling perf improvement workflows seem like a poor choice from the outside.
     
    jehk27, NotaNaN, xiao-xxl and 2 others like this.
  39. xiao-xxl

    xiao-xxl

    Joined:
    Nov 16, 2018
    Posts:
    48
    Need the depth mesh branch very much to improvements to fill rate !! My game is very very slowly in mobile! Because I have many layer of sprites.
     
  40. xiao-xxl

    xiao-xxl

    Joined:
    Nov 16, 2018
    Posts:
    48
    And when the new features in unity 2021 like "Camera Sorting Layers Texture" can be used in 2019? My game is developing in unity 2019.
     
    RemDust likes this.
  41. jehk27

    jehk27

    Joined:
    Mar 23, 2013
    Posts:
    16
    What's the plan for shadow caster 2d and tilemaps? Right now if I add a ShadowCaster2D to a Tilemap it will use the bounds of the tilemap to create shadows instead of using the individual polygons that make up the tilemap. I can create separate ShadowCaster2D game objects and manually fit their polygons to the tilemap. That is not a feasible solution. I've seen some workarounds but I don't know if I want to support any of these in a production game.
     
  42. AlexVillalba

    AlexVillalba

    Joined:
    Feb 7, 2017
    Posts:
    346
    I guess you already know about this https://forum.unity.com/threads/script-for-generating-shadowcaster2ds-for-tilemaps.906767/
    But I agree, that should be built-in already.
     
    jehk27 likes this.
  43. jehk27

    jehk27

    Joined:
    Mar 23, 2013
    Posts:
    16
    AlexVillalba likes this.
  44. JohnHer

    JohnHer

    Joined:
    Jun 11, 2019
    Posts:
    6
    Is there still no way to control the length of the shadows cast by 2D lights?
     
  45. Charlivi

    Charlivi

    Joined:
    Feb 1, 2021
    Posts:
    8
    Thanks so much Chris for your reply. We do need the normal maps, so we're looking forward to that next version you mentioned. Would you happen to have the target version number?
     
  46. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    257
    I'll have to update you on this later. It will likely be in a version of 2021.2, but it doesn't look like the PR has landed, so I need to figure out what is going on with this.
     
  47. Charlivi

    Charlivi

    Joined:
    Feb 1, 2021
    Posts:
    8
    Thanks again so much for the replies Chris! We will check the release notes of 2021.2 and this thread.

    We encountered another serious issue in 2021.1 : the 2D lights seems to have the Normals settings always resetting.
    https://forum.unity.com/threads/2d-spot-light-normal-maps-always-reset-to-disabled.1052687/
    We are having that issue in both 2021.1.3f1 and 2021.1.5f1. It was fine in 2020.3.6f1.
    I see the "Bug" tag on this, but no one from Unity confirmed it's going to be fix, is it planned?

    Update :
    On the issue with 2D Lights normal setting reset, is seems fixed in 2021.2.0a17
    https://issuetracker.unity3d.com/is...ity-gets-disabled-when-entering-the-play-mode
     
    Last edited: Jun 9, 2021
  48. AlexVillalba

    AlexVillalba

    Joined:
    Feb 7, 2017
    Posts:
    346
    MousePods and NotaNaN like this.
  49. Charlivi

    Charlivi

    Joined:
    Feb 1, 2021
    Posts:
    8
    Hi @Chris_Chu, is there any news on the integration of Emission to the Sprite-Lit Shader Graph? Is it confirmed to be in 2021.2 once out of alpha?

    Thanks so much for your time!
     
    EvOne likes this.
  50. zt3ff3n

    zt3ff3n

    Joined:
    Feb 19, 2016
    Posts:
    37
    Trying to implement Camera Stacking on a 2020.1.7 2D Render Pipeline project. I know it wasn't possible in earlier versions of the URP, but from URP 8.2.0 this message in the docs has been removed, making me believe it has been made possible

    "Important note: In this version of URP, Camera Stacking is not supported when using the 2D Renderer or when using the VR Multi Pass mode. Support for these will be added in upcoming versions of URP."

    https://docs.unity3d.com/Packages/c...nes.universal@8.2/manual/camera-stacking.html

    I've been unsuccessfull so far, and curious if the mistakes are on my end, or if the docs are incorect = it still isn't possible for the 2D render pipeline in URP 8.2 ?
     
Thread Status:
Not open for further replies.