Feedback Wanted: Scriptable Render Pipelines

IMPORTANT
Are you on unity 2017.3 beta and want to use SRP? Good new we maintain an active branch now located on git.

https://github.com/Unity-Technologies/ScriptableRenderPipeline/tree/Unity-2017.3#how-to-use-the-latest-version

How to use the latest version
The repository no longer consists of a complete Unity project, but rather assumes to be put inside a sub-folder of the Assets\ folder of an existing Unity project. Make sure that your project uses linear color space (Edit > Project Settings > Player).

Perform the following instructions to get a working copy of SRP:

> cd <Path to your Unity project>/Assets
> git clone https://github.com/Unity-Technologies/ScriptableRenderLoop
> cd ScriptableRenderLoop
> git submodule update --init --recursive --remote

After you launch the project go to graphics settings and select a render pipeline to work with. Currently I recommend staring with the light weight as it’s a little simpler and more mature.

Scriptable Render Pipelines
The SRP project aims to redefine how Unity does rendering at all levels, up until now rendering in has been very strictly defined by Unity. There was of course hook points into the engine to modify behaviour, but it was quite limited. SRP is how we are opening up the rendering engine inside Unity to you!


Low End Pipeline Test scene
What is it?
The Scriptable Render Pipeline (previously known as “scriptable render loops”), is a new way of configuring and performing rendering in Unity! It’s a massive conceptual shift away from how we currently to do things and is designed to completely redefine what Unity is capable of when it comes to rendering!

Currently in Unity we provide a number of rendering configurations (for example: forward rendering and deferred rendering). These pipelines are fixed and created by us; what this means is that we are dictating to you how rendering should happen. This has a number of downsides:

  • You can’t fix or workaround rendering issues.
  • The pipelines are large and complex, as they have to handle all use cases.
  • It’s very difficult to add state-of-the-art effects due to legacy and complexity.

Really, we are trying to do everything for everyone and that doesn’t scale. We remove complexity and allow massive flexibility. This is where the pipelines come in!

How does it work?
Last year we released Graphics Command Buffers; this feature allowed you to inject custom rendering code into parts of the render pipeline. The SRP project is the next step. Complete rendering control is pushed from our internals into user-land C# scripting.

Instead of providing a monolithic rendering pipeline, what we provide with the SRP is a set of Lego-like blocks that you can plug together. Each block is well defined with a single function that is easy to test, improve, and maintain. It’s also easy for us to add new blocks to the engine as rendering technology advances and new techniques become available :slight_smile:

From a user point of view what happens is that there is a rendering entry point in a C# class, from there the you can do whatever they want! The long term goal here is to decouple the concepts of cameras and lights and similar from Unity internal rendering concepts. They will become data containers that the SRP can use to configure rendering.

Improving Unity
As we are developing all the above, we are also discovering various other pieces of “low level graphics” in Unity that need improving or are simply missing. Because of this we are doing a lot of improvements to compute shaders, shader compiliaton and variant handling, bug fixing shader translators, adding more flexibility to graphics buffer management, MS texture support improvements and so on. All that is not directly related to SRP, but are needed to do interesting things with it.


Low End Pipeline Test scene
What is it not?
SRP is a BIG project for us. The SRP allows for very fast iteration times and experiment with cutting edge techniques. Internally we are already writing a lot of cool new test frameworks and experimental renderers using the SRP. The iteration time is amazing!

That being said, at the core, the foundational SRP is NOT an artist tool. The pipelines that we provide and that you create will facilitate the creation of amazing content, but generally they will be written by a rendering programmer.

The specific pipelines that are created are where the artist friendly amazingness comes in. In these we can add specific shaders and tooling to create an amazing and artist friendly tool pipeline.

Awesome, how do I play with this?
Clone the project from github. The current head should work with the current 2017 beta. This is our in development location for render pipelines that will become part of the public release as they mature. Currently the most mature pipeline is the Low End pipeline. This is targeted towards mobile devices and is a good place to start investigation how to write a pipeline.

Is there a tutorial I can use?
Earlier this year I did a presentation at GDC about the render pipelines. The demo project is here. This runs on the current 2017 beta :slight_smile: The project builds a render pipeline up step by step and shows how to use many of the various features described in the slides :slight_smile:

3062864–230176–GDC17RenderPipes-2017.1.zip (269 KB)

22 Likes

Do you have any more info on what “pre-built” pipelines that will be shipped? There was talk about a VR one, is that still on the roadmap?

5 Likes

To start with ‘VR’ will be an option on the pipes that we ship with. To start with this will be an option on the Low-End pipe (may follow a few weeks after the main release of this pipe). As we move forward there will be more specific VR elements added to the pipes.

1 Like

Is 2017.1 still the release target or was it moved to 2017.2?

This is a two sided question, we have the core API, which is solidifying nicely but we are not going to remove the experimental tag until we are pretty confident that they can use our included pipelines to ship large scale projects that run really really well.

In reality what that means is that until the HDPipe, LDpipe, VR features are polished the experimental tag will remain on the feature. That being said the LDPipeline is getting really stable and at a good place in 2017.1 to start using. I foresee that in 2017.2 it will be usable for a large number of mobile games and even if the experimental tag remains on SRP as a whole this pipe will be passed that state.

5 Likes

Quick question, could internal matrices like unity_worldToLight and unity_worldToShadow be exposed to script on a per light basis with SRP? This would be super useful in the case of doing shadow mapping from a rendering plugin.

Okay, I’m gonna be the guy who asks that question:
Will the HD Pipeline be “crazy cool and all AAA-looking and all that”? (Or, on a more serious note, what can we expect out of the HD pipeline, when compared to Unity’s current pipeline? Will it even affect rendering quality at all?)

Also, am I imagining things or were you guys working on a node-based material editor at some point as part of this whole SRP project? I took a quick glance at the code and saw things like “Nodes” and “Input/Outputs” and “DefaultLit” and “SubsurfaceScattering”. I’m talking about this branch:


The branch seems abandoned. Will it resume at some point?

2 Likes

There are some (slightly outdated) details of what the HD pipe is like here: https://docs.google.com/document/d/1e2jkr_-v5iaZRuHdnMrSv978LuJKYZhsIYnrDkNAuvQ/edit#heading=h.gu5i27hc83ei But it’s all new and super hot (and still in early development).

We’ve been prototyping and hacking on a bunch of stuff internally (we always do), most stuff never reaches the light of day :frowning: We don’t have anything to announce here right now.

2 Likes

Oh hey, some of them are new. are those available in the master branch, compatible with latest beta?
as an artist would like to test them

1 Like

What do you mean by this? Which things are new?

@Tim-C Is there a way to mix new render pipelines with the old one? How do they interact with OnPreRender/OnPostRender, calling Camera.Render() manually, and other callbacks?

I’ll tell you a bit about the case I’m struggling with.

So, in our game we have a UI screen which can be opened at any time showing some 3D objects each with its own environment. Currently we do this by spawning the objects with a specific layer at some distance apart from each other where every object has a camera attached to it and a set of lights. As we cannot exclude all 31 other layers, we have to disable all scene lights and enable the lights associated with the current object on PreRender, then disable them and turn on the scene lights on PostRender. As you can imagine, it’s not very efficient :slight_smile:
Sometimes we need to draw such an object into a sprite. Which can also happen at any time in the game. For this, we do almost the same thing: spawn the object, the camera, and the lights, then manually call camera.Render(), readback image into a sprite and destroy them all in one frame. (By the way, I fear that Unity might be rebuilding UGUI layout for some reason when calling Camera.Render). So yes, it practically begs for a separate pipeline.

Now, I didn’t dig deep into the new system (just found out about it an hour ago), but as I see it, we can ignore the Camera[ ] array of Render method and keep our own list of cameras since we know which camera should draw the main view, and which cameras are used for rendering our 3D UI objects. Alternatively, we can iterate through the supplied array and check if the cameras are contained in our lists, or discern them by other means (tags, components). After that we need to re-create current Unity pipeline for our main camera (or hopefully we don’t have to) and write custom pipeline for other cameras. For such custom views since we know which objects we draw with which lights, we could create CullResults from them (couldn’t find a way, though), render and apply all the post-processing for each camera somehow. For the render-into-sprite camera we can probably keep it enabled at all times but don’t do any rendering unless there’s an object we need to photograph in our objects queue.

So, is this possible? Am I thinking in the right direction? Or is there an easier way?
Either way, I really like where this is all going. Keep up the good work.

for example the clear coat and subsurf/transmission shading. Last time i read that docs it was tagged (later), so i assume it’s implemented already.
or am i assuming wrong?

The current head dos not work with Unity 2017.1.0b5. (or I’m missing something hr)

-----CompilerOutput:-stderr----------
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(4,32): error CS0234: The type or namespace name `PostProcessing' does not exist in the namespace `UnityEngine.Experimental'. Are you missing an assembly reference?
Assets/ScriptableRenderPipeline/BasicRenderPipelineTutorial/BasicRenderPipeline.cs(33,44): error CS0246: The type or namespace name `RenderPipeline' could not be found. Are you missing an assembly reference?
Assets/ScriptableRenderPipeline/fptl/FptlLighting.cs(99,41): error CS0246: The type or namespace name `RenderPipeline' could not be found. Are you missing an assembly reference?
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(285,45): error CS0246: The type or namespace name `RenderPipeline' could not be found. Are you missing an assembly reference?
Assets/ScriptableRenderPipeline/LowEndMobilePipeline/LowEndMobilePipeline.cs(49,41): error CS0246: The type or namespace name `RenderPipeline' could not be found. Are you missing an assembly reference?
Assets/ScriptableRenderPipeline/BasicRenderPipelineTutorial/BasicRenderPipeline.cs(35,26): error CS0115: `BasicRenderPipelineInstance.Render(UnityEngine.Experimental.Rendering.ScriptableRenderContext, UnityEngine.Camera[])' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/common/Debugging/DebugItemDrawer.cs(262,25): warning CS0108: `UnityEngine.Experimental.Rendering.DebugItemDrawerIntEnum.m_EnumStrings' hides inherited member `UnityEngine.Experimental.Rendering.DebugItemDrawer.m_EnumStrings'. Use the new keyword if hiding was intended
Assets/ScriptableRenderPipeline/common/Debugging/DebugItemDrawer.cs(18,36): (Location of the symbol related to previous warning)
Assets/ScriptableRenderPipeline/common/Debugging/DebugItemDrawer.cs(263,25): warning CS0108: `UnityEngine.Experimental.Rendering.DebugItemDrawerIntEnum.m_EnumValues' hides inherited member `UnityEngine.Experimental.Rendering.DebugItemDrawer.m_EnumValues'. Use the new keyword if hiding was intended
Assets/ScriptableRenderPipeline/common/Debugging/DebugItemDrawer.cs(19,29): (Location of the symbol related to previous warning)
Assets/ScriptableRenderPipeline/fptl/FptlLighting.cs(111,30): error CS0115: `UnityEngine.Experimental.Rendering.Fptl.FptlLightingInstance.Dispose()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/fptl/FptlLighting.cs(118,30): error CS0115: `UnityEngine.Experimental.Rendering.Fptl.FptlLightingInstance.Render(UnityEngine.Experimental.Rendering.ScriptableRenderContext, UnityEngine.Camera[])' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(131,32): error CS0115: `UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.GetDefaultShader()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(136,34): error CS0115: `UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.GetDefaultMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(141,34): error CS0115: `UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.GetDefaultParticleMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(146,34): error CS0115: `UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.GetDefaultLineMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(151,34): error CS0115: `UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.GetDefaultTerrainMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(156,34): error CS0115: `UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.GetDefaultUIMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(161,34): error CS0115: `UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.GetDefaultUIOverdrawMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(166,34): error CS0115: `UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.GetDefaultUIETC1SupportedMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(171,34): error CS0115: `UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.GetDefault2DMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(323,18): error CS0246: The type or namespace name `PostProcessRenderContext' could not be found. Are you missing an assembly reference?
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(414,30): error CS0115: `UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipelineInstance.Dispose()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(565,30): error CS0115: `UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipelineInstance.Render(UnityEngine.Experimental.Rendering.ScriptableRenderContext, UnityEngine.Camera[])' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/LowEndMobilePipeline/LowEndMobilePipeline.cs(83,30): error CS0115: `UnityEngine.Experimental.Rendering.LowendMobile.LowEndMobilePipeline.Render(UnityEngine.Experimental.Rendering.ScriptableRenderContext, UnityEngine.Camera[])' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/LowEndMobilePipeline/LowEndMobilePipelineAsset.cs(163,34): error CS0115: `UnityEngine.Experimental.Rendering.LowendMobile.LowEndMobilePipelineAsset.GetDefaultMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/LowEndMobilePipeline/LowEndMobilePipelineAsset.cs(168,34): error CS0115: `UnityEngine.Experimental.Rendering.LowendMobile.LowEndMobilePipelineAsset.GetDefaultParticleMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/LowEndMobilePipeline/LowEndMobilePipelineAsset.cs(173,34): error CS0115: `UnityEngine.Experimental.Rendering.LowendMobile.LowEndMobilePipelineAsset.GetDefaultLineMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/LowEndMobilePipeline/LowEndMobilePipelineAsset.cs(178,34): error CS0115: `UnityEngine.Experimental.Rendering.LowendMobile.LowEndMobilePipelineAsset.GetDefaultTerrainMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/LowEndMobilePipeline/LowEndMobilePipelineAsset.cs(183,34): error CS0115: `UnityEngine.Experimental.Rendering.LowendMobile.LowEndMobilePipelineAsset.GetDefaultUIMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/LowEndMobilePipeline/LowEndMobilePipelineAsset.cs(188,34): error CS0115: `UnityEngine.Experimental.Rendering.LowendMobile.LowEndMobilePipelineAsset.GetDefaultUIOverdrawMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/LowEndMobilePipeline/LowEndMobilePipelineAsset.cs(193,34): error CS0115: `UnityEngine.Experimental.Rendering.LowendMobile.LowEndMobilePipelineAsset.GetDefaultUIETC1SupportedMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/LowEndMobilePipeline/LowEndMobilePipelineAsset.cs(198,34): error CS0115: `UnityEngine.Experimental.Rendering.LowendMobile.LowEndMobilePipelineAsset.GetDefault2DMaterial()' is marked as an override but no suitable method found to override
Assets/ScriptableRenderPipeline/LowEndMobilePipeline/LowEndMobilePipelineAsset.cs(202,32): error CS0115: `UnityEngine.Experimental.Rendering.LowendMobile.LowEndMobilePipelineAsset.GetDefaultShader()' is marked as an override but no suitable method found to override
-----EndCompilerOutput---------------

I second that, exactly nothing works.

use B2 branch

Sorry, which branch??? :eyes:

There was a 2017.1 beta 2 branch a few days ago put apparently it disappeared

EDIT: nevermind, it’s in the “Releases” section: https://github.com/Unity-Technologies/ScriptableRenderLoop/releases

1 Like

oh it’s updated to b5 already.

…unfortunately I’m still having errors in b5 with PostProcessing namespace

This version is better, but in fact it was last open by:
m_EditorVersion: 2017.1.0b3

Most of the errors are gone. There is two left:

-----CompilerOutput:-stderr----------
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(4,32): error CS0234: The type or namespace name `PostProcessing' does not exist in the namespace `UnityEngine.Experimental'. Are you missing an assembly reference?
Assets/ScriptableRenderPipeline/common/Debugging/DebugItemDrawer.cs(262,25): warning CS0108: `UnityEngine.Experimental.Rendering.DebugItemDrawerIntEnum.m_EnumStrings' hides inherited member `UnityEngine.Experimental.Rendering.DebugItemDrawer.m_EnumStrings'. Use the new keyword if hiding was intended
Assets/ScriptableRenderPipeline/common/Debugging/DebugItemDrawer.cs(18,36): (Location of the symbol related to previous warning)
Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs(271,18): error CS0246: The type or namespace name `PostProcessRenderContext' could not be found. Are you missing an assembly reference?
-----EndCompilerOutput---------------