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

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

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    While adding support for LWRP to custom builtin unlit shaders (using different SubShader sections and the RenderPipeline tag) I have found I also need to add

    Code (CSharp):
    1. "RenderPipeline" = ""
    to the other builtin Subshader sections. If I omit the RenderPipeline tag in the SubShader section for builtin pipeline in the same shader, it does not compile when using LWRP. Is this correct?

    Is it possible to have platform compiler defines (like SHADER_API_MOBILE exists, I'd want to have SHADER_API_LWRP or similar, ...) OR at least make the compiler ignore the SubShader sections targeting SRPs that are not present? If I deploy the shader into a builtin setup (no SRP packages installed), I don't want the SubShader sections with RenderPipeline = "LightweightPipeline" to be compiled nor throw any error.

    Thanks.
     
  2. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961

    Alright, so I did a few benchmark today, it seems SimpleLit's performance gain is quite insignificant on Intel GPU, especially when compared to other factor like Post Processing and number of lights. I am not sure if it's to be expected.

    Benchmark (1 directional light + 2 point lights + 1 spot light + SMAA medium + Bloom; Lit vs Simple Lit):

    Screen Shot 2018-10-17 at 13.29.02.png Screen Shot 2018-10-17 at 13.32.03.png

    Benchmark (1 directional light only; Lit vs Simple Lit):

    Screen Shot 2018-10-17 at 15.07.07.png Screen Shot 2018-10-17 at 15.08.44.png

    (cont. in next reply)
     
    Last edited: Oct 17, 2018
  3. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    (cont. from previous post)

    Benchmark (1 light vs 4 lights vs 4 lights + FXAA vs 4 lights + SMAA medium)

    Screen Shot 2018-10-17 at 15.07.07.png Screen Shot 2018-10-17 at 15.26.02.png Screen Shot 2018-10-17 at 15.27.17.png Screen Shot 2018-10-17 at 15.28.16.png

    I always thought PBS is much more complex than simple Blinn-Phong, but it seems even with additional environment sampling, PBS isn't much slower on Intel GPU Laptops (when you compare it to Post Processing's performance hit).
     
  4. MaT227

    MaT227

    Joined:
    Jul 3, 2012
    Posts:
    628
    Last edited: Oct 21, 2018
  5. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    @phil_lira hi @Tim-C hi guys, any suggestions on the above?
     
  6. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    140
    I recently upgraded to Unity 2018.3.0b3 and am using the LightweightRenderingPipeline. I have noticed that my build size has jumped tenfold from 90MB to 950MB! What is going on here? Has anyone else noticed this?in my build report in the editor console I have:

    Build Report
    Uncompressed usage by category:
    Textures 36.1mb 3.8%
    Meshes 4.4mb 0.5%
    Animations 26.1mb 2.7%
    Sounds 0.0kb 0.0%
    Shaders 4.5mb 0.5%
    Other Assets 2.0mb 0.2%
    Levels 1.6mb 0.2%
    Scripts 419kb 0.0%
    Included DLLs 0.0kb 0.0%
    File Headers 908.8kb 0.1%

    Complete size 952.4MB 100% !!!
     
    MetaDOS likes this.
  7. Captain_Flaush

    Captain_Flaush

    Joined:
    Apr 20, 2017
    Posts:
    65
    Hello,

    I am using Unity 2018.3.0b6 and LRP 4.0.1 and I have a scene with one Directional light and 3 point lights.
    I have the following issues:
    1/ If I disable the shadows from the main light, the point lights disappear from the scene.
    2/ If I switch the additional lights from Pixel Lighting to vertex lighting, the settings (eg: per object limit) get grayed out, but still apply. For example if I set the limit to 2 additional lights with Pixel lighting, then switch to Vertex lighting, I can still see only 2 lights per object.

    Question: what is the vertex light per object limit?

    Thanks,
    Mihai
     
  8. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    Is your lighting mode set to mixed? There was a regression related to mixed lighting that slip in that version. We have a fix already and it will be in the next package.

    About the material errors I'll investigate it.
     
  9. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    Enlighten is supported in LWRP. Dynamic GI is not. We have discussed about the implications of adding it as some devs have asked for it.
     
    P_Jong likes this.
  10. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    GuillaumeCL and NicTda like this.
  11. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    Is this a local build or cloud build? We fixed recently an issue that the Cloud Build was failing to strip shaders and would cause massive build times + memory.

    We've added an option in the pipeline asset to log shader variants recently. It will be in the next package. Meanwhile, disable in the pipeline asset settings from lighting and shadows categories. Those control shader stripping.
     
  12. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    140
    its a local build

    Also, I disabled the lighting and shadows in the asset settings but it did not seem to make any difference.
     
    Last edited: Oct 24, 2018
  13. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    What shader are you using? There was an issue with SimpleLit shader that got fixed recently (not yet available)

    The main light is global and affects all objects. The per object limit controls the amount of additinal lights that can affect an object. They can be shaded per-vertex or per-pixel.
     
  14. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    Can you post the full log so I can take a look.
     
  15. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    Both of these issues are fixed now. I'll generate a package for 2018.3 with backporting issue sometime next week.
     
  16. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    VR team is looking into it. I dont' have an ETA yet. We are confident we can enable it for DX11 and that should be done soon.
     
  17. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    336
    Sorry if it sounds off topic, but i was wondering why the option to bake indirect lighting is disabled in LWRP..
    is this a sacrifice we have to take by switching to LWRP?

    personally i would want to have some sort of baked indirect lights.. it make scenes more beautiful to look at than baked shadows.
    that being said, i wonder why it is not an option to have baked lightmaps to contain both shadows and indirect lights at same textures!
     
  18. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    140
     

    Attached Files:

  19. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    I'll add a massive +1 to this, in the legacy rendering pipeline I think the dynamic GI is one of the most impressive VR effects you can get, especially when considering how well it runs.
     
  20. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    I saw Andy's talk on Unite LA today and wondering if we might face a situation where 2018.3 goes into stable while LWRP continue to be in Preview.

    I am fine with the lack of some major features but it would be pretty bad to not have a stable release of LWRP for 2018.3 or 2018.4 LTS: this is the version of Unity we are inevitably going to use for current project (we are using 2018.3b in production at this point, since we want to use latest LWRP there isn't any alternative.)

    Screen Shot 2018-10-24 at 21.52.28.png
     
  21. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    140
    I am experiencing a peculiar problem with the property names in the shadergraph at the moment. Its possible that this behaviour commenced as a consequence of a shader being duplicated. The property names inside multiple other shaders seem to have changed themselves, but still only respond to their previous names. So that the name displayed in the shader graph (btw it has been saved ) is unresponsive , and responses from the shader can only be gotten by referring to it s previous names. Strange. And difficult.


    And whats more...Even if i find out what the previous property name was, I am unable to restore it in the shader graph as every time I attempt to restore the name, it autocorrects it with an underscore at the beginning....which screws up all other scripts which previously referred to this shader.
     
    Last edited: Oct 24, 2018
  22. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    No. You should not have a compilation error due to the RenderPipeline tag itself. If you use functions defined in LWRP shader library or SRP and if you don't have the package installed, yes. It won't compile. All Subshaders in a shader will be compiled unless you strip them with a custom shader stripper.

    If you want to support both LWRP and Builtin with same shader file then declared a SubShader first with "RenderPipeline" = "LightweightPipeline" and a second with either "RenderPipeline" = "" or no RenderPipeline tag.

     
  23. Kronnect

    Kronnect

    Joined:
    Nov 16, 2014
    Posts:
    2,905
    @phil_lira that's not exactly the behaviour I'm getting: if I omit the RenderPipeline tag of the first SubShader section below, the shader won't work in LWRP (shows in pink).
    Using Unity 2018.2.7f1, LWRP packages correctly installed and working.

    Code (CSharp):
    1. ..
    2. SubShader {
    3.      Tags { "RenderPipeline" = "" }
    4.    Pass {
    5.    ...
    6.    }
    7. }
    8. SubShader {
    9.      Tags {"RenderPipeline" = "LightweightPipeline" }
    10.    Pass {
    11.    ...
    12.    }
    13. }
    But leaving the RenderPipeline="" makes it work for both standard and LWRP.
     
  24. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    140
    I would like to report another peculiar feature of the LWRP that I have found. I have found that if I have a material with a LWRP shader with a texture2D input, and a designated texture....if i remove the texture from the material and press play , it automatically reassigns the last placed texture back into the slot, like it remembers it. And then if I try to assign a new texture to the material, as soon as I press play it reassigns the previous texture. This does not happen all the time......just in some cases... not sure why
     
  25. Pr0x1d

    Pr0x1d

    Joined:
    Mar 29, 2014
    Posts:
    46
    Hello I would like to see if its something I have bugged or its actual bug in LWRP, I have grass with Transparent Alpha material and when I activate receive shadows it just takes shadows for opaque shaders behind actual transparent material, had this bug on terrain grass shader aswell, but it was working from time to time but by putting the transparent material it just breaks it. Any fixes outhere caus I could not find any. Thanks

    upload_2018-10-25_17-17-12.png

    upload_2018-10-25_17-18-44.png
    (With receive shadows true)

    upload_2018-10-25_17-19-14.png
    (With receive shadows false)
     
  26. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    Is there any workaround for the 16 lights limit? Given the lack of both deferred path and realtime GI (hence no realtime light probe neither), I don't know how to make an interior or night time scene where there are potentially more than 16 light source in view. (I can't use baked light in this case due to working with a dynamic scene)

    Another question is does LWRP 4.0.x still support SH lights? I believe it was working in 2018.2, but somehow with 2018.3b I can only get pixel/vertex light to work. (The additional light slider on LWRP asset used to cap the number of pixel/vertex lights per object, but now it seems to cap the number of all lights per object, including SH lights, so visible lights are always pixel or vertex now?)

    Basically I am looking at SampleSHPixel but I am not sure how many additional lights are available per object exactly, is it still 1 + 8 (1 directional + 4 point/spot + rest is SH)? or is it 1 + 4 (no SH)?

    https://github.com/Unity-Technologi....lightweight/ShaderLibrary/Lighting.hlsl#L332

    UPDATE: I have posted some screenshots to illustrate my problems in a reddit thread.

    https://www.reddit.com/r/Unity3D/comments/9rhxcr/lwrp_how_does_sh_light_work_any_workaround_to_the/
     
    Last edited: Oct 26, 2018
  27. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    I also think this is a bug in LWRP 4.0.1 preview: changing the additional lights dropdown to vertex lighting shouldn't disable the per object limit slider.

    Screen Shot 2018-10-26 at 13.23.52.png Screen Shot 2018-10-26 at 13.23.57.png Screen Shot 2018-10-26 at 13.24.03.png
     
  28. mrcostard

    mrcostard

    Joined:
    Nov 8, 2017
    Posts:
    4
    Hey ! It's said that the lightweight render pipeline it's planned to be release in 2019. But for what version, the 2019.1 ? so at the beginning of the next year ? It's a little bit too large the "2019" version...
    I asking that because i'll be working at my work on mobile and we'll be in need of that version.
     
  29. CerebralFrost

    CerebralFrost

    Joined:
    Mar 28, 2017
    Posts:
    12

    I'm seeing the same issue as this - it looks like the culprit is maybe in SetupLightweightConstantsPass line 182:

    Code (CSharp):
    1.                     // In subtractive light mode, main light direct contribution is baked on lightmap
    2.                     // In this case we setup light position w component as 0.0f so we can remove it's contribution
    3.                     // from realtime light computation
    4.                     if (lightData.lightType == LightType.Directional)
    5.                         lightPos.w = 0.0f;
    Once we set the attenuation value to 0, we get no light contribution in either the LightweightFragmentPBR or LightweightFragmentBlinnPhong passes (Lit or SimpleLit shaders).

    I don't think we need to do this in the constants setup since the directional light contribution is removed from lightmapped objects in the shader (MixRealtimeAndBakedGI -> SubtractDirectMainLightFromLightmap).

    [Edit] - or not, that blows out my scene - but the problem is definitely that the attentuation is 0 for non-lightmapped objects....

    [Edit Edit] And, I see there is a fix incoming - disregard
     
    Last edited: Oct 27, 2018
  30. CerebralFrost

    CerebralFrost

    Joined:
    Mar 28, 2017
    Posts:
    12
    I am seeing another odd issue with mixed mode shadows -
    When there are no objects being drawn into the shadow map, I get what looks like a large shadow drawn across the scene - this changes position / orientation and pops on and off when I move the scene view camera around. Also, this happens in a standalone build:

    MixedModeIssue1.png MixedModeIssue2.png
     
  31. Captain_Flaush

    Captain_Flaush

    Joined:
    Apr 20, 2017
    Posts:
    65
    Hello,

    1/ I am using PBR graph materials.
    2/ I see that there is a limit of 4 lights per object. In the previous version there were 8. So from now on we will have 4 lights per object?
    3/ There is a bug with the gizmos. I have 2 cameras, one for the game one for UI rendering. The gizmos get rendered for each camera, so I see the gizmos twice.

    Mihai
     
  32. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    140
    phil_lira were you able to take a log at the log file i uploaded?
    My IOS build has blown out to like 1 GB in size compared to its previous size of 90MB... I can't see what it could be due to ...Its mostly just a video player with a few different shaders.
    This only happened when I upgraded to the LWRP
     
  33. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @bitinn, I'm very interested the tool u are using to profile the performance.
     
  34. jpease

    jpease

    Joined:
    Apr 18, 2013
    Posts:
    11
    There's a very simple issue: by default, MSAA doesn't work at all. That setting on the LWRP asset is ignored.

    This issue can be worked around by forcing an intermediate render texture to be used (such as by enabling HDR or by editing the RequiresIntermediateColorTexture method) but I doubt that's part of the intended workflow for users of the LWRP to get antialiasing.
     
  35. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    Intel GPA
     
  36. yonek_idreams

    yonek_idreams

    Joined:
    Sep 10, 2014
    Posts:
    26
    I was wondering if for a game that is optimize to run on mobiles using the "build-in" render pipeline would benefit from switching to LWRP. Assuming the visual result would not change on LWRP.
     
  37. Halfspacer

    Halfspacer

    Joined:
    Sep 13, 2014
    Posts:
    23
    Just tested, there seems to be no MSAA when building for Oculus Go despite 4x MSAA ticked in the LWRP asset and enabled on the cameras :/ Is there any ETA on when this is fixed?
     
  38. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,483
    It really depends what type of game you are making. If it is using Unity lights, then it would look visually different when switched from Built In to LWRP.
     
  39. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,483
    Hey folks! I made a little library of some useful LWRP-Related Scriptable Render Pass/Shader Graph examples.
    https://github.com/UnityTechnologies/LWRPScriptableRenderPass_ExampleLibrary

    Planar Reflections:


    Blurry Refractions (Grab Pass-Like):


    Screen Filter Effects:


    Planar Reflections are modified from the Boat Attack project (https://github.com/Verasl/BoatAttack/) and Blurry Refractions are modified from John Sietsma's 'Extending LWRP' Repo (https://github.com/johnsietsma/ExtendingLWRP).

    Some ideas of Scriptable Render Pass -> Shader Graph examples I want to add in the future (Requires research; no timeline for when/if these will be made!):
    - Per Object Outline
    - Through-Wall XRay Effect
    - Realtime Colored Shadows
     
  40. Captain_Flaush

    Captain_Flaush

    Joined:
    Apr 20, 2017
    Posts:
    65
    Hello,

    Testing LWRP 4.0.1 on Unity 2018.3.0b7 on several devices and if I activate shadows on the main light, I get total chaos.
    Reproduces on:
    Sony Xperia Z (Adreno 320)
    Nexus 5 (Adreno 330)
    Huavei P20 Lite (Mali-T830 MP2)

    Thanks,
    Mihai
     
  41. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,483
    Do you have any screenshots of the 'total chaos' for us to see and review? :D
     
    Tesrym likes this.
  42. fortgreeneVR

    fortgreeneVR

    Joined:
    Sep 5, 2018
    Posts:
    50
    LWVR (LWPR 4.0.1 for VR) preview problems, using the provided preview scene, no alterations.

    - When hitting play in the editor, the monitor shows one of the eye head tracked rendering, but the HMD shows a view of the play area and a Unity logo that says 'loading' but it never starts.
    I see the message "Created eye textures with a "double wide" layout. The "single-pass" stereo mode will be used."
    Using Unity 2018.3.0b8, Oculus (Standalone) 1.29.0 package, Oculus 1.31.0.686553 software, Windows 10 1809, GeForce RTX 2080, D3D11

    - On the same setup but switching graphics APIs to D3D12, hitting play has the same behavior, but the message is different: "Created eye textures with a "separate" layout. The "multi-pass" stereo mode will be used."
    There is also an occasional messages:
    "d3d12: Not all small textures released!"
    "d3d12: releasing a resource which is still being referenced. It will be leaked."

    The standalone built version has the same issue.

    I issues a bug report, https://fogbugz.unity3d.com/default.asp?1097099_e1rm2ovcp4irhve2

    Thanks.
     
    Last edited: Nov 2, 2018
  43. renardmf

    renardmf

    Joined:
    Jun 29, 2012
    Posts:
    47
    Thanks for the reply! Please do update us when there is a fix!

    Also, I have a shader working now that works fine in edit mode and game mode that fades out based on how close the camera is to the object but for some reason when I add the Depth Fade node into the mix (I am using Amplify Shader Editor) I am getting weird artifacting in the transparent part of the shader. This seems to be related somehow to depth issues from the stereo camera since the artifacts look like the objects that this object with this shader applied is trying to draw on top of. I am currently using single-pass VR within the LWRP in Unity 2018.3b8.

    Here is an example of the artifact I am referring to:



    I thought it might be related to this post I found here but I wasn't too sure:
    https://gamedev.stackexchange.com/quest ... ion-matrix

    Thanks again!
     
    Last edited: Nov 1, 2018
  44. lxmllr

    lxmllr

    Joined:
    Mar 27, 2018
    Posts:
    6
  45. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    Can you please log a fogbugz case so we have a repro we can look into?
     
  46. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
  47. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,251
    Is there a matrix of which SRP version is supported / go with which Unity builds? For an asset dev it can be a little difficult knowing if we need to include multiple LWRP packages to support different versions of Unity.
     
    phil_lira and MetaDOS like this.
  48. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Legend

    Joined:
    May 5, 2014
    Posts:
    1,483
    Hey folks!

    I made a small experiment yesterday: out of curiosity, tried porting a few of the FPS Sample assets to LWRP 4.0.1 (and made a Toon Shader using Shader Graph for the Heroes). Very little optimisations done to the assets. Thought i'd share it here. :)

     
  49. ivank

    ivank

    Joined:
    Nov 16, 2013
    Posts:
    105
    Hello @Andy-Touch ,
    thanks for your educational effort here:)
    Speaking of useful LWRP-Related Scriptable Render Pass/Shader Graph examples - what about matte shadow - in another words shadow on completely transparent(invisible) plane?
    It is indispensable for "serious" applications - product & architectural visualizations, even VR etc., many times discussed/asked throughout the Unity forums during quite a lot of years(!).
    Example of nice implementation of matte shadow is Unity's own employee Keigiro's T. Shadow Drawer available on GitHub, but it is two years old and of course does not work with LWRP.

    Another looong-time dream of me and few other friends working on historical architecture visualizations is just a standard LWRP shader, but with the ability to assign to each texture (albedo, normal...) its own individual tilling&offset settings (example albedo roof tile repeated 50x50 times, smoothness or occlusion map just 10x20 to break the visibility of roof tile texture repeating pattern)
    as well as its own UV mapping/channel (for the similar purpose as above). This has been also discussed in the forums quite a few times during recent years.

    Please consider this just as a tip/suggestion where to focus your creativity when bored and having anything else more serious to do :)

    Thanks again and regards

    IvanK
     
  50. MetaDOS

    MetaDOS

    Joined:
    Nov 10, 2013
    Posts:
    157
    I'm up for this. Currently, the upgrade process is quite confusing.
     
Thread Status:
Not open for further replies.