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 Experimental 2D Lights and Shader Graph support in Universal RP (previously LWRP)

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

  1. DreadKyller

    DreadKyller

    Joined:
    Oct 30, 2015
    Posts:
    2
    Hello, I'm using SpriteShape in a project of mine, which depends on the "com.unity.2d.path" package. This package seems to conflict with the LWRP 2D renderer:

    GUID [c69472069f4ff5e4b9db75c91210288f] for asset 'Packages/com.unity.render-pipelines.lightweight/Editor/2D/ShapeEditor/EditablePath' conflicts with:
    'Packages/com.unity.2d.path/Editor/EditablePath' (current owner)
    We can't assign a new GUID because the asset is in an immutable folder. The asset will be ignored.


    Because the asset becomes ignored there are many errors saying the various scripts can't be found and as such the 2D Renderer doesn't show up under the Create -> Renderer -> Lightweight Render Pipeline

    Edit: For now I'll manually change the GUID's in the com.unity.2d.path package, but it'd be nice if these could be changed, should be a relatively simple change.

    Edit: Nevermind, seems reloading the project resets all the files to the ones from the package manager. Honestly this also begs the question why even package the whole 2D Path package into the LWRP instead of using the existing package as a dependency and adding any missing features to that to expand it instead?
     
    Last edited: Jun 18, 2019
  2. Dinamytes

    Dinamytes

    Joined:
    Nov 3, 2016
    Posts:
    51
    After Shadows i can start developing :) dont want to point to an opaque object and see the other side.
     
    foxnne likes this.
  3. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    335
    The reason why we copied the entire Path package into LWRP is that we don't want more package dependencies for LWRP, which can get out of hand when these dependencies are being updated frequently. This is only a temporary solution, eventually we'll figure out a better way to handle this.

    For now we'll regenerate those meta files in the next version refresh of the 2D renderer.
     
    DreadKyller likes this.
  4. DavidNLN

    DavidNLN

    Joined:
    Sep 27, 2018
    Posts:
    90
    @Chris_Chu
    I'm playing around with shadergraph 2d support using the sprite lit master shader base.
    I'm trying to achieve some kind of sprite intersection like you can do in 3d with scene depth.
    I was able to do something similier with a sprite mask:
    upload_2019-6-18_20-28-0.png
    But I think it will look much better if I could use a shader here instead.
     
    Storm4_, zIyaGtVm and foxnne like this.
  5. KaiHelenius

    KaiHelenius

    Joined:
    Oct 7, 2018
    Posts:
    2
    I have my own shader for most my sprites that controls the special art qualities of my game, so how can I recreate the 2D Light shader so that I can combine it with my custom shader. (using shader graph).
     
    foxnne likes this.
  6. Adeel13

    Adeel13

    Joined:
    May 25, 2019
    Posts:
    2
    in scene view all 2d lights work fine but in game view only 2d global light works
    :mad::mad::mad::mad:
     
  7. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    257
    I'll try to remember this use case when we start planning for our tilemap lighting/rendering improvements. If it seems like something people want we can look at maybe adding support for depth textures.

    If the original shader is using shadergraph you can replace the master node with a sprite lit master node. Otherwise you'd have create a modified version of the Sprite-Lit-Default.

    Check the z on your lights. Your z values may be outside the view frustum.
     
  8. Coffein

    Coffein

    Joined:
    Jan 22, 2016
    Posts:
    19
    Thank you guys for this package, much appreciated.
    One thing I noticed is that if you disable Anti-Aliasing in the pipeline and the post-processing layer the post processing seems broken.
    Also, is it planned to expose some properties of the light calculation in the shader graph master node? For example to allow cel shaded lighting?
     
    DreadKyller likes this.
  9. DreadKyller

    DreadKyller

    Joined:
    Oct 30, 2015
    Posts:
    2
    I would imagine in its current state no. The lighting is calculated within the sprite lit master node, so the lighting calculations wouldn't be available to any nodes before it. I'm not a developer for unity so I can only speculate, for all I know they could add a node that processes the lighting information, that you can use in your setup and then pass the lighting information from that node into the sprite lit master node, but I don't know what the system is like under-the-hood. I too would be interested to hear about the developers thoughts on this.
     
  10. DavidNLN

    DavidNLN

    Joined:
    Sep 27, 2018
    Posts:
    90
    @Chris_Chu when will we get a detailed documentation specifying what can and cannot be done with new 2d-renderer ?
    Also it would be great if we could get some pointers for how to go around extending the new lit and unlit shaders for features that are not yet implemented in shader-graph (such as usage of the stencil buffer)
     
    Storm4_ and foxnne like this.
  11. PrettyFlyGames

    PrettyFlyGames

    Joined:
    Aug 30, 2012
    Posts:
    74
    Wow this is awesome! Is there an ETA for the tilemap fix so we can see the tiles in the palett view?
     
  12. seffles

    seffles

    Joined:
    Oct 2, 2013
    Posts:
    32
    Does the Scene Color Node in Shader Graph work with the experimental 2D LWRP renderer? I'm trying to upgrade my old GrabPass effects and I'm having no luck.
     
  13. LittleCodingFox

    LittleCodingFox

    Joined:
    Jul 2, 2015
    Posts:
    11
    Hi, I can't seem to be able to create lights or pick the lit material? I have prefabs that were upgraded but have their materials set to (None), and when I try to create a 2D light, nothing happens. The option isn't enabled when I try to create through the GameObject menu at the window title. I would appreciate some help!
     
  14. PrettyFlyGames

    PrettyFlyGames

    Joined:
    Aug 30, 2012
    Posts:
    74
    This happened to me also, make sure that you have assigned the scriptable rendering pipeline user Project Settings-> Graphics.
     
    LittleCodingFox likes this.
  15. XxPleYxX

    XxPleYxX

    Joined:
    Jul 26, 2011
    Posts:
    41
    Do the sprite mask work in LWRP? I can not make it work...
     
  16. mountblanc

    mountblanc

    Joined:
    Sep 24, 2015
    Posts:
    93
    I haven't had success ether.
     
  17. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    173
    It seems to be working fine...
    2019-07-01_19-36-47.png LWRP_and_SpriteMask_01.gif
     
  18. Coffein

    Coffein

    Joined:
    Jan 22, 2016
    Posts:
    19
    EvOne likes this.
  19. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    173
    Ah! -Specific branch for 2DRenderer! Sorry!
    In the comments with questions was not explicitly said about...
    And the "whole picture" -I did not notice :(:D
     
  20. mountblanc

    mountblanc

    Joined:
    Sep 24, 2015
    Posts:
    93
    No harm done ;-) We have so many Unity versions combined with so many packages and different package versions for different unity versions that its hard to keep track :confused:
     
    EvOne likes this.
  21. f1gment

    f1gment

    Joined:
    Nov 22, 2018
    Posts:
    16
    I can't seem to apply the lit material to tiles on a tilemap. I know there's the thing with tiles not showing up in the tile editor, but I mean in the Tilemap Renderer component in the inspector. I don't have that as an option.
     
  22. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    257
    Hey, sorry for letting the questions pile up, I've been away for the last week.

    The tilemap issue I am hoping to get in this week. I have the fix, but if I can't get it into LWRP this week, it may be delayed.

    I'm not sure about the Scene Color Node, but I believe there is an issue with grab pass. Right now the grab pass isn't supported, but this is something we will work on fixing soon.

    Hm. This is something we did test a while back, it possibly got broken at some point. If it is broken, this is something that we will try to fix, but at the moment I don't have an eta on it.
     
    seffles likes this.
  23. f1gment

    f1gment

    Joined:
    Nov 22, 2018
    Posts:
    16
    Superb. I hope you were away for something fun.

    All I was seeing was that the tiles didn't show up in the palette, not that they couldn't be lit at all, and I was afraid I was missing something obvious.

    Thanks so much! I'll keep an eye out for an update.
     
  24. seffles

    seffles

    Joined:
    Oct 2, 2013
    Posts:
    32
    Thanks for the response, Chris_Chu. I was directed towards the Scene Color Node because GrabPass isn't working, and neither were the workarounds I'd seen. I ended up achieving the effect I needed using a (more efficient) post-processing shader. In a twisted way, I'm enjoying having to workaround the missing features. :)
     
  25. danielsullivan2000

    danielsullivan2000

    Joined:
    Aug 14, 2018
    Posts:
    1
    2D lights are good fun might try to work on a game where u avoid light based saws and other traps


    Capt ure.JPG
     
  26. Aelfieurin

    Aelfieurin

    Joined:
    Oct 27, 2017
    Posts:
    2
    I am having difficulties accessing the Light2D component via scripts. I am trying to make a pulsing light effect, so modifying the intensity field in Update. Can this be done currently, or am I just looking in the wrong way. I am using
    this.GetComponent<Light2D>().intensity

    but it is saying Light2D doesnt exist
     
    cparki3 likes this.
  27. PrettyFlyGames

    PrettyFlyGames

    Joined:
    Aug 30, 2012
    Posts:
    74
    I've played around with an old tilemap but I'm having issue with flickering while moving the camera. It appears that the new Sprite-Lit-Default is missing the option "Pixel snap" which seems to cause the flickering. Will you be adding this option to the shader or should we look into options with changing the tiles to workaround this?
     
  28. SirStompsalot

    SirStompsalot

    Joined:
    Sep 28, 2013
    Posts:
    112
    I'm also having issues with the tilemap not reflecting changes to lights. I expected this, given that this has been covered several times in this post. Global lights are working nicely with tile entities that are derived from prefabs (I didn't test further). I should point out that I create all tiles without using the tile palette.

    I did notice one error upon entering play:
    Code (CSharp):
    1. In order to call GetTransformInfoExpectUpToDate, RendererUpdateManager.UpdateAll must be called first.
    2. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    I'm not sure what is causing it, and can dig in further as required. I also noticed that overall my FPS is dropping sharply, I'm unsure if it's related to the error above.

    Overall, I'm really excited. I can see what you folks are doing and eager to see it fully realized.
     
    Last edited: Jul 4, 2019
  29. cparki3

    cparki3

    Joined:
    Jan 13, 2014
    Posts:
    41
    Yes! I need this too please. I would like to be able to access the points on a freeform light via script as well :)
     
  30. mountblanc

    mountblanc

    Joined:
    Sep 24, 2015
    Posts:
    93
    I use the following:
    Code (CSharp):
    1. using UnityEngine.Experimental.Rendering.LWRP;
    so getting the Light2D is no problem:
    Code (CSharp):
    1. m_Light = GetComponentInChildren<Light2D>();
    2. m_Light.intensity = 5;
    But i am using Unity 2019.3.0.a7

    p.s. if you are using assemblies then you need to add this as well:
    upload_2019-7-3_7-3-30.png
     
  31. Aelfieurin

    Aelfieurin

    Joined:
    Oct 27, 2017
    Posts:
    2
    Awsome thanks, I didnt know the include, or where to look it up!
     
    mountblanc likes this.
  32. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    335
    mountblanc likes this.
  33. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    335
    I believe you can use the Pixel Perfect Camera in LWRP to fix the flickering.
     
  34. xtytyx

    xtytyx

    Joined:
    Dec 29, 2017
    Posts:
    24
    I'd also like to generate sprite lights from a backend! So having the sprite variable accessible via script would be extremely required!
     
  35. blanktarget

    blanktarget

    Joined:
    Aug 28, 2017
    Posts:
    20
    configuring the 2d Renderer step is missing for me. There is no 2D Renderer listed. This is with a fresh install, new project and everything else up to that point worked fine. Thoughts?
     
  36. blanktarget

    blanktarget

    Joined:
    Aug 28, 2017
    Posts:
    20
    I found my problem, there is a conflict between this and the 2d Sprite Shape package. Having them both causes some really weird bugs and eventually broke everything, had to roll back to a previous version of my project to fix it, as removing one or the other all broke stuff so I guess not everything got removed properly.
     
  37. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    257
    There are a couple new fixes coming with the version of LWRP that will be out very soon. One will fix the compatibility issues with sprite shape. The second fix will be for the black tiles in the tile map palette.
     
    no-weekend likes this.
  38. seffles

    seffles

    Joined:
    Oct 2, 2013
    Posts:
    32
    Are there any plans for being able to change the blend mode of the sprite master nodes in shader graph? And if so, is there an ETA? Thanks.
     
  39. PrettyFlyGames

    PrettyFlyGames

    Joined:
    Aug 30, 2012
    Posts:
    74
    Correct it fixes the flickering but I need to be able to support split screen and currently the Pixel Perfect Camera doesn't seem to support this.
     
  40. PrettyFlyGames

    PrettyFlyGames

    Joined:
    Aug 30, 2012
    Posts:
    74
    Nevermind changing the code for the Pixel Perfect Camera to support split screen was easy, so just patched it.
     
  41. Scatabrain

    Scatabrain

    Joined:
    Aug 28, 2015
    Posts:
    18
    The LWRP is causing a ghost image that is flipped horizontally and the ghost is unlit.
    Any thoughts? All help appreciated. Cheers, Michael B

    This occurs on a sprite where I set the Material to a newly created material using the LWRP 2d default sprite shader.
    If I change the shader to a non LWRP 2d lit shader the ghost goes away and the sprite texture becomes unlit by the lwrp.

    In the example here the green line is in the texture. The other unlit line is not.

    If the image isn't showing, it is located here:
    http://michaelb.tv/images/ghostsprite.png

     
  42. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    257
    Hmmm. This isn't something I've seen before. Would you be able to submit a bug report with the project attached?
     
  43. Scatabrain

    Scatabrain

    Joined:
    Aug 28, 2015
    Posts:
    18
    yeah absolutely. thanks.
     
  44. Scatabrain

    Scatabrain

    Joined:
    Aug 28, 2015
    Posts:
    18
    (Case 1168255) Ghost image in Sprite texture in LWRP 2019.2.0b7

    thanks a ton. Michael B
     
  45. MehmetCakir

    MehmetCakir

    Joined:
    Jul 18, 2017
    Posts:
    5
    I have 2D point lamp with 13 outer radius and a black line appears under the light, it flickers when I move. Environment consists of tilemaps. I am a newbie so if it is a dumb mistake I have made, please excuse me :) Untitled_Project_First_Frame.png
     
  46. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    257
    MehmetCakir, this is not a dumb mistake. I believe there is still a bug with the point light when its set to 360 degrees. While this is something we intend to fix, you may be able to work around it by setting your light to be parametric, and increasing the number of sides.
     
  47. MehmetCakir

    MehmetCakir

    Joined:
    Jul 18, 2017
    Posts:
    5
    Yeah I did that when I encounter this problem, still wanted to be sure that it is not my mistake. Thanks!
     
  48. cparki3

    cparki3

    Joined:
    Jan 13, 2014
    Posts:
    41
    Screen Shot 2019-07-10 at 9.41.42 AM.png

    I've been playing around with the new lights and they are pretty great so far.

    I would really like to know if shadows or "light blockers" like this screenshot are on the roadmap as well.

    I'd love to be able to take the 2D point light and define a blocking layer that will not allow it to light the other side of objects. Even being able to set the points on the freeform light might allow for a 360 raycast based solution for this?
     
  49. HaroldReyiz

    HaroldReyiz

    Joined:
    Oct 20, 2017
    Posts:
    3
    Our game is 2D, but our "up" axis is Z instead of Y.
    Freeform and parametric 2D lights work when rotated and that is good. But point lights only work on the xy plane. Even if you rotate a point light, it does not affect any other plane. Only the XY plane.
    Is there a plan to fix this issue ? Seeing that other 2 light types work on all planes and axes, point lights being an exception seems bizarre.
     
  50. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    257
    Shadows are on the roadmap, they should be in later this year.

    I know what you mean. I'll take a look at this.