Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Unity 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:
    164
    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.
     
    GliderGuy and APSchmidt like this.
  2. rustum

    rustum

    Unity Technologies

    Joined:
    Feb 14, 2015
    Posts:
    164
    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.
     
    EvOne, pahe, GliderGuy and 1 other person like this.
  3. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,363
    Does vfx graph support includes lit mode?
     
    kyuskoj, Jamez0r and pahe like this.
  4. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    509
    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, GliderGuy and MousePods like this.
  5. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,363
    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. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    650
    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
     
    GliderGuy likes this.
  7. kayroice

    kayroice

    Joined:
    Feb 7, 2017
    Posts:
    26
    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?
     
    hawken, Ferazel, zfh2773 and 2 others like this.
  8. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    650
    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:
    575
    @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:
    164
    @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.
     
  11. Nikaas

    Nikaas

    Joined:
    May 30, 2013
    Posts:
    111
    @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:
    44
    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.
     
    Nikaas likes this.
  13. xiao-xxl

    xiao-xxl

    Joined:
    Nov 16, 2018
    Posts:
    38
    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:
    575
  15. xiao-xxl

    xiao-xxl

    Joined:
    Nov 16, 2018
    Posts:
    38
    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.
     
  17. kennyy_

    kennyy_

    Unity Technologies

    Joined:
    Apr 7, 2021
    Posts:
    44
    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.
     
  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:
    44
    @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:
    19
    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:
    34
    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.
     
    GliderGuy likes this.
  24. NotEvenTrying

    NotEvenTrying

    Joined:
    May 17, 2017
    Posts:
    34
    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:
     
    GliderGuy likes this.
unityunity