Files
filament/shaders/src/inline_vignette.fs
Sungun Park 87bdf96449 Refactor: Rename shader snippets w/ new naming convention (see README.md) (#8402)
This commit renames all shader snippet files to conform to the newly
introduced naming convention outlined in README.md.

The new naming convention uses a `prefix_name.suffix` format to clearly
indicate the purpose and target shader stage of each snippet. This
improves the overall organization and readability of the shader code,
making it easier to understand how each snippet contributes to the
shader generation process.

No functional changes were made to the shader code itself or source
code. This is purely a refactoring for clarity and maintainability.
2025-01-31 00:02:53 +00:00

23 lines
909 B
GLSL

//------------------------------------------------------------------------------
// Vignette
//------------------------------------------------------------------------------
// Applies a vignette effect
// color: source color to apply the vignette on top of
// uv: viewport coordinates
// vignette: pre-computed parameters midPoint, radius, aspect and feather
// vignetteColor: color of the vignette effect
vec3 vignette(const vec3 color, const highp vec2 uv, const vec4 vignette, const vec4 vignetteColor) {
float midPoint = vignette.x;
float radius = vignette.y;
float aspect = vignette.z;
float feather = vignette.w;
vec2 distance = abs(uv - 0.5) * midPoint;
distance.x *= aspect;
distance = pow(saturate(distance), vec2(radius));
float amount = pow(saturate(1.0 - dot(distance, distance)), feather * 5.0);
return color * mix(vignetteColor.rgb, vec3(1.0), amount);
}