Bilateral fragment shader.
More...
|
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 () |
|
|
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.
|
|
◆ 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
-
n | normal at the center point |
z | depth at the center point (in view space) |
nNeigh | normal at the neighbor |
zNeigh | depth 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
-
uvNeigh | the texel UV coordinates |
n | the reference texel surface normal |
z | the reference texel surface depth (view space) |
blurWeight | gaussian blur weight |
minWeight | lowest weight uncountered yet (for monotonous enforcement) |
sum | normalization sum |
- Returns
- the weighted color sample
The documentation for this class was generated from the following file:
- resources/common/shaders/screens/bilateral.frag