Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Feedback Wanted: Lightweight Render Pipeline

Discussion in 'Graphics Experimental Previews' started by phil_lira, Sep 28, 2018.

Thread Status:
Not open for further replies.
  1. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    2,184
    Thanks for a very comprehensive reply. I am glad to know that this is being looked at and is a priority, makes me feel more at ease with how things currently are.
     
  2. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    283
    Thanks for the detailed information. It would be really helpful to include examples and documentation for achieving effects that are possible with the built-in renderer. As a visual artist/coder, I am always looking to push the visual possibilities, with performance, so I of course want to use the latest tools and options.

    Right now, it's both exciting and painful to be developing in Unity. The new VFX graph, ECS. LWRP and HDRP are amazing! At the same time, every time I find almost any post-processing example project on Git, it does not run on whatever combination of 2019.x, 2018.x and HDRP/LWRP and Post-processing that I happen to try.

    Even recent projects that are shared don't seem to work easily. I think many people learn by opening up examples and that's becoming quite a bit harder to do with older Unity projects and especially with anything using post-processing effects.
     
  3. Blarp

    Blarp

    Joined:
    May 13, 2014
    Posts:
    193
  4. demonixis

    demonixis

    Joined:
    Aug 20, 2013
    Posts:
    93
    Thank you for the clarification.
     
  5. Alejandro-Martinez-Chacin

    Alejandro-Martinez-Chacin

    Joined:
    Oct 15, 2013
    Posts:
    38
    Now that the camera clear flags don't work as expected anymore (as in 'camera stacking').
    Where did the IRendererSetup class go? I can't seem to find it anymore. I'm on 2019.1.0 and the latest Core and Lightweight RP libraries.
    Was trying this namespace: UnityEngine.Experimental.Rendering.LWRP, but doesn't really work.
     
    P_Jong and LukWol like this.
  6. Alejandro-Martinez-Chacin

    Alejandro-Martinez-Chacin

    Joined:
    Oct 15, 2013
    Posts:
    38
    Well, you can't 'stack' cameras as the clear flags won't work as before. The camera that renders after the other will always clear to a color or to the skybox, so as of now (and by design actually) you can't use one Camera for an FPS gun and another for the environment and another for the Canvas in Screen Space - Camera/World. 2019.1.0
     
    LukWol likes this.
  7. KMacro

    KMacro

    Joined:
    Jan 7, 2019
    Posts:
    37
    LukWol likes this.
  8. Blarp

    Blarp

    Joined:
    May 13, 2014
    Posts:
    193
    P_Jong likes this.
  9. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    880
    Holy crap, this is by far the best post I've ever seen on these forums. A unity developer answering questions in depth? I'm so happy ❤️
     
    P_Jong, fherbst and Andre_Mcgrail like this.
  10. equalsequals

    equalsequals

    Joined:
    Sep 27, 2010
    Posts:
    105
    We have completely stripped any semblance of "Uber" Shaders (read: 'Standard', 'Lit', whatever the nomenclature is for your particular version) and saw build times reduced from over 6hrs to under 2hrs. We have completely moved to Shader Graph for all of our Shaders.

    I can confirm, anecdotally, that this setting provides a difference of 1hr 45min to ~35min.

    Another thing to call out is the Shader compile time seems to balloon with the number of Scenes you are building. It is as if currently (2018.1 and beyond) that Shaders get compiled for every Scene, which seems to be related to the Scriptable Stripping. If you have a lot of Scenes, this might be worth testing against.
     
    GameDevCouple_I and joshcamas like this.
  11. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    880
    I can say that the number of scenes causes a huge bump in build time for me as well. I personally built a prefab packer that converts most of my scenes into prefabs, and I saw 40 minute built times turn into 3 minutes. Which is odd, since one would imagine it's the same amount of data to be built. (note: no lighting, navigation, or occlusion data was in the scenes)
     
  12. OtakuD

    OtakuD

    Joined:
    Apr 24, 2014
    Posts:
    44
    I was under the impression camera stacking would be in 2019.1.0, tried it in my project now and it still renders to black on the upper cameras. Any documentation on how to do this yet?
     
    LukWol likes this.
  13. LukWol

    LukWol

    Joined:
    Nov 12, 2015
    Posts:
    12
    If you are interested in it, as much as I am, then you can vote it up on their roadmap (link below).;)

    https://portal.productboard.com/8ufdwj59ehtmsvxenjumxo82/c/31-camera-stacking
     
  14. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,259
    Hi,
    LWRP is out of preview but I cannot find IAfter/BeforeCameraRender interfaces in the namespace?
    Cheers
     
    Blarp likes this.
  15. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    2,184
    Just wanted to add that if we do all of this, plus save and use a shader variant collection in the include list and set shader stripping to "strip all" we get a build time that goes from 2hrs to 5 minutes.

    Its a really insane speed up, unsure what is actually happening under the hood for this.

    So to recap:

    - optimize mesh data - unchecking this removed around 1 hour from compilation time
    - Removing uber shaders or limiting multi-compile statements - removed 30 minutes from build time
    - Using shader variant collection with strip all - removed 25 remaining minutes bringing a 30 scene HoloLens AR production level app build time down to 5 minutes, which I believe is as low as can be gotten!

    Interestingly just doing the optimize mesh data + variant collection still brings it down to 10 minutes, so those 2 are a must for anyone having issues!
     
    phil_lira, Blarp, ynaoto and 5 others like this.
  16. sebastiansgames

    sebastiansgames

    Joined:
    Mar 25, 2014
    Posts:
    114
    My vote is to please bring camera stacking back. It’s a vital part of basic game design and fulfills unity’s core mission of democratizing game dev by making it easy (it’s not really ever really easy but you get my drift).

    If cameras can’t have clear flags this needs to be underlined in red at the top of the documentation for this render pipeline because it will make it useless for many developers myself included.
     
    SugoiDev and MNNoxMortem like this.
  17. underkitten

    underkitten

    Joined:
    Nov 1, 2018
    Posts:
    23
    Hi, I am looking for a way to create a blur material for my sphere. I am trying to blur our the portion of circle and increase or decrease the power of Blur.

    In HDRP it worked perfect but in LWRP i can not find the right way.
     

    Attached Files:

  18. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    501
    @phil_lira Will a decal system be coming to LWRP? (projecting bullet holes, graffiti, puddles etc.)
     
    Last edited: Apr 18, 2019
    Jes28 and joshcamas like this.
  19. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    437
    Does the "+" Button to add custom Renderer Features in a custom forward renderer work for anyone? It's kind of "essential" to work with the LWRP and I expected 2019.1.0f2 to be "production ready".
     
  20. KMacro

    KMacro

    Joined:
    Jan 7, 2019
    Posts:
    37
    It appears LWRP 5.7.2 does not come with any default Renderer Features included. You can still write your own custom ones.

    If you update to 5.10.0 you get one Renderer Feature included called "RenderObjects" (The latest version of LWRP 5.13.0 does not seem to work with the official release of 2019.1).

    Pretty disappointing that 2019.1 did not ship with a more robust implementation of this feature, but I suppose it's coming at some point down the line.
     
    ynaoto and MNNoxMortem like this.
  21. lodendsg

    lodendsg

    Joined:
    Sep 1, 2012
    Posts:
    182
    I take it this didn't make it into the 2019.1 release or am I missing something?
    Losing the ability to layer cameras is at the moment the only real pain point for us switching to LWRP for our current project.
     
    LukWol and Blarp like this.
  22. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    409
    @Andre_Mcgrail Thanks for that detailled answer. Finally some insight into what we and a ton of other users on this forum have experienced over the last months (there's a dozen threads about those shader compile times). Note that hinting at those temporary solutions/workarounds earlier would have saved people an insane amount of compile time and frustration with the LWRP.

    In line with the numbers of @GameDevCouple_I, here's some numbers on what I get with/without your suggestions:

    Before disabling Optimize Mesh Data:
    Build time 1:15 hours, every time (even on consecutive builds without any changes)
    LWRP Stripping Logging says Total = 1512444/23270724 = 6,499342%
    Build size 541 MB

    After just disabling Optimize Mesh Data:
    Build time 0:05 hours (2min spent on shader compilation, that's a x35 speedup...)
    LWRP Stripping Logging says Total = 65628/553524 = 11,8564%
    Build size 543 MB

    Could you maybe elaborate a bit more what "Optimize Mesh Data" actually does to make the included shader variants explode from 65k to 1.5 million?
     
    Blarp likes this.
  23. Blarp

    Blarp

    Joined:
    May 13, 2014
    Posts:
    193
    I do lwrp on a mac VM in windows so I can push to ios using arfoundation. This speed up for me is quite large, to say the least.

    Thanks for the info

    @fherbst these buried posts pretty much sums up all the headaches we have and will have with LWRP (and also for me additional problems with ARF). Long story short, entire graphics pipeline is being changed. HUGE undertaking across multiple departments, locations, timezones, talent, disciplines. Then also us, the devs, with our X number of variations on how we are using the platform.


    71F16F25-D577-401C-8A52-A4744DE0D31A.png
     
    superjayman likes this.
  24. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    554
    Out of curiosity, how will the LWRP new camera workflow (which I believe is a custom render pass) work with DrawMeshInstanced where you either render to all camera or a specific camera?
     
  25. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    283
    I would really like to get this effect working and since both postprocessing and LWRP are out of preview, I started a new thread here to see if I could get some help on this. I included an animation in that thread to show how the effect currently looks with the built-in renderer. I understand conceptually what needs to happen, but just not the right tool or path to get this done, i.e. is this best to do with a shader or post effect? And, could this be done with shadergraph at all?
     
  26. hgulgen

    hgulgen

    Joined:
    Nov 29, 2016
    Posts:
    39
    Hello,
    After I updated my unity to latest version 2018.3 to 2019.1. I lost all material connection in base map especially ,Normal map and Specular are ok. Do you have any problem like that ? How can I solve this because It is serious problem for project. There are a lot of material in all project.

    upload_2019-4-22_11-35-39.png
     
    P_Jong, Kazuki74 and FURKANKAHVECI like this.
  27. FURKANKAHVECI

    FURKANKAHVECI

    Joined:
    May 12, 2013
    Posts:
    14
    Same sh*t happened to me. If you delete 2018.3 LWRP 4.10 pack from project than update without using unity hub to 2019.1 direct to LWRP 5.13 all base map goes to hell. Also unity collab can't get it back from hell (some folks told me you need to backup before 18.3 to 19.1b so here is f*/*/* backup).
    If you using unity hub and do not deleted 2018.3 LWRP 4.10 pack, unity hub or unity 19.1 automatically finds/updates to 5.7.x verified edition without problems. (Maybe gamble).
    Good luck. Klyglsn:)
     
    Last edited: Apr 22, 2019
  28. equalsequals

    equalsequals

    Joined:
    Sep 27, 2010
    Posts:
    105
    It appears that the Property has been renamed from '_MainTex' to '_BaseMap' in the 2019.1 release branch.

    4.x: https://github.com/Unity-Technologi...r-pipelines.lightweight/Shaders/Lit.shader#L9

    5.x: https://github.com/Unity-Technologi...r-pipelines.lightweight/Shaders/Lit.shader#L9
     
  29. LukWol

    LukWol

    Joined:
    Nov 12, 2015
    Posts:
    12
    Please, help to vote it up on their roadmap (link below)!;) Yeah, my team needs it too.

    https://portal.productboard.com/8ufdwj59ehtmsvxenjumxo82/c/31-camera-stacking
     
  30. lodendsg

    lodendsg

    Joined:
    Sep 1, 2012
    Posts:
    182
  31. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    164
    Yes this is not the clearest and we were trying to get some hooks into when a package is upgraded, is seems it was not trivial and there is a chance where this will happen. But! Not to fear! your maps shouldn't be lost as we still serialise _MainTex and all the old properties for this reason.

    IMPORTANT: If you upgrade to a new version of LWRP(this happened between 5.2.3 and 5.3.0) and you lose all your base/albedo textures, in your project view, filter by Material type, select all and re-import, this will force the material upgrader to kick in and it should restore all your missing maps.

    Again the material system is old and done in a way that is not great by todays standards, where too much shader and data logic is controlled by the material GUI which is madness, this is another thing on our list of 'Old Systems' to re-imagine, right now we have to write upgraders by hand and you all know how fun serialisation is :(

    In the meantime we are looking at a way to automatically kick this off on project upgrade but without the callbacks from package manager it's going to be a little tricky.
     
    Blarp and P_Jong like this.
  32. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    164
    So interestingly as you can probably see form the build size before and after, it doesn't actually add more variants, what is happening is that is is going through all the shaders twice, and also all the scenes, this is because what 'Optimize Mesh Data' is actually trying to do is see what mesh components are used in shaders and which are not, think of Vertex Colors, UVs, Tangents etc, in a project with a lot of meshes and a lot of extra data that the shaders never use you are still building all of this into your game, meaning you might be loading a mesh that is 5 times bigger in memory than what you actually need.
    Now the reason it slows everything down so much is that for it to make the best guess at what you need and don't it has to compile all the shader snippets, check what's used(just in general), strip them, then note down the mesh data that is used in them, then strip that from all the meshes, this happens as a single shader compiler and also nothing is caches, so when it comes time to actually compile the shaders to put in the build, it has to start all over again. This is also messing with the shader stripper tally logic, I managed to get a build staying it compiled 20 million shaders, yet the shader build size was only 10mbs(still pretty big but definitely not 20mill big).

    So short term plan is to make this more of a manual task, you can choose what to strip mesh wise, if you know you don't use Vertex colours in your project, you can strip them, if you don't use UV 3/4/5 etc you can strip them. This is just a short term solution to make sure people can strip this stuff without waiting hours for a build, the ultimate goal is to make the whole shader variant/usage much more streamlined, this way we can do a lot of things async while in the editor and also be much smarter about only piping used shader code through all these systems.
     
  33. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    164
    Post effect would be best, you could do this with a custom effect in post processing, but since eventually we will be getting a v3 much like HDRP I would suggest doing it via a custom render pass.
     
    P_Jong likes this.
  34. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    409
    @Andre_Mcgrail thanks for the additional info.

    Just a note regarding the material upgrader since that kicked in a couple of days ago: Particle materials aren't upgraded properly. They still lose their albedo.
     
    lx-mllr-tg, Kazuki74 and Blarp like this.
  35. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    25,925
    Just a swift QFT so people get chance not to miss gold.
     
    andreiagmu and Blarp like this.
  36. Tartiflette

    Tartiflette

    Joined:
    Apr 10, 2015
    Posts:
    59
    What's the rationale behind behind a full depth prepass + shadow gather pass for the main directional light? It seems like the kind of thing that would have a disastrous performance impact on mobile.

    Also, I've seen that some cool stuff is happening on the post processing pipeline (the potential support for tilers being the most exciting thing), is there an estimated timeline for its first release?
     
  37. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,041
    Is it possible to access the cascade shadowmap separately from the screen space shadow map in LWRP? Also how do we now inject ScriptableRenderPass objects? The API is removed such as IAfterOpaque, etc.
     
  38. foolmoron

    foolmoron

    Joined:
    Jun 22, 2013
    Posts:
    40
    It was 4.1.0-preview with Unity 2018.3.11f1. I see there's an update so I'll try with the latest version and with 2019.1. Thanks!
     
  39. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,041
    Looks like Scriptable Render Feature are the way to do it, but they have a few bugs with multi-pass materials and still no way that I can see to get at the cascade shadow map.
     
  40. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    268
    I don't really know how I feel about the new camera stacking workflow, or maybe I am misunderstanding something. I honestly think that this is a severe constraint in terms of freedom, unless I'm missing out some info about performance. Let's say, for example, that I have a game with a following render path:

    Main view, postprocess and write to RT -> UI, also write to that same RT, don't clear -> Upscale with int -> Upscale with bilinear

    What do I do now then? Previously, I could write to that same RT from a different camera/matrix after postprocessing on the first camera. Both of them are in LDR and with the same matricies (even though I don't think the latter will matter much). Now with such hard constraints, I doubt it'll be possible.

    And there are other questions like that. What if I want a type of an overlay camera that would render the same, but after post processing? What if I want an overlay camera before post processing, but force it to LDR rendering? What if I want to render with a different matrix with different clip points (for example, to have the cameras to pan out and replace each other)?

    If the old workflow was perfectly fine from the performance standpoint (considering if configured correctly) - I feel that this is a pretty big leap towards the ease of use, but a harm to nearly everything else.
     
    Last edited: Apr 30, 2019
    LukWol, IPL and sebastiansgames like this.
  41. JohnKP-Mindshow

    JohnKP-Mindshow

    Joined:
    Oct 25, 2017
    Posts:
    33
    For those wondering how to create/queue custom passes in LWRP 5.7.2 now that IBeforeRender and IAfterOpaquePass and similar intefaces are gone, this youtube video (sponsored by unity) really helped.



    Strange they are prioritizing sponsored youtube content for the out of preview feature instead of updating the docs, but hey at least I found it! ;)
     
  42. Blarp

    Blarp

    Joined:
    May 13, 2014
    Posts:
    193
    marketing typically has a lower work load than the developers in the majority of businesses.

    I do both marketing & development for two diff companies, and I typically complete all of my marketing work in an EXTREMELY short period of time, while on apps Im always behind.

    Cant automate coding yet!!!!!
     
  43. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    222
    lx-mllr-tg likes this.
  44. JohnKP-Mindshow

    JohnKP-Mindshow

    Joined:
    Oct 25, 2017
    Posts:
    33
    Very true. Engineering team seems behind where they probably wanted to be (and where marketing thought they would be) when out of preview. Very grateful to have found the video, so thanks marketing team!

    You can still achieve creating/queuing custom passes similar to using IAfterOpaquePass using ScriptableRenderFeature/ScriptableRenderPass. These are scriptable object based, and when creating them there are analogous enums that allows you to define when the pass should be queued. It's relatively straightforward, the complexity mostly comes from the lack of documentation.

    Sadly there isn't a single tutorial/video/github project/documentation page that has a fully working solution that I've found (probably a side effect of the new way packages are rolled out and iterated on vs the editor itself), but between that video and the few examples they've provided, I was able to better understand how the lower level pieces work and figure out how to achieve what I wanted using the new way
     
    P_Jong and Blarp like this.
  45. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    471
    Hi @Andre_Mcgrail, will DOTS integration happen at the end of the year? Does it means all of SRPs including LWRP and HDRP will slowly rewrite to DOTS style code?
     
  46. Heckmouse

    Heckmouse

    Joined:
    Nov 7, 2014
    Posts:
    19
    I'm one of the early adopters of LWRP and I built my entire game using it until finding out there was no way to stack cameras. I've been watching the thread hoping for details on the solution. I'm hopeful it'll get done at some point but for now I've just returned to the standard renderer.

    Mostly I need it to render isometric dice on top of a perspective camera. If anyone from Unity wants to get any more details for my use case I'd be happy to provide them. If not no worries. Good luck getting this sorted out.

     
  47. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    164
    Hey All,

    Custom Renderer Examples are HERE!

    It took a long time(much longer than it should have but time is a hard thing to find these days) but alas we have cleaned up and roughly documented the examples shown at GDC this year. There is 3 examples in this showing usages of the new Custom Renderer system where you can make your own Forward Renderer and add Renderer Features to control how LWRP renders your content.

    Grab it here:
    https://github.com/Unity-Technologies/LWRP-CustomRendererExamples

    We've still yet to write out how the Toon Outline and the Occlusion examples are put together, but will add it in the coming days hopefully.

    Also with these examples is the GDC talk:
    https://www.gdcvault.com/browse/gdc-19/play/1026179

    And the smaller GDC booth talk of a similar nature:
     
    P_Jong, joshcamas, optimise and 2 others like this.
  48. Blarp

    Blarp

    Joined:
    May 13, 2014
    Posts:
    193
    prasbe
     
  49. Heckmouse

    Heckmouse

    Joined:
    Nov 7, 2014
    Posts:
    19

    Yikes. The FPS example looks like will work for some people but there are some really weird things going on that have been hidden by super low quality settings. I wonder if this was done on purpose or not.

    If you add cascades to the shadows you can see that the shadow pass is being dropped on top of the gun. That means a shadow on the floor is also drawn as if it is cast onto the gun. Take a look:
    upload_2019-5-3_10-33-52.png

    Ya'll should have hired me when I applied as rendering QA a while back :p
     

    Attached Files:

    P_Jong, fherbst and Blarp like this.
  50. Blarp

    Blarp

    Joined:
    May 13, 2014
    Posts:
    193
    Confirmed. Toss me a guild invite too
     
    P_Jong, Heckmouse and joshcamas like this.
Thread Status:
Not open for further replies.