A film grain effect. More...
Public Member Functions | |
FilmGrainEffect (System *system) noexcept | |
virtual | ~FilmGrainEffect () |
nkGraphics::Texture * | getSourceTexture () const |
float | getStrength () const |
bool | getRgbNoise () const |
bool | getBlendGrainInTarget () const |
void | setSourceTexture (nkGraphics::Texture *value) |
void | setStrength (float value) |
void | setRgbNoise (bool value) |
void | setBlendGrainInTarget (bool value) |
virtual bool | load () override |
virtual void | unload () override |
Public Member Functions inherited from nkAstraeus::Effect | |
Effect (EFFECT_TYPE type) noexcept | |
virtual | ~Effect () |
nkMemory::StringView | getName () const |
nkGraphics::Shader * | getShader () const |
EFFECT_TYPE | getType () const |
void | setName (nkMemory::StringView value) |
Static Public Member Functions | |
static nkMemory::UniquePtr< FilmGrainEffect > | create (System *system=nullptr) |
A film grain effect.
This effect imitates the noise often present in pictures taken from a camera. Some potential causes can be dirt or imperfections on the sensor lens, compression artifacts, or dust on the film. It is useful to add a sense of reality to an image, by adding imperfection usually found when taking real pictures. This effect offers different settings to make the effect look different, but also to make it adapt to different situations.
|
noexcept |
Default constructor. Alternatively, see FilmGrainEffect::create(), or EffectManager::createOrRetrieve().
system | The system the resource should live in. |
|
virtual |
Destructor. See EffectManager::erase().
nkGraphics::Texture* nkAstraeus::FilmGrainEffect::getSourceTexture | ( | ) | const |
float nkAstraeus::FilmGrainEffect::getStrength | ( | ) | const |
bool nkAstraeus::FilmGrainEffect::getRgbNoise | ( | ) | const |
bool nkAstraeus::FilmGrainEffect::getBlendGrainInTarget | ( | ) | const |
void nkAstraeus::FilmGrainEffect::setSourceTexture | ( | nkGraphics::Texture * | value | ) |
Sets the texture to use as input. This texture is only required when the blending functionality is turned off.
value | The texture to use as input for the effect. |
void nkAstraeus::FilmGrainEffect::setStrength | ( | float | value | ) |
Sets the strength of the effect. Defaults to 0.15.
value | The strength of the effect wanted. |
void nkAstraeus::FilmGrainEffect::setRgbNoise | ( | bool | value | ) |
Sets whether the noise should randomize its output on the RGB channels independently, or with one value on all of them at once. If false, this means that noise will be applied like : r + n, g + n, b + n. If true, this means that noise will be applied like : r + n0, g + n1, b + n2. Defaults to false.
value | Whether the noise should be independent on each channel (true) or not (false). |
void nkAstraeus::FilmGrainEffect::setBlendGrainInTarget | ( | bool | value | ) |
Sets whether the effect should blend in the target, or rather process the source texture before writing the output. See FilmGrainEffectUtils::prepareBlendStateForGrainBlending() to setup a compatible BlendState to use in the pass along with the effect. Defaults to false.
value | Whether the noise should be blended in target (true) or not (false). |
|
overridevirtual |
Loads the effect and make it ready for rendering.
Implements nkAstraeus::Effect.
|
overridevirtual |
Unloads the effect and its internal memory. After that, the effect is unusable for rendering.
Implements nkAstraeus::Effect.
|
static |
Creates an instance of the class, and returns ownership over it.
system | The system the resource should live in. If left to nullptr, will seek the singleton instance of the system. |