Search Unity

Unity Experimental 2D Lights and Shader Graph support in LWRP

Discussion in '2D Experimental Preview' started by rustum, May 24, 2019.

  1. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    769
    You were right on. I don't know how I missed this, thank you!
     
  2. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    86
    You can actually use z and a perspective camera if you want. If you don't want to do that, you can choose to scroll the layers themselves.

    Btw, how are you using the other camera's to do parallax scrolling?
     
    doarp and blavatsky like this.
  3. blavatsky

    blavatsky

    Joined:
    Sep 23, 2019
    Posts:
    18
    the first camera is setup to only see the default layer, and depth set to 0. The other camera has a larger lens, depth at -2, and only sees the background layer. So it's kind of a fake parallax vs. moving the layers. They are both orthographic. Maybe perspective cameras would be a better route, I just did it that way based on a YouTube tutorial.
     
  4. blavatsky

    blavatsky

    Joined:
    Sep 23, 2019
    Posts:
    18
    SUCCESS! I finally got the point light to show, it was a combo of z-index and not doing parallax the way I was before, just one layer now. Thank you for the suggestions! Do you guys think this is a good way to do layers (skip to around 14:00)? For some reason on my scene it's a little herky-jerky with the movement, but for this guy it looks very smooth. Could be my cheap HDTV as monitor though.

     
    Last edited: Nov 25, 2019
  5. blavatsky

    blavatsky

    Joined:
    Sep 23, 2019
    Posts:
    18
    OK last post, sorry just learning. Do any of you guys get this pixel-line tracer thing from point light? Is it a setting?
    Please ignore the art/graphics, just a fast test scene.
     

    Attached Files:

  6. SoerenBachNielsen

    SoerenBachNielsen

    Joined:
    Dec 27, 2012
    Posts:
    47
    Hey! So I'm using the 2D Renderer inside the URP (and also pixel perfect). I'm trying to get a GrabPass of the camera from _CameraOpaqueTexture but it's throwing me a bunch of errors:

    Code (CSharp):
    1. Shader properties can't be added to this global property sheet. Trying to add _CameraOpaqueTexture (type 3 count 1)
    I have Opaque Texture enabled in my RenderPipelineAsset. Am I doing something wrong, or is this simply not possible? How else would I get a screen grab of the current frame?

    https://docs.unity3d.com/Packages/c...s.universal@7.1/manual/universalrp-asset.html

    The documentation states here that this should be the way to do it, although it does say it's not safe to assume it works for the 2D renderer.

    Thanks in advance.
     
  7. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,672
    I don' know if I have a 'case', but I have a shader pack of shader graph-based shaders, I have to recommend the use of a render pipeline, and I'd like to be able to tell people that can use it with lightweight or HD pipelines. Otherwise it seems limiting because some of the shaders are designed for use in 3D, some are 2D.

    Don't think you an HD bells and whistles pipeline should AT LEAST be able to render basic 2D objects in some fashion? Because now what happens is if people choose to use the HD render pipeline they cannot use some of my shaders because they'll get no output at all.
     
  8. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    86
    So the 2D Renderer is an alternative to the Forward renderer in URP. The Forward renderer can render sprites, but it won't be able to use the features supported by the 2D Renderer.

    Likewise, HDRP can render sprites as well, it just won't have some of the features that the 2D Renderer has.
     
  9. grolschie

    grolschie

    Joined:
    Nov 19, 2019
    Posts:
    3
    Hello. Just some feedback on LWRP 6.9.2 and questions from a Unity noob. :)

    I have now implemented 1x global light and 1x point light in my project using LWRP. I have had some issues though:
    1. Edit -> Render Pipeline -> Lightweight Render Pipeline -> 2D Renderer -> Upgrade Scene to 2D Renderer, does not convert Anima2D SpriteMeshes. One has to manually add the Sprite-Lit-Default material to every SpriteMesh manually.
    2. The point light worked in edit mode, but seemed not to in play mode. It turns out the default Z position was not in my camera's view. A common gotcha. Perhaps a better default Z value might help newbies?
    3. Mobile performance is abysmal with just these 2 lights. My Dell XPS 13 with on-CPU graphics runs the project well, but not so with my Huawei P10 Lite. Are there any RWRP settings to significantly improve mobile performance? Thanks in advance.
    Thanks for reading. :)
     
  10. dc5774

    dc5774

    Joined:
    Feb 1, 2014
    Posts:
    22
    Hi, just noticed that the sorting layer target field on the Light2D class is not exposed in the API so i can't set it via script? Is there any chance we could get access to this in a coming update?

    Or am i blind and somehow can't find a way to set it in code?
     
  11. nantoaqui

    nantoaqui

    Joined:
    Oct 1, 2014
    Posts:
    28
    Just hit a wall as well, tried to update `
    Light2D.shapeLightFalloffOffset` via script but it has no setter.
     
  12. Preshu

    Preshu

    Joined:
    Feb 3, 2016
    Posts:
    8
    Hey Guys, Is there a known issue with 2D shader graph and Intel integrated graphics?
    The simple noise node is looking wierd on editor and builds (only with intel in windows).

    it looks like this:
     
  13. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    86
    I've added these to my next sprint to fix, but I'll try to fix them sooner if I have time. Not sure when you will get these changes since I have little control over when Universal RP is released
     
    dc5774 likes this.
  14. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    86
    So a while back LWRP was renamed to Universal RP. Some of these issues were fixed.

    With that said, the performance is being worked on. But one thing you can do right now is to reduce your Render Texture Scale in the Renderer2DData. The smaller the value the faster things will run, but the more visual effect it will have. From testing 0.5 seems like a value that you will probably not notice much difference, but depending on your scene and lights you may be able to reduce it much more than that.
     
    dc5774 likes this.
  15. dc5774

    dc5774

    Joined:
    Feb 1, 2014
    Posts:
    22
    Thanks!
     
  16. DarylWinters

    DarylWinters

    Joined:
    Jan 23, 2019
    Posts:
    1
    Hi! Is there a way to edit/set via script the vertex positions of a freeform light ?
     
  17. Rezrael

    Rezrael

    Joined:
    Nov 11, 2014
    Posts:
    2
    I'm liking this. I get reflections on the camera though I think I saw somewhere in here that is a bug. The lights shouldn't reflect on the camera background right? If its not in the layers selected. Anyway cool tech can't wait for shadows and such.

    cool.png
     
  18. janimator

    janimator

    Joined:
    Apr 5, 2013
    Posts:
    32
    Is there a way for me to write a shader that will allow my custom mesh to take advantage of the new 2D render pipelines features? Specifically the normal mapping.
     
  19. THE_MEDICI

    THE_MEDICI

    Joined:
    Apr 8, 2018
    Posts:
    45
    1. Is shadow casting any closer? In particular I'm wondering about Tilemaps (Isometric). Maybe kinda like this.
    2. Seems like I'm jumping the gun, but is there any way to get use a custom Transparency Sort Mode with Custom axis for 2D lights? I'm in the 2D Renderer sample project and am not seeing any way to do this, which blocks many isometric projects b/c I can't sort GameObjects against stuff on the tilemap. I was hoping for a setting on the 2D Renderer Data.
     
    Last edited: Dec 6, 2019
  20. pahe4retro

    pahe4retro

    Joined:
    Aug 13, 2019
    Posts:
    30
    There is already a shadow caster component. See 2D light video from Unite Copenhagen.
     
  21. novello_io

    novello_io

    Joined:
    Nov 22, 2009
    Posts:
    293
    Is the roadmap published somewhere? Support for custom shaders (shader graph?), or at least support for specular? (
    )
     
  22. CoreyHUN

    CoreyHUN

    Joined:
    Dec 11, 2014
    Posts:
    6
    Any chance to see the shadow casters to deform with rigged sprites?
     
  23. BartekSalata

    BartekSalata

    Joined:
    Jan 23, 2014
    Posts:
    8
    Any idea when the shadow part of the 2D lighting will be in as a package? I'm liking the 2D lights for their simplicity and performance, but now I'm wondering about the shadows. I've seen in some places it mentioned that shadows will come in later this year, but this year is ending soon lol... so I'm just wondering when that may occur. I'm developing my game in hopes that by the time its near done the shadow portion of the 2D lighting might be available in 2019.2 : )
     
  24. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    537
    Is there some offset property for sprite light? Shadows are cast from pivot, but you have no control over the sprite position. upload_2019-12-7_11-49-23.png
     
  25. CoreyHUN

    CoreyHUN

    Joined:
    Dec 11, 2014
    Posts:
    6
    Its in the latest 2019.3 beta version, I installed it and tada the shadows are there.
     
    idurvesh likes this.
  26. BartekSalata

    BartekSalata

    Joined:
    Jan 23, 2014
    Posts:
    8
    For fear of a buggy beta version... i was hoping it would be part of the LWRP package rather than the unity 2019.3 build... that said, any Unity Dev can confirm that this will be the only way to access them? Or will waiting eventually bring them to 2019.2? My game is in early development at the moment, so I can wait a few months...
     
  27. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    251
    We don't plan to backport shadows support to LWRP. The final release of 2019.3 is almost upon us and we encourage you to try out 2019.3 and Universal RP.
     
  28. BartekSalata

    BartekSalata

    Joined:
    Jan 23, 2014
    Posts:
    8
    Going forward and porting over to 2019.3 from 2019.2.15 hopefully wont bring me any bugs, but fair enough will definitely do this : P
     
  29. novello_io

    novello_io

    Joined:
    Nov 22, 2009
    Posts:
    293
    Is there a way to do one of the following?:

    A) Support seeing 2d lights along with 3d models at the same time?
    or
    B) Hot swap between rendering pipelines via code? (the below image shows how im currently doing it, even at runtime, but I don't know how to access this in code.
    upload_2019-12-10_10-59-50.png

    This would greatly increase my workflow.

    Thanks!
     
  30. pahe4retro

    pahe4retro

    Joined:
    Aug 13, 2019
    Posts:
    30
    Haven't tested it, but I think you should take a look at this: Rendering.GraphicsSettings
     
  31. seffles

    seffles

    Joined:
    Oct 2, 2013
    Posts:
    29
    Is there an ETA for URP supporting custom post-processing effects yet? It's the main thing that's keeping me on 2019.2 and 2D LWRP.
     
  32. diesersam

    diesersam

    Joined:
    Sep 15, 2018
    Posts:
    2
    I'm testing the newest version 2019.3 and trying to add normal maps to my sprite for 2D Lighting. Sprite was imported with PSB Importer and it is a rigged sprite. I don't see any way to add normal maps to my sprite, because it is displayed as a sprite sheet. So, in "Secondary Textures" I can only add one normal map, which goes over all the sprite sheet. But I cannot provide a normal map in this format, because the sprite sheet was created by Unity PSB Importer. And there is no way to provide individual normal maps for each layer. :(
     
  33. Naves

    Naves

    Joined:
    Oct 7, 2014
    Posts:
    1
    Any plans to make shadow casting work automatically with tile maps? My game uses them and I have a specific ceiling layer, which is the layer I want to be casting shadows. It's just not practical to redraw the shadow caster shapes by hand with every tile update.

    That aside, the 2d lights are looking great!

    Edit: Also, are you guys ever going to expose the shape path for the freeform lights? Determining the light shape via script would be fine for my game too, instead of using the shadow casters...
     
    Last edited: Dec 11, 2019
  34. novello_io

    novello_io

    Joined:
    Nov 22, 2009
    Posts:
    293
    Thanks!
    So I can get access to my render pipeline asset like:
    public class RenderPipelineSwapper : MonoBehaviour
    {

    public RenderPipelineAsset Pipeline3D;
    public RenderPipelineAsset Pipeline2D;

    -But where/how do I assign these?
     
  35. SoerenBachNielsen

    SoerenBachNielsen

    Joined:
    Dec 27, 2012
    Posts:
    47
    Hey!

    Any ETA on when GrabPass/SceneColor will work with the 2D renderer?
     
  36. Yuri-Macedo

    Yuri-Macedo

    Joined:
    Oct 9, 2013
    Posts:
    4
    Anyone's figured out how to work out Blur filters with this Renderer?
     
  37. idurvesh

    idurvesh

    Joined:
    Jun 9, 2014
    Posts:
    493
    I updated my project to 2019.3 but I cant't see the shadows...How does it work?
     
  38. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    86
    Rendering 3d models with 2d lights is something we plan to do but it's hard to give you a time frame on this.
     
  39. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    86
    This is also on our list. It should be something easy to put in. Hopefully, I can get a chance to work on it early next year sometime.
     
    SoerenBachNielsen likes this.
  40. zIyaGtVm

    zIyaGtVm

    Joined:
    Dec 27, 2017
    Posts:
    85
    Hi, I noticed that RenderPipelineAsset has a Renderer List.
    However my shaders for 3dmeshes works fine only when the second Renderer is active.
    Could I make two Renderers take effect at the same time?Thanks

    7.png
     
  41. doarp

    doarp

    Joined:
    Sep 24, 2019
    Posts:
    130
    While the new 2D renderer and lights look pretty awesome, I’m not sure I understand their benefits over the regular 3D renderer with 3D light and sprites with normal maps.
    Is the big gain here in performance? If so I would love to see a benchmark.
    Or is it the ability to use more interesting 2D lights?
    Or something else?
    If I start a new 2D sprites only game, what should be my consideration in choosing a render pipeline?
     
  42. novello_io

    novello_io

    Joined:
    Nov 22, 2009
    Posts:
    293

    with your setup and

    Edit -> RenderPipeline -> URP -> Upgrade project materials

    I'm able to see 2d and 3d assets with proper 2d lighting. Finally! Thanks for nudging me in the right direction :)
     
  43. zIyaGtVm

    zIyaGtVm

    Joined:
    Dec 27, 2017
    Posts:
    85
    Thanks, I'v already tried this option however it only works with few builtin shaders. Most of my shaders(materials) were not upgraded:(.I got tons of warnings just like this:
    Code (CSharp):
    1. ... material was not upgraded. There's no upgrader to convert Universal Render Pipeline/2D/Sprite-Lit-Default shader to selected pipeline
    2. UnityEditor.Rendering.Universal.UniversalRenderPipelineMaterialUpgrader:UpgradeProjectMaterials() (at Library/PackageCache/com.unity.render-pipelines.universal@7.1.6/Editor/UniversalRenderPipelineMaterialUpgrader.cs:22)
    3.  
     
  44. novello_io

    novello_io

    Joined:
    Nov 22, 2009
    Posts:
    293
    Yeah I think we're probably gonna need to make new shaders? I'm trying to figure out how to incorporate specular maps into the pipeline right now. I don't know if those are supposed to behave like the secondary textures shown here:
    upload_2019-12-22_15-45-27.png

    or if I need to make some new shader to incorporate them.

    or if my only option right now is to somehow bake the specular data into the normal map by doing an operation on the normal map pixel based corresponding specular map pixel, and making it so that black on the specular produces the standard 128,128,255 "normal purple" and white on the specular map makes it whatever the base normal should have been and everything in between is interpolated accordingly.

    I'm not even sure if this would get the desired result. But I'm basically looking to do this:
    upload_2019-12-22_15-53-25.png

    Just need to add the specular :)
     
  45. novello_io

    novello_io

    Joined:
    Nov 22, 2009
    Posts:
    293
    Oh and Happy Holidays to everyone here and especially all the Unity devs that have been grinding it out on this new 2D lighting system. I know RT3D is the buzzword these days but I really appreciate all the time spent on making Unity an incredibly versatile engine.
     
    Chris_Chu and doarp like this.
  46. XxPleYxX

    XxPleYxX

    Joined:
    Jul 26, 2011
    Posts:
    25
    Is there any way to mask a 2d light?
     
  47. mahu

    mahu

    Joined:
    Apr 6, 2014
    Posts:
    5
    Hello, I couldn't find any info or way to do this. Is there any way I can control the 2d light/sprite sorting (Freeform/Parametric/Point) without having to change layers?

    For example, the two images below, I would control the sprite sorting using the Y axis, so when the character Y is under the light Y, he should be in front of the light. Is there any config I could use for this right now?

    Thanks in advance.

    upload_2019-12-25_23-31-51.png
    Fig 1. Light in front of character.

    upload_2019-12-25_23-32-1.png
    Fig 2. Character shouldn't be affected by light (he is in front of it)
     
  48. FreeZucchini

    FreeZucchini

    Joined:
    Jan 1, 2019
    Posts:
    1
    Why aren't tilemaps affected by the 2d lights?
     
  49. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    86
    Not at the moment.

    Not at the moment. But coming soon...ish, you will be able to do camera stacking with different renderers. This will allow some of your stuff to be rendered with the URP forward renderer, and some of your stuff to be rendered with the 2D renderer.

    This should work. Check that your tilemaps are using the Sprite-Lit-Default material.

    Also, if you created this after installing Universal RP, you may want to check to see that you have setup the 2D renderer properly, as this material should be assigned automatically if everything is properly setup.
     
  50. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    86
    Sorted lights like this aren't currently supported.
     
unityunity