GlistEngine
Loading...
Searching...
No Matches
gBloomPyramid Class Reference

#include <gBloomPyramid.h>

Inheritance diagram for gBloomPyramid:
Collaboration diagram for gBloomPyramid:

Public Member Functions

 gBloomPyramid (int miplevels=6, float intensity=1.0f, float threshold=1.0f, float knee=0.2f, float bloomsize=1.0f)
 Constructs a Luminance/Alpha based Bloom Pyramid (Auto-sized).
 gBloomPyramid (int screenwidth, int screenheight, int miplevels=6, float intensity=1.0f, float threshold=1.0f, float knee=0.2f, float bloomsize=1.0f)
 Constructs a Luminance/Alpha based Bloom Pyramid with specific FBO dimensions.
 gBloomPyramid (float rgb[3], int miplevels=6, float intensity=1.0f, float bloomsize=1.0f, float colorSoftness=0.0f, float minGlowBrightness=0.0f)
 Constructs an RGB Mask based Bloom Pyramid (Auto-sized).
 gBloomPyramid (int screenwidth, int screenheight, int miplevels, float intensity, float bloomsize, float rgb[3], float colorSoftness=0.0f, float minGlowBrightness=0.0f)
virtual ~gBloomPyramid ()
void use () override
void render (gFbo &src, gFbo &dst) override
 Executes the multi-pass bloom rendering pipeline.
void setIntensity (float newintensity)
void setThreshold (float newthreshold)
void setKnee (float newknee)
void setBloomSize (float newbloomsize)
void setRgbMask (float r, float g, float b)
void setColorSoftness (float newcolorsoftness)
void setMinGlowBrightness (float newminglowbrightness)
void setAlphaMask (bool enabled)
void disableRgbMask ()
void disableAlphaMask ()
void resize (int screenwidth, int screenheight)
Public Member Functions inherited from gBasePostProcess
 gBasePostProcess ()
virtual ~gBasePostProcess ()
gShader * getShader ()
Public Member Functions inherited from gRenderObject
 gRenderObject ()
int getScreenWidth ()
int getScreenHeight ()
void pushMatrix ()
void popMatrix ()
Public Member Functions inherited from gObject
 gObject ()
void logi (std::string message)
void logd (std::string message)
void logw (std::string message)
void loge (std::string message)
void logi (std::string tag, std::string message)
void logd (std::string tag, std::string message)
void logw (std::string tag, std::string message)
void loge (std::string tag, std::string message)

Protected Member Functions

const std::string getVertSrc () override
const std::string getFragSrc () override

Additional Inherited Members

Static Public Member Functions inherited from gRenderObject
static void setScreenSize (int screenWidth, int screenHeight)
static void setUnitScreenSize (int unitWidth, int unitHeight)
static void setScreenScaling (int screenScaling)
static void enableShadowMapping ()
static void disableShadowMapping ()
static bool isShadowMappingEnabled ()
static void enableExtraShaders (bool isEnabled=true)
static void disableExtraShaders ()
static bool isExtraShadersEnabled ()
static gRenderer * getRenderer ()
static void destroyRenderer ()
static void createRenderer (int renderEngine=G_RENDERER_GL)
Static Public Member Functions inherited from gObject
static std::string gGetAppDir ()
static std::string gGetAssetsDir ()
static void gSetAssetsDir (std::string assetsDir)
static std::string gGetFilesDir ()
static std::string gGetImagesDir ()
static std::string gGetFontsDir ()
static std::string gGetModelsDir ()
static std::string gGetTexturesDir ()
static std::string gGetShadersDir ()
static std::string gGetSoundsDir ()
static std::string gGetDatabasesDir ()
static std::string gGetVideosDir ()
static void setCurrentResolution (int scalingNo, int currentResolutionNo)
Static Public Attributes inherited from gObject
static const int LOGLEVEL_SILENT
static const int LOGLEVEL_DEBUG
static const int LOGLEVEL_INFO
static const int LOGLEVEL_WARNING
static const int LOGLEVEL_ERROR
Protected Attributes inherited from gBasePostProcess
gShader * shader
Static Protected Attributes inherited from gRenderObject
static bool isshadowmappingenabled
static bool isextrashadersenabled
Static Protected Attributes inherited from gObject
static int renderpassnum
static int renderpassno
static int releasescaling
static int releaseresolution

Detailed Description

Unlike traditional single-pass Gaussian blur blooms which are highly dependent on kernel size and can bottleneck GPU texture fetching, this implementation uses a downsample/upsample mip-chain. This allows for extremely wide, physically accurate glowing effects with minimal performance cost.

  **Filtering Modes (Highly recommended for LDR engines):**
  1. Luminance Threshold (Default): Blooms pixels that are brighter than the threshold.
  2. Alpha Mask (Emissive Masking): By calling setAlphaMask(true), the engine will use the FBO's Alpha channel as an emissive multiplier (RGB * Alpha). Draw your glowing objects (e.g., car taillights, neon signs) with an Alpha of 1.0, and clear your background with an Alpha of 0.0.
  3. RGB Mask: Isolates and blooms only specific colors (e.g., only red pixels) regardless of global threshold.

Constructor & Destructor Documentation

◆ gBloomPyramid() [1/4]

gBloomPyramid::gBloomPyramid ( int miplevels = 6,
float intensity = 1.0f,
float threshold = 1.0f,
float knee = 0.2f,
float bloomsize = 1.0f )

Constructs a Luminance/Alpha based Bloom Pyramid (Auto-sized).

Parameters
miplevelsNumber of downsample/upsample passes. Higher values create a wider, softer glow. (Recommended: 5-7)
intensityGlobal multiplier for the final bloom output added to the scene.
thresholdThe brightness cutoff point. Pixels with luminance below this value will not bloom. (Ignored if Alpha Mask is enabled).
kneeThe soft-knee transition value. Smooths out harsh cutoffs around the threshold (0.0 = hard cutoff, 0.5 = very smooth transition).
bloomsizeRadius multiplier for the tent filter during the upsampling pass.

◆ gBloomPyramid() [2/4]

gBloomPyramid::gBloomPyramid ( int screenwidth,
int screenheight,
int miplevels = 6,
float intensity = 1.0f,
float threshold = 1.0f,
float knee = 0.2f,
float bloomsize = 1.0f )

Constructs a Luminance/Alpha based Bloom Pyramid with specific FBO dimensions.

Parameters
screenwidthWidth of the internal FBO mip-chain.
screenheightHeight of the internal FBO mip-chain.

◆ gBloomPyramid() [3/4]

gBloomPyramid::gBloomPyramid ( float rgb[3],
int miplevels = 6,
float intensity = 1.0f,
float bloomsize = 1.0f,
float colorSoftness = 0.0f,
float minGlowBrightness = 0.0f )

Constructs an RGB Mask based Bloom Pyramid (Auto-sized).

Isolates a specific color in the scene and applies bloom only to pixels matching that color.

Parameters
rgbThe target RGB color to isolate and bloom (values 0.0f - 1.0f).
miplevelsNumber of downsample/upsample passes.
intensityGlobal multiplier for the final bloom output.
bloomsizeRadius multiplier for the tent filter.
colorSoftnessTolerance distance for the RGB mask. Higher values allow slightly different shades of the target color to bloom.
minGlowBrightnessThe minimum luminance a pixel must have to be considered for blooming, even if it matches the RGB mask.

◆ gBloomPyramid() [4/4]

gBloomPyramid::gBloomPyramid ( int screenwidth,
int screenheight,
int miplevels,
float intensity,
float bloomsize,
float rgb[3],
float colorSoftness = 0.0f,
float minGlowBrightness = 0.0f )

◆ ~gBloomPyramid()

virtual gBloomPyramid::~gBloomPyramid ( )
virtual

Member Function Documentation

◆ disableAlphaMask()

void gBloomPyramid::disableAlphaMask ( )

◆ disableRgbMask()

void gBloomPyramid::disableRgbMask ( )

◆ getFragSrc()

const std::string gBloomPyramid::getFragSrc ( )
overrideprotectedvirtual

Implements gBasePostProcess.

◆ getVertSrc()

const std::string gBloomPyramid::getVertSrc ( )
overrideprotectedvirtual

Implements gBasePostProcess.

◆ render()

void gBloomPyramid::render ( gFbo & src,
gFbo & dst )
overridevirtual

Executes the multi-pass bloom rendering pipeline.

  1. Prefilter (Threshold/Alpha/RGB Masking) -> Mip 0
  2. Downsample Chain (13-tap box filter)
  3. Upsample Chain (3x3 tent filter)
  4. Composite (Additive blend with original scene)

Reimplemented from gBasePostProcess.

◆ resize()

void gBloomPyramid::resize ( int screenwidth,
int screenheight )

◆ setAlphaMask()

void gBloomPyramid::setAlphaMask ( bool enabled)

◆ setBloomSize()

void gBloomPyramid::setBloomSize ( float newbloomsize)

◆ setColorSoftness()

void gBloomPyramid::setColorSoftness ( float newcolorsoftness)

◆ setIntensity()

void gBloomPyramid::setIntensity ( float newintensity)

◆ setKnee()

void gBloomPyramid::setKnee ( float newknee)

◆ setMinGlowBrightness()

void gBloomPyramid::setMinGlowBrightness ( float newminglowbrightness)

◆ setRgbMask()

void gBloomPyramid::setRgbMask ( float r,
float g,
float b )

◆ setThreshold()

void gBloomPyramid::setThreshold ( float newthreshold)

◆ use()

void gBloomPyramid::use ( )
overridevirtual

Implements gBasePostProcess.


The documentation for this class was generated from the following file: