Screen-space post-processed motion blur.
More...
Inherits G3D::ReferenceCountedObject.
|
| MotionBlur () |
|
void | computeNeighborMinMax (RenderDevice *rd, const shared_ptr< Texture > &tileMax) |
| Compute m_neighborMax from m_tileMax. More...
|
|
void | computeTileMinMax (RenderDevice *rd, const shared_ptr< Texture > &velocity, int maxBlurRadiusPixels, const Vector2int16 trimBandThickness) |
| Compute m_tileMax from sharpVelocity. More...
|
|
void | debugDrawTiles (RenderDevice *rd, const shared_ptr< Texture > &neighborMax, int maxBlurRadiusPixels) |
| Debug visualization of the motion blur tiles and directions. More...
|
|
virtual void | gatherBlur (RenderDevice *rd, const shared_ptr< Texture > &color, const shared_ptr< Texture > &neighborMax, const shared_ptr< Texture > &velocity, const shared_ptr< Texture > &depth, int numSamplesOdd, int maxBlurRadiusPixels, float exposureTimeFraction, Vector2int16 trimBandThickness) |
| Called from apply() to compute the blurry image to the current frame buffer by gathering. More...
|
|
void | makeRandomBuffer () |
|
void | updateBuffers (const shared_ptr< Texture > &velocityTexture, int maxBlurRadiusPixels, Vector2int16 trimBandThickness) |
| Allocates tileMax and neighborMax as needed. More...
|
|
|
template<class T , class ... ArgTypes> |
static shared_ptr< T > | createShared (ArgTypes &&... args) |
| Like std::make_shared, but works for protected constructors. More...
|
|
static int | nextOdd (int n) |
| Returns n if it is odd, otherwise returns n + 1. More...
|
|
Screen-space post-processed motion blur.
Based on:
A Reconstruction Filter for Plausible Motion Blur. McGuire, Hennessy, Bukowski, and Osman, I3D 2012 http://graphics.cs.williams.edu/papers/MotionBlurI3D12/
◆ MotionBlur()
G3D::MotionBlur::MotionBlur |
( |
| ) |
|
|
protected |
◆ apply()
- Parameters
-
trimBandThickness | Input texture coordinates are clamped to a region inset on all sides by this amount. Set this to non-zero if the input color buffer is larger than the desired output region but does not have useful data around the border. Typically m_settings.hdrFramebuffer.depthGuardBandThickness - m_settings.hdrFramebuffer.colorGuardBandThickness. |
◆ computeNeighborMinMax()
void G3D::MotionBlur::computeNeighborMinMax |
( |
RenderDevice * |
rd, |
|
|
const shared_ptr< Texture > & |
tileMax |
|
) |
| |
|
protected |
Compute m_neighborMax from m_tileMax.
◆ computeTileMinMax()
void G3D::MotionBlur::computeTileMinMax |
( |
RenderDevice * |
rd, |
|
|
const shared_ptr< Texture > & |
velocity, |
|
|
int |
maxBlurRadiusPixels, |
|
|
const Vector2int16 |
trimBandThickness |
|
) |
| |
|
protected |
Compute m_tileMax from sharpVelocity.
◆ create()
static shared_ptr<MotionBlur> G3D::MotionBlur::create |
( |
| ) |
|
|
inlinestatic |
◆ createShared()
template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared |
( |
ArgTypes &&... |
args | ) |
|
|
inlinestaticprotectedinherited |
Like std::make_shared, but works for protected constructors.
Call as createShared<myclass>.
◆ debugDrawTiles()
void G3D::MotionBlur::debugDrawTiles |
( |
RenderDevice * |
rd, |
|
|
const shared_ptr< Texture > & |
neighborMax, |
|
|
int |
maxBlurRadiusPixels |
|
) |
| |
|
protected |
Debug visualization of the motion blur tiles and directions.
Called from apply()
◆ debugShowTiles()
bool G3D::MotionBlur::debugShowTiles |
( |
| ) |
const |
|
inline |
◆ gatherBlur()
virtual void G3D::MotionBlur::gatherBlur |
( |
RenderDevice * |
rd, |
|
|
const shared_ptr< Texture > & |
color, |
|
|
const shared_ptr< Texture > & |
neighborMax, |
|
|
const shared_ptr< Texture > & |
velocity, |
|
|
const shared_ptr< Texture > & |
depth, |
|
|
int |
numSamplesOdd, |
|
|
int |
maxBlurRadiusPixels, |
|
|
float |
exposureTimeFraction, |
|
|
Vector2int16 |
trimBandThickness |
|
) |
| |
|
protectedvirtual |
Called from apply() to compute the blurry image to the current frame buffer by gathering.
◆ makeRandomBuffer()
void G3D::MotionBlur::makeRandomBuffer |
( |
| ) |
|
|
protected |
◆ nextOdd()
static int G3D::MotionBlur::nextOdd |
( |
int |
n | ) |
|
|
inlinestaticprotected |
Returns n if it is odd, otherwise returns n + 1.
◆ setDebugShowTiles()
void G3D::MotionBlur::setDebugShowTiles |
( |
bool |
b | ) |
|
|
inline |
Toggle visualization showing the tile boundaries, which are set by maxBlurRadiusPixels.
◆ updateBuffers()
void G3D::MotionBlur::updateBuffers |
( |
const shared_ptr< Texture > & |
velocityTexture, |
|
|
int |
maxBlurRadiusPixels, |
|
|
Vector2int16 |
trimBandThickness |
|
) |
| |
|
protected |
Allocates tileMax and neighborMax as needed.
◆ m_cachedSrc
shared_ptr<Texture> G3D::MotionBlur::m_cachedSrc |
|
protected |
The source color is copied into this if needed.
Saved between invocations to avoid reallocating the texture.
◆ m_debugShowTiles
bool G3D::MotionBlur::m_debugShowTiles |
|
protected |
◆ m_neighborMinMaxFramebuffer
shared_ptr<Framebuffer> G3D::MotionBlur::m_neighborMinMaxFramebuffer |
|
protected |
Size ceil(w / maxBlurRadius) x ceil(h / maxBlurRadius).
RG = max velocity in neighborhood, B = min speed in neighborhood
◆ m_randomBuffer
shared_ptr<Texture> G3D::MotionBlur::m_randomBuffer |
|
protected |
32x32 buffer of RG values on [0, 1)
◆ m_tileMinMaxFramebuffer
shared_ptr<Framebuffer> G3D::MotionBlur::m_tileMinMaxFramebuffer |
|
protected |
Size ceil(w / maxBlurRadius) x ceil(h / maxBlurRadius).
RG = max velocity in tile, B = min speed in tile
◆ m_tileMinMaxTempFramebuffer
shared_ptr<Framebuffer> G3D::MotionBlur::m_tileMinMaxTempFramebuffer |
|
protected |
Size h x ceil(w / maxBlurRadius).
RG = max velocity in tile, B = min speed in tile