Support Forum G3D Web Page |
Defocus post-process shader
More...
Inherits G3D::ReferenceCountedObject.
Public Types | |
enum | DebugOption { NONE, SHOW_COC, SHOW_REGION, SHOW_NEAR, SHOW_BLURRY, SHOW_INPUT, SHOW_MID_AND_FAR, SHOW_SIGNED_COC } |
Public Member Functions | |
virtual void | apply (RenderDevice *rd, shared_ptr< Texture > color, shared_ptr< Texture > depth, const shared_ptr< Camera > &camera, Vector2int16 trimBandThickness, DebugOption debugOption=NONE) |
Applies depth of field blur to supplied images and renders to the currently-bound framebuffer. More... | |
Static Public Member Functions | |
static shared_ptr< DepthOfField > | create (const String &debugName="G3D::DepthOfField") |
Protected Member Functions | |
DepthOfField (const String &debugName) | |
void | blurPass (RenderDevice *rd, const shared_ptr< Texture > &blurInput, const shared_ptr< Texture > &nearInput, const shared_ptr< Framebuffer > &output, bool horizontal, const shared_ptr< Camera > &camera, const Rect2D &fullViewport, float maxCoCRadiusPixels, bool diskFramebuffer) |
void | composite (RenderDevice *rd, shared_ptr< Texture > packedBuffer, shared_ptr< Texture > blurBuffer, shared_ptr< Texture > nearBuffer, DebugOption d, Vector2int16 trimBandThickness, float farRadiusRescale, bool diskFramebuffer) |
Writes to the currently-bound framebuffer. More... | |
void | computeCoC (RenderDevice *rd, const shared_ptr< Texture > &color, const shared_ptr< Texture > &depth, const shared_ptr< Camera > &camera, Vector2int16 inputGuardBand, float &farRadiusRescale, float maxCoCRadiusPixels) |
Writes m_packedBuffer. More... | |
void | resizeBuffers (shared_ptr< Texture > target, int reducedResolutionFactor, Vector2int16 trimBandThickness) |
Allocates and resizes buffers. More... | |
Static Protected Member Functions | |
template<class T , class ... ArgTypes> | |
static shared_ptr< T > | createShared (ArgTypes &&... args) |
Like std::make_shared, but works for protected constructors. More... | |
Protected Attributes | |
shared_ptr< Texture > | m_blurBuffer |
String | m_debugName |
shared_ptr< Framebuffer > | m_horizontalFramebuffer |
shared_ptr< Texture > | m_nearBuffer |
shared_ptr< Texture > | m_packedBuffer |
Color in RGB, circle of confusion and 'near field' bit in A. More... | |
shared_ptr< Framebuffer > | m_packedFramebuffer |
shared_ptr< Texture > | m_tempBlurBuffer |
shared_ptr< Texture > | m_tempNearBuffer |
shared_ptr< Framebuffer > | m_verticalFramebuffer |
Defocus post-process shader
|
protected |
|
virtual |
Applies depth of field blur to supplied images and renders to the currently-bound framebuffer.
The current framebuffer may have the color and depth values bound to it.
Reads depth reconstruction and circle of confusion parameters from camera.
Centers the output on the target framebuffer, so no explicit output guard band is specified.
|
protected |
|
protected |
Writes to the currently-bound framebuffer.
|
protected |
Writes m_packedBuffer.
|
static |
debugName | Used for naming textures. Does not affect which shaders are loaded. |
|
inlinestaticprotectedinherited |
Like std::make_shared, but works for protected constructors.
Call as createShared<myclass>.
|
protected |
Allocates and resizes buffers.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Color in RGB, circle of confusion and 'near field' bit in A.
Precision determined by the input, RGB8, RGB16F, or RGB32F.
The A channel values are always written with only 8 bits of effective precision.
The radius (A channel) values are scaled and biased to [0, 1]. Unpack them to pixel radii with:
Where maxRadius the larger of the maximum near and far field blurs. The decoded radius is negative in the far field (the packed alpha channel should look like a head lamp on a dark night, with nearby objects bright, the focus field gray, and the distance black).
|
protected |
|
protected |
|
protected |
|
protected |