Support Forum G3D Web Page |
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< Texture > | exposeAndRender (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... | |
TAAFilter & | taaFilter () |
Static Public Member Functions | |
static shared_ptr< Film > | create () |
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... | |
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.
|
protected |
|
inlinestaticprotectedinherited |
Like std::make_shared, but works for protected constructors.
Call as createShared<myclass>.
shared_ptr<Texture> G3D::Film::exposeAndRender | ( | RenderDevice * | rd, |
const FilmSettings & | settings, | ||
const shared_ptr< Image > & | input | ||
) |
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.
downsample | One 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.
offset | In pixels of the final framebuffer |
screenSpaceMotion | Motion vectors for use with TAA. If not specified, assumes a static scene. |
jitterMotion | Motion vector in 2D of the camera due to TAA jitter. |
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.
output | If nullptr, this will be allocated to be the same size and format as input |
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by taaFilter().
|
protected |