-
-
Notifications
You must be signed in to change notification settings - Fork 29
Render processes
In RaZ, a "render process" is a predefined set of render passes, from 1 to any number, executing specific shaders that operate on read buffers and can write to others. This allows for an easier setup compared to plain render passes while remaining very customizable.
To run a render process, it needs to be added to the render graph, e.g. for a box blur process:
#include <RaZ/Render/BoxBlurRenderProcess.hpp>
...
Raz::RenderSystem& renderSystem = world.addSystem<Raz::RenderSystem>(...);
Raz::RenderGraph& renderGraph = renderSystem.getRenderGraph();
Raz::BoxBlurRenderProcess& boxBlur = renderGraph.addRenderProcess<Raz::BoxBlurRenderProcess>();
Next, buffers must be added to read and potentially write to:
auto inputBuffer = Raz::Texture2D::create(...);
boxBlur.setInputBuffer(inputBuffer);
// You can also set an output buffer if you need it to be used by another pass
auto outputBuffer = Raz::Texture2D::create(...);
boxBlur.setOutputBuffer(outputBuffer);
Note that some render processes can take multiple read and/or write buffers, and so can have different names for these functions.
Finally, just as with regular render passes, parenting needs to be set up properly. The member functions addParent()
and addChild()
are available to do just that; each can take either another render process or a simple render pass:
Raz::RenderPass& geometryPass = renderGraph.getGeometryPass();
boxBlur.addParent(geometryPass);
SomeRenderProcess& otherProcess = renderGraph.addRenderProcess<SomeRenderProcess>();
boxBlur.addChild(otherProcess);
Each process can have any function they see fit. For instance, the box blur has a setStrength()
function, allowing to make the blur's strength vary at any time.
Processes can also be enabled or disabled with their respective enable()
& disable()
functions (or equivalenty setState(true)
and setState(false)
).
Several premade render processes are available (such as bloom, blur, SSR, ...), but anyone can do their own. It just need to inherits from the base class Raz::RenderProcess
, available from RaZ/Render/RenderProcess.hpp
, and reimplement the necessary functions properly. For simplicity, there also exists Raz::MonoPassRenderProcess
, available from RaZ/Render/MonoPassRenderProcess.hpp
, that can be inherited from to have a render process with a single pass that's easier to setup.
- Home
- How to build RaZ
- Getting started
- General usage knowledge
- Some examples...
- Playground
- Tutorials
- File formats
- Modules
- Debug