Support Forum       G3D Web Page     
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
G3D::Film Class Reference

Post processing: gamma correction, exposure, bloom, and screen-space antialiasing. More...

Inherits G3D::ReferenceCountedObject.

Classes

class  CompositeFilter
 Includes bloom, vignette, tone map. More...
 
class  DebugZoomFilter
 
class  EffectsDisabledBlitFilter
 
class  Filter
 Filters may cache state for performance, so each Film must have its own set. More...
 
class  FXAAFilter
 
class  TAAFilter
 
class  WideAAFilter
 

Public Member Functions

shared_ptr< TextureexposeAndRender (RenderDevice *rd, const FilmSettings &settings, const shared_ptr< Image > &input)
 
void exposeAndRender (RenderDevice *rd, const FilmSettings &settings, const shared_ptr< Texture > &input, int sourceTrimBandThickness, int sourceDepthBandThickness, const shared_ptr< Texture > &screenSpaceMotion=nullptr, const Vector2 jitterMotion=Vector2::zero())
 Renders the input as filtered by the film settings to the currently bound framebuffer. More...
 
void exposeAndRender (RenderDevice *rd, const FilmSettings &settings, const shared_ptr< Texture > &input, int sourceTrimBandThickness, int sourceColorBandThickness, shared_ptr< Texture > &output, CubeFace outputCubeFace=CubeFace::POS_X, int outputMipLevel=0, const shared_ptr< Texture > &screenSpaceMotion=nullptr, const Vector2 jitterMotion=Vector2::zero())
 
Render to texture helper. More...
 
TAAFiltertaaFilter ()
 

Static Public Member Functions

static shared_ptr< Filmcreate ()
 Create a new Film instance. More...
 

Protected Member Functions

 Film ()
 

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

G3D::Film::CompositeFilter m_compositeFilter
 
G3D::Film::DebugZoomFilter m_debugZoomFilter
 
G3D::Film::EffectsDisabledBlitFilter m_effectsDisabledBlitFilter
 
G3D::Film::FXAAFilter m_fxaaFilter
 
G3D::Film::TAAFilter m_taaFilter
 
G3D::Film::WideAAFilter m_wideAAFilter
 

Detailed Description

Post processing: gamma correction, exposure, bloom, and screen-space antialiasing.

Computer displays are not capable of representing the range of values that are rendered by a physically based system. For example, the brightest point on a monitor rarely has the intensity of a light bulb. Furthermore, for historical (and 2D GUI rendering) reasons, monitors apply a power ("gamma") curve to values. So rendering code that directly displays radiance values on a monitor will neither capture the desired tonal range nor even present the values scaled linearly. The Film class corrects for this using the simple tone mapping algorithm presented in Pharr and Humphreys 2004 extended with color desaturation. The bloom effects are most pronounced when rendering values that are actually proportional to radiance. That is, if all of the values in the input are on a narrow range, there will be little bloom. But if the sky, highlights, emissive surfaces, and light sources are 10x brighter than most scene objects, they will produce attractive glows and halos.

When rendering multiple viewports or off-screen images, use a separate Film instance for each size of input for maximum performance.

Constructor & Destructor Documentation

◆ Film()

G3D::Film::Film ( )
protected

Member Function Documentation

◆ create()

static shared_ptr<Film> G3D::Film::create ( )
static

Create a new Film instance.

◆ 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>.

◆ exposeAndRender() [1/3]

shared_ptr<Texture> G3D::Film::exposeAndRender ( RenderDevice rd,
const FilmSettings settings,
const shared_ptr< Image > &  input 
)

◆ exposeAndRender() [2/3]

void G3D::Film::exposeAndRender ( RenderDevice rd,
const FilmSettings settings,
const shared_ptr< Texture > &  input,
int  sourceTrimBandThickness,
int  sourceDepthBandThickness,
const shared_ptr< Texture > &  screenSpaceMotion = nullptr,
const Vector2  jitterMotion = Vector2::zero() 
)

Renders the input as filtered by the film settings to the currently bound framebuffer.

Parameters
downsampleOne side of the downsampling filter in pixels. 1 = no downsampling. 2 = 2x2 downsampling (antialiasing). Not implemented.

If rendering to a bound texture, set the Texture::Visualization::documentGamma = gamma() afterwards.

Parameters
offsetIn pixels of the final framebuffer
screenSpaceMotionMotion vectors for use with TAA. If not specified, assumes a static scene.
jitterMotionMotion vector in 2D of the camera due to TAA jitter.
guardBand.png

◆ exposeAndRender() [3/3]

void G3D::Film::exposeAndRender ( RenderDevice rd,
const FilmSettings settings,
const shared_ptr< Texture > &  input,
int  sourceTrimBandThickness,
int  sourceColorBandThickness,
shared_ptr< Texture > &  output,
CubeFace  outputCubeFace = CubeFace::POS_X,
int  outputMipLevel = 0,
const shared_ptr< Texture > &  screenSpaceMotion = nullptr,
const Vector2  jitterMotion = Vector2::zero() 
)


Render to texture helper.

You can also render to a texture by binding output to a FrameBuffer, setting the FrameBuffer on the RenderDevice, and calling the three-argument version of exposeAndRender. That process will be faster than this version, which must create its FrameBuffer every time it is invoked.

Parameters
outputIf nullptr, this will be allocated to be the same size and format as input

◆ taaFilter()

TAAFilter& G3D::Film::taaFilter ( )
inline

Member Data Documentation

◆ m_compositeFilter

G3D::Film::CompositeFilter G3D::Film::m_compositeFilter
protected

◆ m_debugZoomFilter

G3D::Film::DebugZoomFilter G3D::Film::m_debugZoomFilter
protected

◆ m_effectsDisabledBlitFilter

G3D::Film::EffectsDisabledBlitFilter G3D::Film::m_effectsDisabledBlitFilter
protected

◆ m_fxaaFilter

G3D::Film::FXAAFilter G3D::Film::m_fxaaFilter
protected

◆ m_taaFilter

G3D::Film::TAAFilter G3D::Film::m_taaFilter
protected

Referenced by taaFilter().

◆ m_wideAAFilter

G3D::Film::WideAAFilter G3D::Film::m_wideAAFilter
protected

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