Support Forum       G3D Web Page     
Public Types | Static Public Member Functions | List of all members
G3D::GaussianBlur Class Reference


1D Gaussian blur. More...

Public Types

enum  Direction {
  VERTICAL,
  HORIZONTAL
}
 

Static Public Member Functions

static void apply (class RenderDevice *rd, const shared_ptr< Texture > &source, const Vector2 &direction, int N, const Vector2 &destSize, bool clear=true, bool unitArea=true, float stddevMultiplier=1.0f, float computeFraction=-1.0f)
 
Blurs the source to the current G3D::Framebuffer. More...
 
static void apply (class RenderDevice *rd, const shared_ptr< Texture > &source, const Vector2 &direction=Vector2(1.0f, 0.0f), int N=17)
 
static String getPreamble (int N, bool unitArea, float stddevMultiplier=1.0f)
 Returns the preamble for the GuassianBlur shader containing: More...
 

Detailed Description


1D Gaussian blur.

Call twice to produce a 2D blur.

Operates on the graphics card; this requires a RenderDevice. See G3D::gaussian for gaussian filter coefficients on the CPU.

Member Enumeration Documentation

◆ Direction

Enumerator
VERTICAL 
HORIZONTAL 

Member Function Documentation

◆ apply() [1/2]

static void G3D::GaussianBlur::apply ( class RenderDevice rd,
const shared_ptr< Texture > &  source,
const Vector2 direction,
int  N,
const Vector2 destSize,
bool  clear = true,
bool  unitArea = true,
float  stddevMultiplier = 1.0f,
float  computeFraction = -1.0f 
)
static


Blurs the source to the current G3D::Framebuffer.

Assumes RenderDevice::push2D rendering mode is already set. Blurs the alpha channel the same as any color channel, however, you must have alphaWrite enabled to obtain that result.

2D blur is not directly supported because handling of the intermediate texture is different for Framebuffer and backbuffer rendering.

Parameters
NNumber of taps in the filter (filter kernel width)
directionDirection of the blur. For best results, use Vector2(1,0) and Vector(0,1).
destSizeoutput dimensions
clearClear the target first?
unitAreaIf true, the taps sum to 1. If false, the center tap has magnitude 1.
computeFractionIf >= 0, only compute on a disk that covers this fraction of the diameter of the screen (max of width, height).

◆ apply() [2/2]

static void G3D::GaussianBlur::apply ( class RenderDevice rd,
const shared_ptr< Texture > &  source,
const Vector2 direction = Vector2(1.0f, 0.0f),
int  N = 17 
)
static

◆ getPreamble()

static String G3D::GaussianBlur::getPreamble ( int  N,
bool  unitArea,
float  stddevMultiplier = 1.0f 
)
static

Returns the preamble for the GuassianBlur shader containing:

#define KERNEL_RADIUS <number>
float gaussCoef[KERNEL_RADIUS];

documentation generated on Wed Nov 24 2021 08:01:56 using doxygen 1.8.15