Addressed review comments, fixed perf issue

This commit is contained in:
Joshua Barretto 2022-01-19 22:30:06 +00:00 committed by Imbris
parent 53574bb6ec
commit 1ccbaac314
3 changed files with 8 additions and 8 deletions

View File

@ -33,7 +33,7 @@ float attenuation_strength(vec3 rpos) {
float attenuation_strength_real(vec3 rpos) {
float d2 = rpos.x * rpos.x + rpos.y * rpos.y + rpos.z * rpos.z;
return 1.0 / (0.0 + d2);
return 1.0 / (0.025 + d2);
}
// // Compute attenuation due to light passing through a substance that fills an area below a horizontal plane

View File

@ -321,9 +321,10 @@ vec3 lod_norm(vec2 f_pos/*vec3 pos*/) {
textureLod(sampler2D(t_noise, s_noise), wpos / 200, 0).x - 0.5,
textureLod(sampler2D(t_noise, s_noise), wpos / 200 + 0.5, 0).x - 0.5
) * 0.35;
norm = normalize(norm);
#endif
return normalize(norm);
return norm;
}

View File

@ -12,9 +12,12 @@ vec3 apply_point_glow(vec3 wpos, vec3 dir, float max_dist, vec3 color, const flo
float t = max(dot(light_pos - wpos, dir), 0);
vec3 nearest = wpos + dir * min(t, max_dist);
//if (t > max_dist) { continue; }
vec3 difference = light_pos - nearest;
float distance_2 = dot(difference, difference);
if (distance_2 > 100000.0) {
continue;
}
#if (CLOUD_MODE >= CLOUD_MODE_HIGH)
vec3 _unused;
float unused2;
@ -22,10 +25,6 @@ vec3 apply_point_glow(vec3 wpos, vec3 dir, float max_dist, vec3 color, const flo
#else
const float spread = 1.0;
#endif
float distance_2 = dot(difference, difference);
if (distance_2 > 100000.0) {
continue;
}
float strength = pow(attenuation_strength_real(difference), spread);