Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
GPUShaders::Frag::Bilateral Class Reference

Bilateral fragment shader. More...

Public Member Functions

float computeWeight (vec3 n, float z, vec3 nNeigh, float zNeigh)
 
vec4 weightedColor (vec2 uvNeigh, vec3 n, float z, float blurWeight, inout float minWeight, inout float sum)
 
void main ()
 

Public Attributes

in vec2 uv
 UV coordinates.
 
uniform uniform vec2 invDstSize
 Inverse of the target resolution.
 
uniform vec2 projParams
 Projection depth-related coefficients.
 
uniform int axis
 Dimension to blur along.
 
out vec4 fragColor
 Blurred color.
 
const int radius = 4
 Blur radius.
 
const int shift = 2
 Step between samples (introduce dithering artifacts).
 
const float weights [5] = float[](0.153170, 0.144893, 0.122649, 0.092902, 0.062970)
 Gaussian weights.
 

Detailed Description

Bilateral fragment shader.

See also
GPUShaders::Common::Utils, GPUShaders::Common::Samplers

Member Function Documentation

◆ computeWeight()

float GPUShaders::Frag::Bilateral::computeWeight ( vec3  n,
float  z,
vec3  nNeigh,
float  zNeigh 
)
inline

Compute bilateral weight based on depth and normal differences.

Parameters
nnormal at the center point
zdepth at the center point (in view space)
nNeighnormal at the neighbor
zNeighdepth at the neighbor (in view space)
Returns
the geometry-guided weight

◆ main()

void GPUShaders::Frag::Bilateral::main ( )
inline

Apply an approximate bilateral filter combining a separable gaussian blur and a geometry-guided weight.

◆ weightedColor()

vec4 GPUShaders::Frag::Bilateral::weightedColor ( vec2  uvNeigh,
vec3  n,
float  z,
float  blurWeight,
inout float  minWeight,
inout float  sum 
)
inline

Compute the bilateral weight of a neighboring texel and apply it.

Parameters
uvNeighthe texel UV coordinates
nthe reference texel surface normal
zthe reference texel surface depth (view space)
blurWeightgaussian blur weight
minWeightlowest weight uncountered yet (for monotonous enforcement)
sumnormalization sum
Returns
the weighted color sample

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