The document discusses Unity's new scriptable render pipeline which aims to provide more flexibility and extensibility over Unity's built-in render pipeline. The new pipeline separates the low-level, performance critical rendering code written in C++ from the high-level configuration code written in C#. This will allow developers to create customized render pipelines for different hardware, techniques, or use cases. Examples provided include a potential HD render pipeline targeting modern platforms and an optimized VR pipeline. The document also provides code samples for setting up a basic render pipeline and techniques like shadows and profiling.
4. Unity’s Current Render Pipeline
• Forward or deferred.
• Different options available to tweak the rendering:
• - Custom shaders for surface and lighting
• - Command buffers
• - Compute shaders
• - Post-processing effects
• Works well on multitude of platforms.
5. In Practice…
• Hard to configure for your needs.
• Different rendering techniques
• Different platforms:
• - Different platform strengths
• - Different optimisation strategies
6. The Flexibility/Extensibility Problem
• Not a problem for most users but more advanced teams wants to modify
or extend unity’s rendering.
• Unity’s rendering pipeline is essentially a black box:
• - Documentation, presentations and shader source code available.
• - Still difficult to understand without a source code license.
14. Goals of The New Pipeline
• Need to perform better on modern hardware.
• Low-level, performance critical code in C++.
• High-level, less performance critical code in C#.
• No magic => Open-sourced and available on GitHub.
• https://github.com/Unity-Technologies/ScriptableRenderLoop
15. Goals of The New Pipeline
• Possibility to create multiple rendering pipelines
• - Built for a specific target in mind: hardware or use case.
• - Less compromises, more flexible, more performance.
• Easier dealing with backwards compatibility
• - Difficult to make changes to rendering.
• - Users expect things to continue working.
16. Examples of Rendering Pipelines
• HD: targeting “high end”, modern PC and consoles.
• VR: optimized for VR and caching/sharing eye data and different viewport
schemes.
• Low-End/Mobile: optimized for low-end devices or simpler 2D games.
17. The New Foundations
• Engine: C++, performance critical code
• - Culling
• - Rendering set of objects with filtering, sorting, and batching.
• - Platform abstraction.
• User project: C# and shaders, open source
• - Camera, light, and shadow setup
• - Frame render pass structure and logic
• - Shader (including compute) code.
19. HD Render Pipeline: Current Plans
• Provide a built-in render pipeline targeting modern (compute-capable)
platforms.
• Developed with PC and PS4/XB1 in mind.
• Looking at optimizations to include high-end mobile platforms.
• - Special interests on techniques that saves bandwidth (like on-tile
storage/framebuffer fetch)
20. HD Render Pipeline: Current Plans
• Shaders less reliant on separate shader specializations/variants.
• - Uses more static branching.
• - Shader specializations/variants only where it makes sense upon
profiling on target hardware.
• A more up-to-date / state-of-the-art pipeline for high end games.
• Released as experimental on GitHub, will have a real release later with one
of the next releases.
21. HD Render Pipeline: Features
• GGX with metal and specular parametrization.
• Anisotropic GGX
• Sub-surface scattering (SSS) and transmission
• Fine pruned tiled lighting (FPTL)
• Physically-based camera parameters
• Supports the post-processing stack
• …
25. How To Create A Render Pipeline?
• Need an asset to bind to the graphics settings.
• All rendering goes through the Render function of the interface
IRenderPipeline.
• public void Render(ScriptableRenderContext context,
IEnumerable<Camera> cameras)
26. What goes in the “Render” function?
• Inside the render loop you would typically do:
• - Culling for all of the cameras.
• - Calls to CommandBuffer to setup global shader properties, render
targets, dispatch compute shaders, etc.
• - Series of calls to ScriptableRenderContext.DrawRenderers.
27. Note for the following demos
• This is not the recommended way to create new pipelines.
• Start from GitHub that corresponds to your unity build.
• - Important at this point because of the API changes.
28. How To Create A Render Pipeline?
• What do you get from the GitHub builds?
• - Two render loops:
• - BasicRenderLoopTutorial
• - ScriptableRenderLoop/HDRenderPipeline
• - Test scenes.
38. Simple Rendering Pipeline
• Even with a simple example we can see that we can control shaders.
• - We could provide different shader pass for different pipelines.
• - Change shaders for set of objects to provide some sort of shader LOD.
• - Change the inputs and outputs of a pass by binding buffers or render
targets.
39. Simple Rendering Pipeline
• The C++ parts does the per-object operations.
• Written in style targeting higher performance, using packed arrays and
multithreading.
• - Culling
• - DrawRenderers
• - DrawShadows
48. What could you build with it next?
• Techniques or features not yet supported by Unity.
• - New post-processing effects.
• - Research for new techniques.
• - Implement new shading or lighting algorithms.
- Tiled lighting
- Forward+
• Platform-specific pipelines.
49. Summary
• We are responsible for culling, and for rendering everything.
• Includes per-frame and per-pass shader uniform variables, management
of render targets, dispatching compute, etc.
• Visible lights and probes can be queried from the cull results.
• - Useful for tiled lighting, or other per-object light lights.
• No per-object operations, independent of scene complexity.
• Download the code on GitHub and start you own pipelines!