mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed interaction between bloom and point glow
This commit is contained in:
parent
5a7cd39625
commit
c2644d8e71
@ -70,9 +70,7 @@ void main() {
|
|||||||
#if (CLOUD_MODE != CLOUD_MODE_NONE)
|
#if (CLOUD_MODE != CLOUD_MODE_NONE)
|
||||||
color.rgb = get_cloud_color(color.rgb, dir, cam_pos.xyz, time_of_day.x, dist, 1.0);
|
color.rgb = get_cloud_color(color.rgb, dir, cam_pos.xyz, time_of_day.x, dist, 1.0);
|
||||||
#else
|
#else
|
||||||
#ifdef BLOOM_FACTOR
|
color.rgb = apply_point_glow(cam_pos.xyz + focus_off.xyz, dir, dist, color.rgb, BLOOM_FACTOR);
|
||||||
color.rgb = apply_point_glow(cam_pos.xyz + focus_off.xyz, dir, dist, color.rgb, BLOOM_FACTOR);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tgt_color = vec4(color.rgb, 1);
|
tgt_color = vec4(color.rgb, 1);
|
||||||
|
@ -265,9 +265,7 @@ vec3 get_cloud_color(vec3 surf_color, vec3 dir, vec3 origin, const float time_of
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply point glow
|
// Apply point glow
|
||||||
#ifdef BLOOM_FACTOR
|
surf_color = apply_point_glow(origin, dir, max_dist, surf_color);
|
||||||
surf_color = apply_point_glow(origin, dir, max_dist, surf_color, BLOOM_FACTOR);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return surf_color;
|
return surf_color;
|
||||||
}
|
}
|
||||||
|
@ -318,9 +318,13 @@ vec3 lod_norm(vec2 f_pos/*vec3 pos*/) {
|
|||||||
#ifdef EXPERIMENTAL_PROCEDURALLODDETAIL
|
#ifdef EXPERIMENTAL_PROCEDURALLODDETAIL
|
||||||
vec2 wpos = f_pos + focus_off.xy;
|
vec2 wpos = f_pos + focus_off.xy;
|
||||||
norm.xy += vec2(
|
norm.xy += vec2(
|
||||||
textureLod(sampler2D(t_noise, s_noise), wpos / 200, 0).x - 0.5,
|
textureLod(sampler2D(t_noise, s_noise), wpos / 250, 0).x - 0.5,
|
||||||
textureLod(sampler2D(t_noise, s_noise), wpos / 200 + 0.5, 0).x - 0.5
|
textureLod(sampler2D(t_noise, s_noise), wpos / 250 + 0.5, 0).x - 0.5
|
||||||
) * 0.35;
|
) * 0.25 / pow(norm.z + 0.1, 3);
|
||||||
|
norm.xy += vec2(
|
||||||
|
textureLod(sampler2D(t_noise, s_noise), wpos / 100, 0).x - 0.5,
|
||||||
|
textureLod(sampler2D(t_noise, s_noise), wpos / 100 + 0.5, 0).x - 0.5
|
||||||
|
) * 0.15 / pow(norm.z + 0.1, 3);
|
||||||
norm = normalize(norm);
|
norm = normalize(norm);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -356,7 +360,10 @@ vec3 lod_col(vec2 pos) {
|
|||||||
vec2 shift = vec2(
|
vec2 shift = vec2(
|
||||||
textureLod(sampler2D(t_noise, s_noise), wpos / 200, 0).x - 0.5,
|
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
|
textureLod(sampler2D(t_noise, s_noise), wpos / 200 + 0.5, 0).x - 0.5
|
||||||
) * 64;
|
) * 64 + vec2(
|
||||||
|
textureLod(sampler2D(t_noise, s_noise), wpos / 50, 0).x - 0.5,
|
||||||
|
textureLod(sampler2D(t_noise, s_noise), wpos / 50 + 0.5, 0).x - 0.5
|
||||||
|
) * 48;
|
||||||
pos += shift;
|
pos += shift;
|
||||||
wpos += shift;
|
wpos += shift;
|
||||||
#endif
|
#endif
|
||||||
@ -365,10 +372,10 @@ vec3 lod_col(vec2 pos) {
|
|||||||
|
|
||||||
#ifdef EXPERIMENTAL_PROCEDURALLODDETAIL
|
#ifdef EXPERIMENTAL_PROCEDURALLODDETAIL
|
||||||
col *= pow(vec3(
|
col *= pow(vec3(
|
||||||
textureLod(sampler2D(t_noise, s_noise), wpos / 40, 0).x,
|
textureLod(sampler2D(t_noise, s_noise), wpos / 40, 0).x - 0.5,
|
||||||
textureLod(sampler2D(t_noise, s_noise), wpos / 50 + 0.5, 0).x,
|
textureLod(sampler2D(t_noise, s_noise), wpos / 50 + 0.5, 0).x - 0.5,
|
||||||
textureLod(sampler2D(t_noise, s_noise), wpos / 45 + 0.75, 0).x
|
textureLod(sampler2D(t_noise, s_noise), wpos / 45 + 0.75, 0).x - 0.5
|
||||||
), vec3(0.5));
|
) + 1.0, vec3(0.5));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return col;
|
return col;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef POINT_GLOW_GLSL
|
#ifndef POINT_GLOW_GLSL
|
||||||
#define POINT_GLOW_GLSL
|
#define POINT_GLOW_GLSL
|
||||||
|
|
||||||
vec3 apply_point_glow(vec3 wpos, vec3 dir, float max_dist, vec3 color, const float factor) {
|
vec3 apply_point_glow(vec3 wpos, vec3 dir, float max_dist, vec3 color) {
|
||||||
#ifndef POINT_GLOW_FACTOR
|
#ifndef POINT_GLOW_FACTOR
|
||||||
return color;
|
return color;
|
||||||
#else
|
#else
|
||||||
@ -36,7 +36,6 @@ vec3 apply_point_glow(vec3 wpos, vec3 dir, float max_dist, vec3 color, const flo
|
|||||||
color += light_color
|
color += light_color
|
||||||
* 0.05
|
* 0.05
|
||||||
// Constant, *should* const fold
|
// Constant, *should* const fold
|
||||||
* pow(factor, 0.65)
|
|
||||||
* POINT_GLOW_FACTOR;
|
* POINT_GLOW_FACTOR;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user