Search Unity

Feedback Wanted: Scriptable Render Pipelines

Discussion in 'Graphics Experimental Previews' started by Tim-C, May 9, 2017.

  1. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    1,847

    makes sense seeing as the lightweight has to cover a far more diverse set of use cases than the HDRP

    will we still be able to start building shader sfor it using the graph editor with the preview version?
     
  2. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    522
    Is there an example/template shader for the HD SRP to start from? I can't find any in builtin_shaders-2018.1.0b4

    EDIT: Also, should I expect the CameraEvent and LightEvent CommandBuffer hooks to work as usual in HD SRP?
     
    Last edited: Jan 26, 2018
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,808
    I'm trying to use SRP with 2018.1b4 and I just can't do it. I keep getting a "GetManagerFromContext: pointer to object of manager 'MonoManager' is NULL (table index 5)" Fatal error whenever I add SRP to a project (even an empty one).

    I want to play around with it before asking questions, but seeing as that isn't possible, I guess I'l just ask:

    I only use baked lighting (no realtime ones) with light probes, only custom vert frag shaders (no standard or legacy) and my own (relatively simple) post processing.

    Is there potentially a performance win to be found if I somehow transition all the above to SRP? (by making my own SRP, which does the bare minimum). Or is it going to be a waste of time?
     
  4. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    There is a known bug (that has been fixed but not sure what release) that can cause this issue. It happens if you have the cache server enabled + asmdef + packages. Can you try disabling the cache server?
     
    AcidArrow likes this.
  5. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    This is the most PERFECT case for a custom SRP! :) You should get significant speedups if you go down this road!
     
    Alverik and AcidArrow like this.
  6. Giuseppe

    Giuseppe

    Joined:
    Dec 4, 2011
    Posts:
    18
    Hey, just having a play with SRP HD path using 2018.1.0b4, I've got myself set up and am just trying to figure out the shader inputs. I cannot find any docs for this right now (understandably) but wondered if any of you guys at Unity could enlighten me:

    1. The mask map has 4 channels referred to as M(r), AO(g), D(b), S(a).
    M being metal, AO being ambient occlusion, S being smoothness but what is D?
    edit: is this density for that fancy transparency that some AAA are doing?

    2. The subsurface scattering mode enables two inputs:
    - subsurface radius map
    - thickness map
    Is there any reference online for what a subsurface radius map is? A google for that exact phrase only shows me Unity's github where it caught this text in the code, but no other reference. Thickness seems to be the same as what Substance calls a thickness map so I think we're good there, and it seems to work with it - just not sure what the radius map is for.

    3. Could you explain the layer mask for the Layered Lit shader when configured for 4 layers? I've done a test mask with red, green, blue and alpha values but only layers 1-3 showed up, with the base layer not being revealed anywhere. I just slapped the inputs in for each layer, I did not touch the material references, could you explain the correct procedure / workflow there? Is it compatible with the masks output from allegorithmic's recent updates to Painter for their multi-material feature? Would also be nice to be able to switch to vert colours instead of texture channels for it where possible.

    4. Could you summarise the bent normal functionality? What exactly it's used for etc, I had a fiddle with it, using a map spat out of Designer - the shading changed slightly but I got seams, I'm sure I don't know what I'm doing here though so thought I'd ask.

    5. I've noticed a sort of moire / lines effect on surfaces that are not within a couple of units of the camera:

    here at a distance we can see it across the surface.


    As I approach, it recedes to the edges of what is visible and eventually is gone.
    edit: seems to be related to shadow bias etc, spose i need to fiddle, I just figure that such an obvious effect in such a typical scenario wouldn't produce this - perhaps the defaults need to change?

    Thanks in advance for the help, and many thanks for this great tech :)
     
    Last edited: Jan 26, 2018
  7. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    78
    D is the mask for detail maps
     
  8. petersx

    petersx

    Joined:
    Mar 5, 2015
    Posts:
    215
    The moire effects is by ambient occlusion from post process volume - bug ?
     
  9. Giuseppe

    Giuseppe

    Joined:
    Dec 4, 2011
    Posts:
    18
    Thanks Onigiri.

    Petersx: doesn't seem to be AO, I have disabled that and it is still present - pretty sure its shadow problems
     
  10. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    290
    Seems shadow bias / normal on your directional light
     
  11. f1ac

    f1ac

    Joined:
    May 23, 2016
    Posts:
    64
    So are we doomed to manually pack existing textures into this one? :)
     
  12. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,808
    Is that really that bad?
     
  13. f1ac

    f1ac

    Joined:
    May 23, 2016
    Posts:
    64
    Well, end users will to do it wasting their time. Isn't it better to automate that once on model import/hd framework level? I bet several hundreds of man-hours could be saved.
     
    briank and Thall33 like this.
  14. petersx

    petersx

    Joined:
    Mar 5, 2015
    Posts:
    215
    In my project with Unity 2018.1.0b4 moira dissapear after disabling AO. Also moira is only in editor - in game mode is ok.
     
  15. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    shader graph so you can pack however you like :D
     
    f1ac likes this.
  16. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    290
    Are they any plan to release other SRP than Lightweight and HD?
    On top on my head:
    - 2d focus, disable most 3d costly features
    - UI focus, only enable UI. Would be great to do phone app that doesn't drain battery.
     
  17. JakubSmaga

    JakubSmaga

    Joined:
    Aug 5, 2015
    Posts:
    416
    There's already 2D template in the Unity Hub, you should try it out.
     
  18. Thall33

    Thall33

    Joined:
    Sep 18, 2013
    Posts:
    55
    Is it cheaper to have these textures packed into one texture? Really interested what the bent normals is about, love if someone could give some insight!
     
  19. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    7,115
    Bent normals are normal maps that store something closer to the average ambient light direction than the surface normal.
     
  20. dizzy2003

    dizzy2003

    Joined:
    Nov 25, 2013
    Posts:
    17
    I often find myself wanting to render a camera with no lights, for example in Satellite Reign we had an ingame map (render to texture, camera renders 1 layer) and considerable time was spent FindingLights (internal unity function on profiler) for the map render (We had a lot of lights), I even went so far as to add a pre render and post render step that went through and disabled all the lights then re enabled them (Unity 5.3), just for that camera

    Will this new system allow me to do stuff like render a camera without any calls to find lights because I know all the layers visible to that camera use only unlit shaders..
     
    Last edited: Jan 29, 2018
  21. petersx

    petersx

    Joined:
    Mar 5, 2015
    Posts:
    215
    You don't need download manually anything.
    Do these steps: Unity 2018.1 beta 4
    1. Create and open new empty project
    2. Close Unity
    3. Copy from template HD to your new project (overwrite) from install folder Unity f.e. c:/Program Files/Unity 2018.1.0b4/Editor/Data/Resources/PackageManager/Project Templates/com.unity.template.hd/
    4. Run Unity and open your project
    5. Everything need to work will be downloaded automatically by Unity (SRP and PPS2)
    6. Done.

    check the sample scene to obtain how work new render pipeline (scene settings etc)
     
    SoloChristian likes this.
  22. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    391
    I used the Unity Hub beta, chose a template and it did everything for me... It just worked.
     
    SoloChristian likes this.
  23. petersx

    petersx

    Joined:
    Mar 5, 2015
    Posts:
    215
    Yes, it's works also, but with templates from unity install directory no need to install git and no need to grab pps2.
    BTW - install from Unity install dir is faster than from github.
     
    SoloChristian likes this.
  24. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    1,847
    Will unity hub method require me to manually find and download these elements or is it auto?
     
  25. Finepointcgi

    Finepointcgi

    Joined:
    Jul 5, 2017
    Posts:
    14
    @Daemonhahn Unity hub will download 2018.1b when you tell it to install it then just select your pipeline when making a new project.
     
  26. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    New version of shadergraph / lightweight pipeline is available.

    Two ways to get this:

    1: Manually update your package manifest to this:
    Code (csharp):
    1.  
    2. {
    3.   "registry": "https://staging-packages.unity.com",
    4.   "dependencies": {
    5.     "com.unity.render-pipelines.lightweight": "0.1.28",
    6.     "com.unity.shadergraph": "0.1.17"
    7.   }
    8. }
    9.  
    2: Go into Window->Package manager, then update the lightweight, followed by the shader graph.
     
    Alverik and hippocoder like this.
  27. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    1,847
    Sweet thanks :)
     
  28. Finepointcgi

    Finepointcgi

    Joined:
    Jul 5, 2017
    Posts:
    14
    any ideas why when adjusting my depth bias on a light it also make all my other shadows blurry. what would be the best way to fix this?
    upload_2018-1-29_14-0-14.png

    EDIT: for anyone wondering it seems to be the cascade settings any ideas if we can blur it or what is the best method for this?
     
  29. Kumo-Kairo

    Kumo-Kairo

    Joined:
    Sep 2, 2013
    Posts:
    331
    @Tim-C is there a way to completely `glClear` just like the Cameras do before they start rendering? Like complete `glClear(mask = COLOR | DEPTH | STENSIL)`, not just `glClear(mask = COLOR)` which we have when using https://docs.unity3d.com/ScriptReference/GL.Clear.html GL.Clear functionality even with the "clear depth" set to true? OpenGL somehow still clears the depth and stensil buffers, but they don't seem to register themselves as such on the driver (I've been checking it with native profilers for a while now)
    This complete clear can be beneficial on tile-based mobiles and I'm not really sure how to A/B test it using "clean" OpenGL scene vs Unity with that `GL.Clear` calls.

    Or I may be missing something and some clarification on clearing would be great.

    Also, one more thing. Would there be a way to change the final target renderbuffer depth and format "on-the-fly" and not just using a "use 32 bit framebuffer" build setting?
    I've asked about this on forums a while back and there was absolutely no way of changing this post-build (some Unity-tech guy told us), so we need to either have two builds for tegras / non tegras (32 bits for tegras up to X1 as they don't do dithering a lot) or use 32 bits for everything including Adrenos (and such), which they don't really need as dithering handles 16 bit buffer quite nicely.
    I'm not talking about the camera render target format, I'm talking about the actual final framebuffer texture in which we copy our currently rendered frame at the end (no control over that except the build settings)
     
  30. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    Take a look here, you can do it via command buffer:
    https://github.com/stramit/SRPBlog/...s/SRP-Demo/1-BasicAssetPipe/BasicAssetPipe.cs
    https://docs.unity3d.com/ScriptReference/Rendering.CommandBuffer.ClearRenderTarget.html

    Currently this is not changeable, it's something we want to investigate in the future given that HDR is becoming a real thing for TV's now.
     
    Kumo-Kairo likes this.
  31. Llockham-Industries

    Llockham-Industries

    Joined:
    Aug 4, 2013
    Posts:
    262
    Playing around with the HDRenderPipeline. It seems plausible that the Lightloop class and you're current lighting setups (FPTL /Cluster) could be separated and used within a bunch of different rendering pipelines. Currently, it's contained within the HDPipeline namespace and has a bunch of specific functions tied in that are only relevant to that pipeline.

    Would it be possible to move the functionality relevant to the HD Pipeline into an inherited class and have the core functionality relevant to those methods (building shadow maps, light lists/per-voxel light lists etc.) remain in an abstract class?

    By doing this, people building custom rendering pipelines could take advantage of these lighting models as well. You would just need to make the class inheritance friendly (Make things like s_LightList protected instead of private) and move the RenderDeferredLighting, RenderForwardLighting etc. commands to the inherited class. Then we could inherit our own versions for our pipelines and declare how we pass in the light-lists and perform the actual lighting ourselves.

    My use-case - Building a custom deferred rendering pipeline that has no support for transparent objects or SSS (Toon shaded) (Can fake SSS much cheaper and in a way that fits the toon aesthetic better). This pipeline has no need for the depth-prepass (As we will never need forward rendered objects (that need to be lit, can draw particles / unlit objects later)), SSS (and thus multiple color buffers in the deferred lighting pass) and would only ever need FPTL.

    The approach I suggested above is likely not the best approach, I'm still wrapping my head around everything, but modularizing and exposing your lighting system(s), similar to how you have begun to do with your shadowmanager class makes a lot of sense. Love your work, keep it up <3.
     
    OCASM and Alverik like this.
  32. Llockham-Industries

    Llockham-Industries

    Joined:
    Aug 4, 2013
    Posts:
    262
    I also noticed that you have dedicated shader passes for motion vectors, which is awesome. Using shader replacement always had problems with tesselation/ vertex displacement. Do you have any plans on adding a dedicated high-precision normal pass as well? You could pack it into the motion vector pass as a compiler variation; ie. have it output motion vectors, normals, or a combination of the 2 depending on what's required.

    Several effects, like ScreenSpace reflection (Which is noticeably not supported) or Screenspace decals rely on high precision normals, and without a dedicated pass (ie. falling back to shader replacement) they couldn't support vertex displacement/ tesselation (In forward rendering at least).

    For me, and others building post-process effects and assets, having a reliable high precision normal buffer available would be really nice, and if done correctly there shouldn't be a performance cost, just a little extra code to maintain.

    Edit - In hindsight, it would probably be better paired with the depth pre-pass not the motion vector pass, as that way it could be combined with deferred (when in use) to get an accurate buffer of all deferred and forward rendered objects. You could use your lighting stencil mask to combine them.
     
    Last edited: Jan 31, 2018
    Alverik and GameDevCouple_I like this.
  33. levi777l

    levi777l

    Joined:
    Mar 13, 2014
    Posts:
    14
    Will it be possible to do culling off of other perspectives then a camera? aka, I want to cull based on what the player model can see in a 3rd person AR/VR game instead of what the player can see with the camera.
     
  34. Mikekan13

    Mikekan13

    Joined:
    May 30, 2015
    Posts:
    72
    Does the HD pipeline not work with VR yet? I thought I set it up correctly but I am getting a constant dimensions of color surface does not match dimension of depth surface error when I try to run it and nothing on my HMD.
     
  35. Rok

    Rok

    Joined:
    Feb 10, 2014
    Posts:
    4
    I hope this is the right place to talk about this. I'm having quite some trouble setting up a project using the LW pipeline that will successfully build for iOS. I'm not sure if I'm running into bugs or if I'm doing something wrong on my part.
    Here's what I've tried so far (versions used: Unity 2018.1.0b5, Render-pipelines.lightweight 0.1.21, Shadergraph 0.1.9)

    1. Create new project from launcher using "Lightweight - Preview" template
    2. Scene looks fine, switch platform to iOS
    3. Build
    4. Error: C:/ProgramData/Unity/cache/packages/packages.unity.com/com.unity.render-pipelines.lightweight@0.1.21/Data/LightweightPipelineAsset.cs(2,19): error CS0234: The type or namespace name `ProjectWindowCallback' does not exist in the namespace `UnityEditor'. Are you missing an assembly reference?
    5. Try updating lightweight pipeline to 0.1.28 and shadergraph to 0.1.17 using Package Manager UI
    6. Cube turns pink, bunch of errors in console (lots of "failed to open source file")
    7. Reimport all, be full of hope :)
    8. Cube is red again, ground is now shiny and metallic, also: errors in console
      This time lots of
      "AssetDatabase.FindAssets: Folder not found: 'Packages/com.unity.render-pipelines.lightweight'
      UnityEditor.AssetPreviewUpdater:CreatePreviewForAsset(Object, Object[], String)"
      and
      "ArgumentNullException: Argument cannot be null.
      Parameter name: shader"
    I'm somewhat unsure how to proceed. Any advice would be appreciated :)
     
  36. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    From here manually edit the 'Render Pipeline Asset' and then save the project. On restart it should work properly (we are fixing this now).

    This warning you can ignore: "AssetDatabase.FindAssets: Folder not found: 'Packages/com.unity.render-pipelines.lightweight'
     
  37. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    Actually you can probably just build from where you got to and be fine, there is a pipeline asset update issue between 21 ->28 which spews warnings and errors but should still run after update.

    Also right now: Updating SRP packages while unity is running is not recommended :( Restart should fix that.
     
  38. Rok

    Rok

    Joined:
    Feb 10, 2014
    Posts:
    4
    Thank you, @Tim-C! That worked and I was finally able to build for iOS and run it on my iPhone. Unfortunately, another issue popped up and again, I don't know if this is related to SRP at all. It looks like the lightmaps are broken on the device. In the editor, everything looks fine.
    IMG_1509.PNG
     
  39. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    I've notified our QA, they'll take a look into it.
     
    Rok likes this.
  40. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,372
    @SebLagarde is there an option to limit shadow drawing distance per light in the current HDRP? Basically like the global shadow distance limit but per light setting.
    example usage case is : i have a scene with a lot of point/spot light in it (worse case), but i just want the point/spot light that is closest the player to draw the shadows.
     
  41. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    Got asked a question about graphics settings in SRP land here is the response:

    From now on we are migrating settings from quality settings towards the SRP asset itself.

    When you make a game / title you can use multiple pipeline assets and switch them at runtime, for example you could have a HQ asset that has high shadow resolution, and a LQ asset that has no shadows.

    In your game you can switch these out via api.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using UnityEngine.Experimental.Rendering.LightweightPipeline;
    4. using UnityEngine.Rendering;
    5.  
    6. public class SwitchQuality : MonoBehaviour
    7. {
    8.     public LightweightPipelineAsset lowQuality;
    9.     public LightweightPipelineAsset highQuality;
    10.  
    11.     void OnGUI()
    12.     {
    13.         if (GUILayout.Button("Low Quality"))
    14.             GraphicsSettings.renderPipelineAsset = lowQuality;
    15.         if (GUILayout.Button("High Quality"))
    16.             GraphicsSettings.renderPipelineAsset = highQuality;
    17.  
    18.         var lwAsset = GraphicsSettings.renderPipelineAsset as LightweightPipelineAsset;
    19.         if (lwAsset == null)
    20.             return;
    21.  
    22.         if (lwAsset.ShadowSetting == ShadowType.SOFT_SHADOWS && GUILayout.Button("Shadows Off"))
    23.             lwAsset.ShadowSetting = ShadowType.NO_SHADOW;
    24.  
    25.         else if (lwAsset.ShadowSetting == ShadowType.NO_SHADOW && GUILayout.Button("Shadows On"))
    26.             lwAsset.ShadowSetting = ShadowType.SOFT_SHADOWS;
    27.     }
    28.  
    29. }
    30.  
    Few examples:
    1) switching between presets (high / low quality)
    2) switching shadows on / off on CURRENT pipeline.

    This is much more flexible than the existing quality / graphics settings and can be tailored to your game.
     
  42. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    how could one modify the render pipeline to fix the viewmodel problems? (using fps objects and clipping issues)
     
  43. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    Going to need more background on this...
     
    shkar-noori likes this.
  44. Gray_Master

    Gray_Master

    Joined:
    Jun 20, 2010
    Posts:
    152
    Why in 2018.1 before run project (in editor) starting check & compile all actives in "Assets" folder? In unity 2017.3 this action is not detected
     
  45. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    Should just be shaders, we have a fix for the next beta :)
     
  46. Gray_Master

    Gray_Master

    Joined:
    Jun 20, 2010
    Posts:
    152
    really, only shaders but from all actives.
    yes, & hide pls inspector window in editor run mode
    thx for you answer
     
    Last edited: Feb 2, 2018
  47. petersx

    petersx

    Joined:
    Mar 5, 2015
    Posts:
    215
    @Tim-C

    How to use specular map with subsurface scattering id SRP HD ?

    Anybody know ? Unity, please respond ;)
     
    Last edited: Feb 2, 2018
  48. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,372
    I think he might be asking about rendering First Person Meshes without getting clipping and custom FOV also interacting with shadow from the world
     
    shkar-noori likes this.
  49. Zahidylin_Marat

    Zahidylin_Marat

    Joined:
    Jul 28, 2012
    Posts:
    111
  50. Zahidylin_Marat

    Zahidylin_Marat

    Joined:
    Jul 28, 2012
    Posts:
    111
    This didnt help me....dont know where to put com.unity.template.hd inside new project.