Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Feedback Wanted: Scriptable Render Pipelines

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

  1. sewy

    sewy

    Joined:
    Oct 11, 2015
    Posts:
    57
    Has anyone had luck with reimplementing replacement shader i SRP? Or have workable example of DrawRendererSettings.SetOverrideMaterial used instead of replacement shader? Or is there another way to achieve the same, what replacement shader was ment for?
     
  2. PsycHead

    PsycHead

    Joined:
    Sep 14, 2012
    Posts:
    17
    Hey,
    I am currently trying to implement my own 2D pipeline with simplified quasi 2D deferred lighting using the SRP. For that I built a basic pipeline from scratch, which I am currently pretty satisfied with.

    As it stands, there are two issues with it:
    1.) ShaderGraph requires a master node for the new Pipeline.
    2.) The post processing Stack does not work out of the box with it. (I suppose an updated shader will fix this?)

    I browsed the code of the LWRP, but so far I don't see how to solve the first issue without an unproportional effort.
    Are there any resources or hints available to solve those two issues already?
     
    Last edited: Sep 20, 2018
  3. Arnklit

    Arnklit

    Joined:
    May 18, 2015
    Posts:
    43
    Does the HDRP only work with DX11 at the moment? I tried switching to Vulkan and enabling Vulkan in the editor and that made Unity crash, then I tried DX12 and that just turned the editor view completely black.

    EDIT: Ah after entering play mode in DX12 the views look normal, still not having luck with Vulkan though.
     
  4. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,399
    Both Vulkan and DX12 were mentioned under platform support in the following post from early July:

    #758

    But I suspect DX11 gets more testing, at least during moments of lots of changes and heavy development (eg github versions of pipelines and unity betas as opposed to package manager versions). Its probably a good idea for you to mention which pipeline version and Unity version you tried with, since that may well make a difference.
     
  5. Arnklit

    Arnklit

    Joined:
    May 18, 2015
    Posts:
    43
    Ah good point. 2018.2.8f1 and HDRP 3.0.0

    Yeah Vulkan seems to crash the editor almost immediately after I switch to it. Luckily when reopening the project it will have gone back to another API.
     
  6. TerraUnity

    TerraUnity

    Joined:
    Aug 3, 2012
    Posts:
    729
    Has anyone tried the latest git (4.0.0) with 2018.3.0b2? I'm receiving these errors continuously:

    Kernel 'KSampleCopy4_1_x_8' not found



    ArgumentException: Kernel 'KSampleCopy4_1_x_8' not found.
    UnityEngine.Experimental.Rendering.GPUCopy..ctor (UnityEngine.ComputeShader shader) (at myhdrp/com.unity.render-pipelines.high-definition/Runtime/CoreRP/CoreResources/GPUCopy.cs:16)
    UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline..ctor (UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipelineAsset asset) (at myhdrp/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs:229)
    UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipelineAsset.InternalCreatePipeline () (at myhdrp/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipelineAsset.cs:22)
    UnityEngine.Experimental.Rendering.RenderPipelineAsset.CreatePipeline () (at C:/buildslave/unity/build/Runtime/Export/RenderPipeline/RenderPipelineAsset.cs:19)
    UnityEngine.Experimental.Rendering.RenderPipelineManager.PrepareRenderPipeline (UnityEngine.Experimental.Rendering.IRenderPipelineAsset pipe) (at C:/buildslave/unity/build/Runtime/Export/RenderPipeline/RenderPipelineManager.cs:55)
    UnityEngine.Experimental.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Experimental.Rendering.IRenderPipelineAsset pipe, UnityEngine.Camera[] cameras, System.IntPtr loopPtr) (at C:/buildslave/unity/build/Runtime/Export/RenderPipeline/RenderPipelineManager.cs:28)
    UnityEngine.


    The main reasons I want to test the latest release are the TerrainLit shader and this line:
    • Fixed support of depth for RenderTexture. HDRP now correctly output depth to user depth buffer if RenderTexture request it.

    Update: Also the mentioned date for 4.0.0 release at the chaneglog HERE is 2019 instead of 2018 @SebLagarde
     
    Matt-Murch likes this.
  7. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,379
    Wow that's a big jump
     
  8. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,194
    I've been running latest master with the HD Template scene without that kind of issues. You often get lots of warnings after swapping the SRP but they get cleared on next restart. Also always use github SRP with combo of core, hdrp and shadergraph, put all those three in your Packages folder even if you don't use SG or you need to fix the assemblies manually (and make sure to remove the entries from the manifest when you put these to local folder).

    Worth noting that current SRP master and 2018.3.0b1 and b2 require the custom SRP to exist in that Packages folder, you can't use the file ref thing (add local package thing from new package manager). If you use the file thing on your manifest, your shaders will not compile properly atm. According to Unity dev this will be changed in the future betas and you can then use the packages that other way too.
     
    Last edited: Sep 22, 2018
    TerraUnity likes this.
  9. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    572
    I got this error as well and what seemed to fix it was removing (com.unity.testframework.graphics) package VFX Editor doesn't seem to work without it though but this fixed it. (Might just be something specific that would affect it but was too lazy to hunt it down so I just removed the whole folder/package)

    This happened a while back with 3.0.0 it came up on the master early in 2018.2 cycle then after a week or so it switched back to the regular 2.x.x cycle. Might be the same thing happening.
     
  10. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,194
    Reason why they bumped it to 4.x.x was that they had API breaking changes so they wanted to differentiate this.
     
    TerraUnity likes this.
  11. TerraUnity

    TerraUnity

    Joined:
    Aug 3, 2012
    Posts:
    729
    @rizu Thank you so much for the answer, that solved the problem and all errors are gone now with the latest master branch.

    Yes I was using file refs in json and local packages, just had to copy the packages into the Packages folder in project and remove refs from the manifest. Where did you get these info? ;)

    Quickly tested with the new terrain shaders and all seems fine, that's a great step forward in HDRP development.

    Also the camera now renders depth into a RenderTexture correctly, finally :D


    HDRP_Depth.JPG
     
  12. TerraUnity

    TerraUnity

    Joined:
    Aug 3, 2012
    Posts:
    729
    Thanks for the answer. In my case as stated in the above post, just had to put all the content of the master branch into the Packages folder of the project and remove file refs from the manifest.

    I was referring to the release date in the chanelog page which is "2019-09-21" instead of "2018-09-21" not the ver. number. So maybe we are on a time machine with all these goodies from Unity :p
     
  13. Arnklit

    Arnklit

    Joined:
    May 18, 2015
    Posts:
    43
    Yeah I'm getting "Kernel 'KSampleCopy4_1_x_8' not found" as well. And removing the testframework didn't make any difference. Very annoying since it looks like the PCSS shadows are finally available, from looking at the latest commits.
     
  14. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,194
    I've been maintaining this for testing purposes only: https://forum.unity.com/threads/experimental-srp-for-testing-new-features.554455/ and noticed that Unity swapped the shader including convention while upgrading it to latest SRP master. I've also converted a lot of assets to the new package manager format and knew their way wouldn't work with current Unity versions (I've tried it before and it failed so I had to work around it). I found the workaround by just testing if it would work on Packages folder directly (I knew already you can also place things there for local use).

    As for the info about the ref thing being fixed in future versions, I reported that and some other issues on this thread and got that answer there: https://forum.unity.com/threads/about-upcoming-hdrp-feats-2-issues-atm.556024/
     
    Last edited: Sep 22, 2018
  15. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,194
    @Arnklit see my previous response on this:
     
  16. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,194
    Last edited: Sep 24, 2018
  17. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    Hi,
    For 1) We are developing on the master branch and master branch is only guarantee to work on latest (internal) trunk for C++. You have get a revision that will be compatible only with a future 2018.3 beta. This is expected.

    Just to explain what is happening: With regard to SRP versioning, we use semver (https://semver.org/). This means that every time we break API we are required to bump the major version associated with the package. This means that during a release cycle we may bump this 2 or three times. We are actually holding off doing a release of 4.x.x for a few days as we have some breaking changes that will land and don't want to do a 4.x, and a 5.x so close together.

    When it comes to the error you are seeing above, this is expected as the master version on gihub is compatible with the internal version of unity that is yet to be released (beta 3). The only guarentee we can make is that the tagged release version will work with the current version of unity. This is because as we improve core unity, we roll those changes across into the master of github and we use new API that does not exist in older unity. This sucks, and we don't like it, but there isn't really a better way at the moment. Most of the time master will run on the 'current' version of unity, but sometimes it doesn't. And that's right now ;( When beta 3 comes out it will start running again.

    Oops, will fix :)
     
  18. Arnklit

    Arnklit

    Joined:
    May 18, 2015
    Posts:
    43
    @Tim-C Thanks for the explanation, makes perfect sense. I'm looking forward to Beta 3 now, lots of little improvements I'm eager to try.
     
  19. TerraUnity

    TerraUnity

    Joined:
    Aug 3, 2012
    Posts:
    729
    @Tim-C Thanks for the clarifications Tim, there's nothing wrong about all these occasions while you and your team are revolutionizing the core engine, that's what we were always waiting for :)
     
  20. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    209
    Is there any way to copy camera depth buffer to the texture in the custom postprocessing effect? (for some reason I need this, because I can't use _CameraDepthTexture).

    I try to do something like this:

    Code (CSharp):
    1. public sealed class SomeRenderer : PostProcessEffectRenderer<SomeEffect> {
    2.     readonly int depth = Shader.PropertyToID("_CustomDepth");  
    3.    
    4.     Material coptyDepth;
    5.    
    6.     public override void Init(){      
    7.         var hdrp = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;
    8.         coptyDepth = CoreUtils.CreateEngineMaterial(hdrp.renderPipelineResources.copyDepthBuffer);
    9.     }
    10.    
    11.     public override void Render(PostProcessRenderContext context){
    12.         ...
    13.         context.command.GetTemporaryRT(depth, context.width, context.height, 24, FilterMode.Bilinear, RenderTextureFormat.Depth, RenderTextureReadWrite.Default, 1);
    14.         coptyDepth.SetTexture(HDShaderIDs._InputDepth, ???);
    15.        
    16.         context.command.Blit(context.source, depth, coptyDepth);
    17.         ...
    18.     }
    19. }
    but I dont understand what I should write instead of ???
     
  21. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,399
    Last edited: Sep 25, 2018
  22. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    rizu, elbows and hippocoder like this.
  23. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    3,895
    Use CommandBuffer.CopyTexture() ? More specifically in the RenderLoop you have:
    void CopyDepthBufferIfNeeded(CommandBuffer cmd) which does exactly that.
     
  24. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    1,856
    4.0 preview spams
    The camera list passed to the render pipeline is either null or empty.

    In your console if you don't have a camera in the scene when in editor mode (my camera is initialized on start) even if you turn off the "Warn if No Cameras Rendering" option

    (Tested from LWRP but I'm assuming it'll be an issue for all RPs)
     
    Last edited: Sep 30, 2018
  25. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,194
    While not the real solution, you know that collapse option on console? It's really handy for suppressing repetitive warnings.
     
  26. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    385
    That's specific to LWRP. I'll look into adding the check for Warn if No Cameras Rendering.
     
  27. BlakeSchreurs

    BlakeSchreurs

    Joined:
    Aug 10, 2016
    Posts:
    33
    Hey folks,
    I have an effect that I have working in an older graphics pipeline that I want to reproduce in the SRP/HDRP, but working at this level is pretty new to me and I'm stuck.

    I have two cameras, and want to render the same scene differently for each camera... In the existing approach, I have a material that has some data the first camera isn't using, and for the second camera I use a replacement shader in order to render the information side-by-side. None of this seems to work at all in the HDRP. In the Catlike Coding custom pipeline tutorial I see where I can add logic to render different cameras different ways, and I can replace materials for groups of objects, but I'm not seeing a way to swap out shaders or replace materials object-by-object. Am I just overlooking something? Is there a simpler approach?
     
  28. akilar1002

    akilar1002

    Joined:
    Jul 18, 2016
    Posts:
    11
    I tried to develop my own SRP. I am currently using PerObjectLightIndices8 to draw objects, which will cause the GPU instancing to fail. If I want to draw a lot of grass and want to be affected by multi lights, there is no way to use GPU instancing.

    This problem will happen on LWSRP.

    What should I do?
    Thanks a lot.
     
  29. CG_Bull

    CG_Bull

    Joined:
    Feb 12, 2017
    Posts:
    70
    I want to know for Sphere, Disk, Tube shapes arealight and AreaLightShadow will be support in future?
     
  30. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,194
    This PR has been sitting on the SRP's open PRs for a good while: https://github.com/Unity-Technologies/ScriptableRenderPipeline/pull/192
    it adds at least disk/sphere area lights but it also seems to be a third party PR and not from Unity directly.
     
    CG_Bull likes this.
  31. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,379
    Ooohh patapom, he create cool stuff usually
     
  32. onnep

    onnep

    Joined:
    Jan 3, 2018
    Posts:
    10
    I am trying to use my own custom passes. Should this work: RegisterShaderPassName("CustomPass")?

    I tried setting up a Pass and register a name there. But It does not seem to have effect on which passes get rendered by the camera.

    If I add:
    RegisterShaderPassName("SRPDefaultUnlit");
    ...then the first pass in the shader seems to be rendered no matter the name of the Pass in the shader.

    (on top of LWRP 3.0.0 preview)
     
    Last edited: Oct 17, 2018
  33. MarGon

    MarGon

    Joined:
    Mar 21, 2015
    Posts:
    1
    Hi, I recently checked out the HD Render Pipeline. Really great work there.
    I worked with some materials that used the Pixel Displacement and realize soon, that without a reference height property it limits the usecases a lot. It would be good to see a propertie like this in the shaders.
    Cheers, Marcel
     
  34. litefeel

    litefeel

    Joined:
    Dec 6, 2016
    Posts:
    45
    Hi.
    Does LW Render Pipeline always support only one pass?
    There are a lot of special effects that require 2 pass.
    Will LW Render Pipeline support multiple pass in the future?
    Thanks.
     
  35. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    210
    Sigh. I'm still getting the
    KSampleCopy4_1_x_8 errors after trying everything I can think of (including following the advice of @rizu to the letter as far as I can tell)

    Is there an ETA when this will appear in the package manager as a preview so I can install it that way? Or does anyone feel like posting an entire working project directory so i can give it a go that way?
     
  36. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,194
    @andybak what are you actually trying to do? (it's not obvious from your message). Like what SRP you are trying to use and on what Unity version?
     
  37. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    210
    @rizu - just try out Visual Effect Graph in 2018.3.0b7
     
  38. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    572

    Not sure if this was the fix for that error but if your project isn't set to .Net 4x then the SRP won't fully compile in 2018.3
     
  39. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    210
    @Grimreaper358 - nah. Checked that.

    It looks like GPUCopy.compute is failing to compile at line 4. It can't find
    Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl for some reason (it's in the right place)
     
  40. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    210
    Ah. A reimport seems to be fixing things. Not sure what happened exactly.
     
    Grimreaper358 likes this.
  41. sendspace

    sendspace

    Joined:
    Jul 24, 2016
    Posts:
    27
    is new v5 hdrp support unity 2018.3 ?
     
  42. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,194
    it's not, if you look at package.json, it says it requires 2019.1. Use 4.x for 2018.3
     
  43. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    210
    Similar to Shader Graph I see lots of code embedded in strings:

    Code (CSharp):
    1.  outSource += @"
    2. float rNorm = sqrt(volumeFactor + (1 - volumeFactor) * RAND);
    3.  
    4. float2 sincosTheta;
    5. sincos(theta, sincosTheta.x, sincosTheta.y);
    6.  
    7. direction = float3(sincosTheta, 0.0f);
    8. position.xy += sincosTheta * rNorm * ArcCircle_circle_radius + ArcCircle_circle_center;
    9. ";
    Is there really no better way to implement this? It seems a fairly primitive way of going about things.
     
  44. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,399
    Crude but effective would be my judgement. I'm sure its the same story with the Visual Effects Graph, where the graph actually creates HLSL compute shaders behind the scenes, which are then compiled just like hand written HLSL would be. I dont see why it matters.
     
  45. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    209
    You can put hlsl code into file and than load it in the node class.
     
  46. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    210
    Yeah. That's rather what I was thinking. Which makes it puzzling to see it implemented the way it has been.
     
  47. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    We are slowly moving to having the HLSL be more expressive and in a separate file. When we did it we didn't need this extra expression and 1 file is easier to manage than 2.
     
  48. sendspace

    sendspace

    Joined:
    Jul 24, 2016
    Posts:
    27
  49. rizu

    rizu

    Joined:
    Oct 8, 2013
    Posts:
    1,194
    sendspace likes this.
  50. dandepeched

    dandepeched

    Joined:
    Feb 22, 2016
    Posts:
    30
    I have my visual part broken on Android and iOS because of some LWRP shaders not supported with the following error:
    ERROR: 'gl_FragDepthEXT' : undeclared identifer

    Affected shaders:
    Hidden/LightweightPipeline/ScreenSpaceShadows
    Hidden/Lightweight Render Pipeline/CopyDepth
    Hidden/BlitCopyWithDepth
    Hidden/Internal-MotionVectors

    Can someone help to fix it?