-
Notifications
You must be signed in to change notification settings - Fork 5
Documentation: Attenuation Modifier
Essentuan edited this page Mar 28, 2026
·
1 revision
Controls the sampled color of a light. Disabled using PH_ATTENUATION_MODIFIER_DISABLED.
Usage:
vec3 modify_attenuation(
Light light,
vec3 to_light,
vec3 sample_pos,
vec3 source_pos,
vec3 geometry_normal,
vec3 texture_normal
) {
// The default implementation
float distance_squared = dot(to_light, to_light);
float light_dist_inv = inversesqrt(distance_squared);
vec3 light_dir = to_light * light_dist_inv;
if (dot(light_dir, geometry_normal) < 0.01f) return vec3(0f);
float att = 1f / (distance_squared * light.falloff * light.attenuation.y + light.attenuation.x);
att *= clamp(dot(texture_normal, light_dir), 0f, 1f);
return att * light.color;
}- Home
- Documentation
- How to adapt your Shaderpack