Add experimental shader option that lowers glow strength for lights near the camera

This commit is contained in:
Imbris 2022-02-26 00:26:42 -05:00
parent 56a924b1c6
commit 08f67a335f
2 changed files with 10 additions and 0 deletions

View File

@ -30,6 +30,14 @@ vec3 apply_point_glow(vec3 wpos, vec3 dir, float max_dist, vec3 color) {
float strength = pow(attenuation_strength_real(difference), spread);
#ifdef EXPERIMENTAL_LOWGLOWNEARCAMERA
vec3 cam_wpos = cam_pos.xyz + focus_pos.xyz + focus_off.xyz;
vec3 cam_diff = light_pos - cam_wpos;
float cam_dist_2 = dot(cam_diff, cam_diff);
// 3 meters away glow returns to the maximum strength.
strength *= clamp(cam_dist_2 / 9.0, 0.25, 1.0);
#endif
vec3 light_color = srgb_to_linear(L.light_col.rgb) * strength;
const float LIGHT_AMBIANCE = 0.025;

View File

@ -456,4 +456,6 @@ pub enum ExperimentalShader {
/// Removes as many effects (including lighting) as possible in the name of
/// performance.
BareMinimum,
/// Lowers strength of the glow effect for lights near the camera.
LowGlowNearCamera,
}