PBR Rendering Rewrite
Posted: Mon Jun 24, 2019 3:15 am
After doing a significant amount of evaluation and reading, I think I'm ready to lay down some specifics on the planned rendering rewrite. I've identified the new workflow, figured out how to implement it, and I think I've got a fairly good grip on how I want to implement the higher-level C++ API for interacting with the renderer.
Just a note before I go any further: this is going to be a long project, potentially spanning multiple months to implement. I'd like to incorporate Fluffy's terrain texturing rewrite as well as nozmajner's decal workflow refactor, which will introduce some necessary slowdowns and dependency-waiting. However, I am confident that I can actually implement the planned features on my own, so there should be no significant danger of this falling by the wayside or going unfinished for two years. (cough)
We've talked for quite a while about moving Pioneer to a physically-based rendering workflow, or 'PBR'. Various resources and methods have been proposed, as well as "nice-to-have" features like a Vulkan or DX11 backend, etc. Recently, I've come across a set of comprehensive resources describing in great detail the implementation of a PBR rendering workflow, as well as these (res 1, res 2) lovely resources on the anatomy of a (comparatively) lightweight clustered-forward renderer that we can implement without significantly altering our hardware compatibility.
Armed with these resources, I have a much better understanding of how to architect and structure the new renderer, as well as a comprehensive understanding of our current needs, in part due to my work on the scenegraph/ code while optimizing startup time. I'll be outlining what we will (and won't) be implementing in the first iteration on the new renderer.
We WILL be implementing:
- A clustered-forward rendering pipeline, capable of handling a large number of lights per frame (no more over-reliance on NavLights!).
- A Metallic-Roughness PBR authoring workflow, requiring a minimum number of textures per material.
- A unified weathering system for ships and other geometry, based on nozmajner's excellent prototype work.
- A mesh-decal based detailing system for ships, with LOD transitions and normal-contribution blending.
- Point, Spot, and Directional lights, in high enough quantities to allow lighting contributions from planetary reflections and multiple stars per system
- HDR lighting and Tonemapping
We MIGHT be implementing (may get bumped to second pass):
- A frame-graph based representation for efficient and intelligent rendering.
- Support for transparent meshes.
- A bloom postprocessing filter
- Screen-Space Ambient Occlusion post-processing support.
- GLTF asset import and storage. This will mean replacing SGM with GLTF + collision cache files.
We WON'T be implementing (on the first pass):
- Shadows beyond a simple ray-sphere ring / planet shadow
- Additional anti-aliasing modes (TAA etc.).
- Deferred (projector) decals.
- Light Probes (realtime or precomputed)
- Screen-Space Reflection post-processing support.
FAQ:
Will this mean we can't support older devices any more?
- I'm not sure yet. Anything supporting openGL 3.3 / 4.0 will likely be fine, as I'm intentionally keeping the renderer as simple as possible. Everything in the WILL and MIGHT categories is achievable under openGL 3, though it might be more efficient if we were to kick the requirement up to 4.0.
Will this impact performance significantly?
- Pessimistically, yes. A PBR shader is a much more complex beast than our current simple shading pipeline, but honestly I don't think we're anywhere near GPU-bound currently, even on the lowest-spec hardware we support. My estimation is that we'll get a full 60FPS on cards >= GTX 760, and drop to 30FPS on Skylake-and-earlier integrated GPUs.
- Additionally, I intend to define a number of configurable parameters to control the performance impact.
Why clustered-forward? Why not a deferred shading pipeline?
- Performance. A deferred pipeline takes a significant amount of bandwidth, more than an integrated GPU can comfortably provide. A clustered-forward solution is designed to mitigate performance costs as much as possible while not compromising on quality, and (as DOOM and others have proved) can deliver very high quality results on median hardware.
- Also simplicity. A forward pipeline is miles less complex to implement than a deferred pipeline, and will just as adequately satisfy all our requirements for Pioneer.
Are you implementing Vulkan support?
- No. This is already challenging enough on openGL, no need to throw another graphics API in the ring. When we ditch support for openGL 3 and non-Vulkan-capable devices, I'd be more than happy to port the whole shebang to Vulkan (preferably using a boilerplate-avoidance middleware), but until then, I'm not maintaining two different backends with their own sets of bugs.
Why aren't you doing shadows on the first pass?
- Shadows are hard, man. More to the point, shadowing requires a tricky culling implementation to avoid massive performance overheads, and requires a complex change-tracking system if we want more than 4 shadow-casting lights per frame.
Anything else?
- Please hit me with any questions you might have. Also words of encouragement. Those are pretty nice too.
Just a note before I go any further: this is going to be a long project, potentially spanning multiple months to implement. I'd like to incorporate Fluffy's terrain texturing rewrite as well as nozmajner's decal workflow refactor, which will introduce some necessary slowdowns and dependency-waiting. However, I am confident that I can actually implement the planned features on my own, so there should be no significant danger of this falling by the wayside or going unfinished for two years. (cough)
We've talked for quite a while about moving Pioneer to a physically-based rendering workflow, or 'PBR'. Various resources and methods have been proposed, as well as "nice-to-have" features like a Vulkan or DX11 backend, etc. Recently, I've come across a set of comprehensive resources describing in great detail the implementation of a PBR rendering workflow, as well as these (res 1, res 2) lovely resources on the anatomy of a (comparatively) lightweight clustered-forward renderer that we can implement without significantly altering our hardware compatibility.
Armed with these resources, I have a much better understanding of how to architect and structure the new renderer, as well as a comprehensive understanding of our current needs, in part due to my work on the scenegraph/ code while optimizing startup time. I'll be outlining what we will (and won't) be implementing in the first iteration on the new renderer.
We WILL be implementing:
- A clustered-forward rendering pipeline, capable of handling a large number of lights per frame (no more over-reliance on NavLights!).
- A Metallic-Roughness PBR authoring workflow, requiring a minimum number of textures per material.
- A unified weathering system for ships and other geometry, based on nozmajner's excellent prototype work.
- A mesh-decal based detailing system for ships, with LOD transitions and normal-contribution blending.
- Point, Spot, and Directional lights, in high enough quantities to allow lighting contributions from planetary reflections and multiple stars per system
- HDR lighting and Tonemapping
We MIGHT be implementing (may get bumped to second pass):
- A frame-graph based representation for efficient and intelligent rendering.
- Support for transparent meshes.
- A bloom postprocessing filter
- Screen-Space Ambient Occlusion post-processing support.
- GLTF asset import and storage. This will mean replacing SGM with GLTF + collision cache files.
We WON'T be implementing (on the first pass):
- Shadows beyond a simple ray-sphere ring / planet shadow
- Additional anti-aliasing modes (TAA etc.).
- Deferred (projector) decals.
- Light Probes (realtime or precomputed)
- Screen-Space Reflection post-processing support.
FAQ:
Will this mean we can't support older devices any more?
- I'm not sure yet. Anything supporting openGL 3.3 / 4.0 will likely be fine, as I'm intentionally keeping the renderer as simple as possible. Everything in the WILL and MIGHT categories is achievable under openGL 3, though it might be more efficient if we were to kick the requirement up to 4.0.
Will this impact performance significantly?
- Pessimistically, yes. A PBR shader is a much more complex beast than our current simple shading pipeline, but honestly I don't think we're anywhere near GPU-bound currently, even on the lowest-spec hardware we support. My estimation is that we'll get a full 60FPS on cards >= GTX 760, and drop to 30FPS on Skylake-and-earlier integrated GPUs.
- Additionally, I intend to define a number of configurable parameters to control the performance impact.
Why clustered-forward? Why not a deferred shading pipeline?
- Performance. A deferred pipeline takes a significant amount of bandwidth, more than an integrated GPU can comfortably provide. A clustered-forward solution is designed to mitigate performance costs as much as possible while not compromising on quality, and (as DOOM and others have proved) can deliver very high quality results on median hardware.
- Also simplicity. A forward pipeline is miles less complex to implement than a deferred pipeline, and will just as adequately satisfy all our requirements for Pioneer.
Are you implementing Vulkan support?
- No. This is already challenging enough on openGL, no need to throw another graphics API in the ring. When we ditch support for openGL 3 and non-Vulkan-capable devices, I'd be more than happy to port the whole shebang to Vulkan (preferably using a boilerplate-avoidance middleware), but until then, I'm not maintaining two different backends with their own sets of bugs.
Why aren't you doing shadows on the first pass?
- Shadows are hard, man. More to the point, shadowing requires a tricky culling implementation to avoid massive performance overheads, and requires a complex change-tracking system if we want more than 4 shadow-casting lights per frame.
Anything else?
- Please hit me with any questions you might have. Also words of encouragement. Those are pretty nice too.