2D Graphics (URP 12) released for Unity 2021.2

2D Graphics (URP 12) released for Unity 2021.2

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

  • Install latest Unity 2021.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.

2 Likes

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
7604098--944158--VFX Graph.png
This shows the 2D Renderer working together with VFX Graph.

Emissive
7604098--944155--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


This shows support for Renderer Features in the 2D Renderer. It uses a Scriptable Renderer Feature to create a fullscreen blur.

5 Likes

Does vfx graph support includes lit mode?

4 Likes

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.

3 Likes

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.

4 Likes

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
1 Like

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?

5 Likes

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.

1 Like

@kayroice & @enhawk 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!

@kayroice & @enhawk 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.

5 Likes

@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.

Hi @Nixaan , 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.

1 Like

Add opaque sprite and better sprite mesh to reduce overdraw.is it possible?

@xiao-xxl Have you tried the following two tools to improve/customize your Sprite meshes?

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.

1 Like

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:
7670290--958012--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:
7670290--958036--upload_2021-11-19_3-40-36.png

I found these same bugs when I first tried 2021.2.0.

1 Like

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.

1 Like

@kennyy Are the issues I mentioned in my last post known? I couldn’t manage to find anything on the issue tracker.

@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!

1 Like

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 :slight_smile: Thanks