Search Unity

Official 2D Graphics (URP 12) released for Unity 2021.2

Discussion in '2D' started by rustum, Oct 25, 2021.

  1. rustum

    rustum

    Unity Technologies

    Joined:
    Feb 14, 2015
    Posts:
    190
    2D Graphics (URP 12) released for Unity 2021.2

    2D Graphics 12.png

    Good news! 2D Graphics features in Universal Render Pipeline (URP) 12 are now available with Unity 2021.2.

    What’s new?
    • Added a 2D URP Project Template to Unity Hub so you can get started quickly with a 2D project configured for the 2D Renderer in URP.
    • Added a Sprite Custom Lit sub-target to the Universal target in Shader Graph. This can be selected via the Material dropdown in the Graph Inspector.
    • Added a 2D Light Texture Node in Shader Graph that enables sampling of the Light Textures generated by the 2D Renderer.
    • Added a Sprite option to Main Preview in Shader Graph. This does not allow rotation making it a better default preview for URP Sprite shaders.
    • Added 2D Lights to a new tab in the Light Explorer window.
    • Added support for VFX Graph.
    • Added support for Renderer Features.
    • Added support for default sprite mask shaders for the 2D Renderer.
    • Removed 2D renderer from the experimental namespace.
    See the full URP 12 changelog here.

    About 2D Graphics in URP
    2D features in URP include 2D Renderer, 2D Lights and Shadows; and the 2D Pixel Perfect Camera to support projects with a pixel art style.
    Read more about 2D Graphics features in URP here.

    Getting Started
    1. Install latest Unity 2021.2
    2. Start a new project with the 2D URP Template in Unity Hub
    If you want to add the package manually from Package Manager follow the steps in the setup guide in the manual.

    What can you do?
    Try it out and let us know what you think of the additions and improvements. We want to know what works as expected, what doesn’t and what is missing.
     
    NotaNaN and Deleted User like this.
  2. rustum

    rustum

    Unity Technologies

    Joined:
    Feb 14, 2015
    Posts:
    190
    2D Graphics Samples
    To accompany this release, download the 2D Renderer samples (updated for 2021.2) here.

    They are now organised into 2 basic groups:
    • Feature Examples that show a feature in action; and
    • Applied Examples that show features being used to solve a particular problem.
    For this release we have added the following samples:

    VFX Graph
    VFX Graph.png

    This shows the 2D Renderer working together with VFX Graph.

    Emissive
    Emissive.png

    This uses the new 2D Light Texture Node in Shader Graph. The Light Textures generated by the 2D Renderer are sampled and modulated by an Emissive mask Secondary Texture on the Sprite. The sample also includes a Bloom post-process to extend the glow beyond the pixels of the Sprite.

    (Updated)
    Renderer Features
    Renderer Features.png

    This shows support for Renderer Features in the 2D Renderer. It uses a Scriptable Renderer Feature to create a fullscreen blur.
     
    UnityMOV, EvOne, pahe and 2 others like this.
  3. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Does vfx graph support includes lit mode?
     
  4. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
    Would it make sense to reevaluate the roadmap for the 2D features due to the reduced team size working on the 2d feature set? I think the community could tell (i.e. vote) which features are currently missing and what would be probably the most needed features at the moment. For some of the major features we're missing, we wait for quite a while now.

    Opening the development is a good thing and some of the community members have already started to write custom code, but there are still limitations and it would be nice if we could get rid of those.
     
    Tony_Max, NotaNaN and MousePods like this.
  5. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    While Unity adding feature officially is going to be nice, what I think it needs right now is to open up the API, Fix the missing setter on properties and give us power to be able to customize the system easier.

    For example, 2Dlights are so limited right now because it just has fixed amount of types, we should be able to derive from the base 2Dlight and make our own.
     
    Last edited: Oct 28, 2021
    Tony_Max, kyuskoj, pahe and 1 other person like this.
  6. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    This is really great progress!

    Theres only two things I can't replicate in 2d URP that I can do in SRP:

    - directional light (e.g. the sun) on normalmaps
    - specularity
     
    NotaNaN likes this.
  7. kayroice

    kayroice

    Joined:
    Feb 7, 2017
    Posts:
    49
    I just upgraded to 2021.2.0f1 and with it URP-12.1.0. Unfortunately, my full screen post-processing effect has stopped working (I expected this as I had tried beta versions of 2021.2, and had the same result). The work around that I've been using since upgrading to URP is detailed here. It involves using BlitRenderFeature and camera stacking.

    What I'd like to know is what is the supported method for creating custom full screen post-processing effects using URP?

    To be clear, all I'm trying to accomplish is to apply a custom shader (that I can control via a MonoBehaviour) to a camera in order to achieve a full screen custom post-processing effect. The problem seems to be that URP's 2D renderer (not the Forward Renderer) does not support either Custom Volume Overrides or Custom Renderer Features. Maybe this has changed with URP-12.x and I just haven't found it yet, but I don't see anything in URP's PostProcessing nor in the Customizing URP section.

    @rustum, maybe you or someone else on the URP team can address this?
     
    enhawk, Ferazel, zfh2773 and 2 others like this.
  8. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    I'm having the same issue with a fullscreen shockwave style effect I hoped to use. I can't seem to get any custom fullscreen effects to work.
     
    kayroice likes this.
  9. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    916
    @kayroice & @hawken thank you for flagging this issue. Could you create a bug report and post the bug id in this thread? Then we can more easily dig into this issue.
    Thanks!
     
  10. rustum

    rustum

    Unity Technologies

    Joined:
    Feb 14, 2015
    Posts:
    190
    @kayroice & @hawken We added support for Renderer Features to the 2D Renderer in URP 12 (2021.2). I've updated the 2D Renderer Samples with a simple example. Get the project here, and let us know if it works for you.
     
    Beachhairsalon, zfh2773, pahe and 2 others like this.
  11. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    @rustum There seems to be a bug in 2D Renderer (URP12) related to a combination of PixelPerfect and PostProcessing.

    Only the bottom left portion of the view is rendered when PostProcessing is enabled and PixelPerfect component is set to Upscale Render Texture. (case 1377086).

    The easies way to reproduce is using 2d-renderer-samples and loading scene 2d-renderer-samples-21.2\Assets\Samples\2D Renderer\01 Feature Samples\06 Post Processing\_Post Processing.unity.

    1. At the scene camera add Pixel Perfect Camera component and set Grid Snapping to Upscale Render Texture.
    2. Change Game view tab from Free Aspect to 1920x1080.

    Enabling/disabling Camera -> Rendering -> PostProcessing will cause game view "zooming" in and out. The same happens by leaving PostProcessing enabled and disabling/enabling PixelPerfect component.
     
  12. kennyy_

    kennyy_

    Unity Technologies

    Joined:
    Apr 7, 2021
    Posts:
    96
    Hi @Nikaas, your issue is the same as this one tracked here.

    The bug has already been fixed and is pending to be released in a new package.
     
    Nixaan likes this.
  13. xiao-xxl

    xiao-xxl

    Joined:
    Nov 16, 2018
    Posts:
    48
    Add opaque sprite and better sprite mesh to reduce overdraw.is it possible?
     
  14. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    916
  15. xiao-xxl

    xiao-xxl

    Joined:
    Nov 16, 2018
    Posts:
    48
    Custom Outline Tool is Good.

    Do you have opaque sprite shader?
    The Drawcall and overdraw of the current 2d renderers are very huge and not friendly to mobile platforms.

    Some features are only available in the new version of Unity. I don’t know if they will be ported to Unity 2019. Can there be a centralized description that shows the minimum Unity supported version of various features.
     
    EvOne likes this.
  16. MatterLink

    MatterLink

    Joined:
    Feb 27, 2018
    Posts:
    5
    There seems to be some issues with the 2D shadows. This was tested in a new project using the 2d URP template in 2021.2.3f1. If a sprite with a shadow caster is close to a light, the shadows do not render properly:
    upload_2021-11-19_3-27-43.png

    Also there seems to be shadow artifacts with volumetric lights in some cases. I created a simple scene with a 2d spot light duplicated a few times. Moving around a square shadow caster results in the artifacts below, or does not produce shadows at all:
    upload_2021-11-19_3-40-36.png

    I found these same bugs when I first tried 2021.2.0.
     
    Regone likes this.
  17. kennyy_

    kennyy_

    Unity Technologies

    Joined:
    Apr 7, 2021
    Posts:
    96
    We do not support split opaque and transparent rendering at the moment, but it is on our backlog and one of our priorities to improve performance. We will keep you posted once we have something to show.
     
    dannyalgorithmic likes this.
  18. MatterLink

    MatterLink

    Joined:
    Feb 27, 2018
    Posts:
    5
    @kennyy_ Are the issues I mentioned in my last post known? I couldn't manage to find anything on the issue tracker.
     
  19. kennyy_

    kennyy_

    Unity Technologies

    Joined:
    Apr 7, 2021
    Posts:
    96
    @MatterLink Can you report the bug and share the project. That way it will be easy for us to track and repro the issue. Thanks!
     
    rustum likes this.
  20. sharkthekidsteel

    sharkthekidsteel

    Joined:
    Dec 9, 2021
    Posts:
    1
    Hi, I'm new here. Thanks for this thread, I have my exam tomorrow and I find a lot of tips and tricks here that my professor didn't even mention it :) Thanks
     
  21. MatterLink

    MatterLink

    Joined:
    Feb 27, 2018
    Posts:
    5
    The bug has been reported with the project folder attached.
     
    rustum likes this.
  22. Ellukitas_123

    Ellukitas_123

    Joined:
    Jan 20, 2021
    Posts:
    21
    That's a good new, but is VFX graph compatible with OpenGLES 3.x? Because, I'm having troubles with Vulkan at the moment
     
  23. NotEvenTrying

    NotEvenTrying

    Joined:
    May 17, 2017
    Posts:
    43
    Hi guys, I've just been experimenting with modifying the forward renderer to see if its possible to get 2d lights to work in there, but I'm having trouble figuring out where the issue is that is causing the 2d lights to not show up in any way, even when enqueing the 2d light rendering pass after every other queue throughout the entire queue; So my question is, is it impossible due to some limitation internally in the engine, or am I missing some step somewhere to get the lights to show up? Not too worried about having it look "correct" yet, I just want it to show up in one form or another so I have a general direction to take it :D At the moment I've only moved over the 2d light render pass and the 2d light culling pass over from the scriptable renderer, along with tweaking the light 2d scripts to still point to a 2d renderer data scriptableobject even when the current active one is the forward renderer scriptableobject.
     
    NotaNaN likes this.
  24. NotEvenTrying

    NotEvenTrying

    Joined:
    May 17, 2017
    Posts:
    43
    An update; the lights showed up after I removed the forward renderer's transparent pass! Looks like pretending to know what I'm doing for long enough is bound to work sooner or later :cool:
     
    NotaNaN likes this.
  25. unity_C539A8DC489DA63D0734

    unity_C539A8DC489DA63D0734

    Joined:
    Jan 25, 2022
    Posts:
    1
    This is the great feature added in 2D Graphics features in Universal Render Pipeline (URP). It's a great update done in the field of technology
     
  26. Hesam_BB

    Hesam_BB

    Joined:
    Jan 15, 2022
    Posts:
    1
    I would Like to render 3d Character in (URP) with standard shader is it possible to use standard shader or not ?
    if its possible please let me know how can I do this.
     
  27. Angurvadal

    Angurvadal

    Joined:
    Jul 19, 2013
    Posts:
    11
    I've been searching all day for a solution for the following setup but I can't seem to make it work.
    Some context : a 2D platformer game with 2D Renderer on and we'd like to have 3 layers of cameras ticking background / ground / foreground. I tried with camera stacking (base + overlays) and with all bases (and setting priorities).

    The problem is : the blur (kawase from the sample for example) from the foreground will be applied to all cameras behind (ground and background). I didn't find a way to have custom renderer feature affect only one camera. Is this possible ? Like we had camera depth before ?

    On another topic :
    - the camera sorting layer is pretty cool but it'd be even cooler to have the other boundary of the layers (so that it could be used on only specific layers) or even select them ? Or maybe I didn't totally grasp the Heat Haze sample ^^
    - an overlay camera seems to need "default" mask + whatever the mask you're trying to have otherwise you just have a black silhouette of the sprites of said mask
     
    znagler and RemDust like this.
  28. kayroice

    kayroice

    Joined:
    Feb 7, 2017
    Posts:
    49
    Have you tried using URP's Post-Processing Volumes? They might achieve what you're trying to accomplish. Unfortunately I don't think they support custom volume overrides like HDRP, so you will be limited to the post-processing effects currently supported by URP. It'd be nice to get an update on when URP will support custom volume overrides.
     
  29. Angurvadal

    Angurvadal

    Joined:
    Jul 19, 2013
    Posts:
    11
    Yeah they aren't well supported. Anyway the PP would be DoF but we're using the 2D pipeline and we need only a few layers to be down sampled / blurred (at least one in the foreground and one in the background but ideally 3 in each)
     
  30. NotEvenTrying

    NotEvenTrying

    Joined:
    May 17, 2017
    Posts:
    43
    May be worthwhile blurring them per-object with a shader instead, assuming you dont have thousands of blurred objects on-screen. 2D sprite shaders don't write to depth, so for DoF to work you would need to use an opaque cutout shader that clips edges based on alpha, but thats obviously going to mess up soft edges and semi-transparent areas. I suppose a third alternative would be to render your blurred foreground into a transparent rendertexture instead, and then overlay that rendertexture in screen space?
     
  31. Angurvadal

    Angurvadal

    Joined:
    Jul 19, 2013
    Posts:
    11
    Yes, well we have a multitude of objects so the blur per camera was really efficient.
    DoF wont work indeed (we have transparency and cutout isn't an option).
    So yeah, we are making cameras output into rendertexture so that it's tweakable but the level art becomes a bit more tedious ahah.
    Thanks to you both for the ideas tho =)
     
  32. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,511
    Did you figure it out? Because it is possible. You create a different Renderer2DData asset which has the RendererFeature you want to be unique to that camera. Then assign that asset to the camera.
     
    RemDust and rustum like this.
  33. tecbug

    tecbug

    Joined:
    Nov 19, 2015
    Posts:
    16
    How to upgrade 2D project (that's using standard renderer) to URP? There was option such as "Upgrade Scene to 2D Renderer" or "Convert All Built-In Materials to URP" under Edit options. I can't find it in Unity 2021.2.13f1.

    [Edit]

    I found it. It's under Window > Rendering > Render Pipeline Converter
     
    Last edited: Feb 25, 2022
  34. ChildsGame

    ChildsGame

    Joined:
    Dec 30, 2018
    Posts:
    2
    Hello, I am looking into choosing a suitable pipeline for a project I am working on, but I can't find any performance comparisons between URP in the InBuilt. I read a few posts about URP claiming it has stability problems on mobile, but I couldn't find any patch notes about it in the year since those posts. Are there any performance comparisons of the two pipelines you can offer?

    Thanks a lot in advance for all the help!
     
    AwkwardPanda, EvOne and tecbug like this.
  35. skulllism

    skulllism

    Joined:
    Feb 26, 2015
    Posts:
    8
    Hello, I am working on the project using Unity 2D renderer. Since our project is a 2D project aimed at semi-realistic graphics, we would like to express the effect with a forward rendering. However, the Unity 2D project is having a hard time because it does not support forward rendering. Is there any progress in your research?
     
  36. Beachhairsalon

    Beachhairsalon

    Joined:
    Mar 11, 2022
    Posts:
    2
    This is great !
     
  37. this-Array

    this-Array

    Joined:
    Jun 11, 2013
    Posts:
    13
    Is there a reason why 2D Light's affected sorting layers are not exposed?
     
    EvOne likes this.
  38. DrXan

    DrXan

    Joined:
    Jan 20, 2020
    Posts:
    1
    After creating a new 2D URP project in 2021.2.19, every time I try to change Color Space to Linear, Windows throws a "Unity has terminated" error. If create a 2D project without URP, you can easily change the Color Space in it. But if you install the URP, the error will reappear. On 2020.3.17 all this works fine. What could be the problem?
     
  39. juicedup

    juicedup

    Joined:
    Aug 18, 2019
    Posts:
    47
    is it possible to grab the shadow texture that the 2D lights create in order to customize how shadows are rendered?
     
  40. ccfoo242

    ccfoo242

    Joined:
    Oct 9, 2014
    Posts:
    85
    I have a dumb question. I'm looking at the 2D Renderer Samples and I can't figure out how the normal map is being applied in the _NormalMaps scene. Can someone enlighten me?
     
  41. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    theres an extra channel in the sprite editor
     
    ccfoo242 likes this.
  42. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    @rustum will directional lighting be added to 2D graphics URP?

    I'd really like to use this setup for normal mapped sprites but this omission is hard to work with.
     
    KnuckleCracker likes this.
  43. kayroice

    kayroice

    Joined:
    Feb 7, 2017
    Posts:
    49
    @rustum, I noticed that there are some Tilemap API updates on your roadmap, specifically addressing animation functionality. I was wondering if you could add the ability to start/stop the animation on a specific Tile (addressable by cell position on the Tilemap) to the roadmap. There's a thread about that functionality here. My use case, and I believe the use case of other users in that thread, is we need to either start or stop the animation on a specific Tile at a specific cell position during runtime. Thanks.
     
    dannyalgorithmic likes this.
  44. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,511
    @kayroice Is this what you're looking for?

    2022.2 https://unity3d.com/unity/alpha/2022.2.0a13
     
    kayroice likes this.
  45. kayroice

    kayroice

    Joined:
    Feb 7, 2017
    Posts:
    49
    @Lo-renzo, yes possibly, thanks for pointing this out! I'm specifically interested in the TileAnimationFlags.PauseAnimation (is there a corresponding flag that will start the animations back up?). Unfortunately it's unclear if you can set these TileAnimationFlags on a per Tile basis (with a call to a cell position on a Tilemap), or if they operate only at the Tilemap level and thus set the flag for all Tiles on a Tilemap (I suspect the latter). For my use case I need to be able to turn animations on/off per Tile based on cell position. Maybe @rustum can clarify whether the new Tilemap APIs will allow for granular settings per Tile, or if they strictly operate on all Tiles on the Tilemap.
     
  46. juicedup

    juicedup

    Joined:
    Aug 18, 2019
    Posts:
    47
    why don't 2d shadows show the silhouette/shape of the sprite on the ground where the shadow is being cast?
    it's just straight lines
    will this be a feature that will be added?
     
  47. PBKitty

    PBKitty

    Joined:
    Dec 23, 2021
    Posts:
    45
    Is there a list somewhere of all features that are supported or not supported by the 2d and 3d renderers?
     
    EvOne likes this.
  48. nicmarxp

    nicmarxp

    Joined:
    Dec 3, 2017
    Posts:
    406
    Hmm, i copied the "Heat wave" shader from the samples, into my project but i only get a gray square. I've checked the camera and 2d renderer settings to be the same.

    Is there anything else I could have missed to get it working? Thanks! :)
     
    EvOne likes this.
  49. RemDust

    RemDust

    Joined:
    Aug 28, 2015
    Posts:
    432
    It's frustrating but it gives hope to see someone has been able to find a solution for this xD
     
  50. rustum

    rustum

    Unity Technologies

    Joined:
    Feb 14, 2015
    Posts:
    190
    Hi @nicmarxp! Have you checked that you are using the right Sorting Layers and that the CameraSortingLayerTexture on the 2D Renderer is set to the correct one?
    In the samples, the Heat Haze Overlay sprite renderer is set to the Overlay sorting layer. This sorting layer draws in front of everything else in the scene. In the 2D Renderer Data, in the Camera Sorting Layer Texture section, the Foremost Sorting Layer is set to the front-most sorting layer that we want the overlay to distort, in this case Player.