mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix sprite lighting, HDR from focus_pos.
This commit is contained in:
parent
0594238004
commit
d83b4ae69b
@ -129,15 +129,15 @@ float lights_at(vec3 wpos, vec3 wnorm, vec3 cam_to_frag, vec3 k_a, vec3 k_d, vec
|
||||
directed_light += is_direct ? direct_light * square_factor : vec3(0.0);
|
||||
ambient_light += is_direct ? vec3(0.0) : direct_light * LIGHT_AMBIENCE;
|
||||
|
||||
vec3 cam_light_diff = light_pos - cam_pos.xyz;
|
||||
vec3 cam_light_diff = light_pos - focus_pos.xyz;
|
||||
float cam_distance_2 = dot(cam_light_diff, cam_light_diff);// + 0.0001;
|
||||
float cam_strength = 1.0 / (/*4.0 * *//*PI * *//*1.0 + */cam_distance_2);
|
||||
|
||||
vec3 cam_pos_diff = cam_to_frag.xyz - wpos;
|
||||
float pos_distance_2 = dot(cam_pos_diff, cam_pos_diff);// + 0.0001;
|
||||
// vec3 cam_pos_diff = cam_to_frag.xyz - wpos;
|
||||
// float pos_distance_2 = dot(cam_pos_diff, cam_pos_diff);// + 0.0001;
|
||||
|
||||
float cam_distance = sqrt(cam_distance_2);
|
||||
float distance = sqrt(distance_2);
|
||||
// float cam_distance = sqrt(cam_distance_2);
|
||||
// float distance = sqrt(distance_2);
|
||||
float both_strength = cam_distance_2 == 0.0 ? distance_2 == 0.0 ? 0.0 : strength/* * strength*//*1.0*/ : distance_2 == 0.0 ? cam_strength/* * cam_strength*//*1.0*/ :
|
||||
// 1.0 / (cam_distance * distance);
|
||||
// sqrt(cam_strength * strength);
|
||||
|
@ -6,7 +6,7 @@ in vec3 f_pos;
|
||||
flat in vec3 f_norm;
|
||||
in vec3 f_col;
|
||||
in float f_ao;
|
||||
in float f_light;
|
||||
// in float f_light;
|
||||
|
||||
out vec4 tgt_color;
|
||||
|
||||
@ -57,7 +57,7 @@ void main() {
|
||||
|
||||
float point_shadow = shadow_at(f_pos, f_norm);
|
||||
// To account for prior saturation.
|
||||
float vert_light = pow(f_light, 1.5);
|
||||
// float vert_light = pow(f_light, 1.5);
|
||||
// vec3 light_frac = light_reflection_factor(f_norm/*vec3(0, 0, 1.0)*/, view_dir, vec3(0, 0, -1.0), vec3(1.0), vec3(R_s), alpha);
|
||||
/* light_frac += light_reflection_factor(f_norm, view_dir, vec3(1.0, 0, 0.0), vec3(1.0), vec3(1.0), 2.0);
|
||||
light_frac += light_reflection_factor(f_norm, view_dir, vec3(-1.0, 0, 0.0), vec3(1.0), vec3(1.0), 2.0);
|
||||
@ -72,9 +72,9 @@ void main() {
|
||||
// vec3 cam_to_frag = normalize(f_pos - cam_pos.xyz);
|
||||
float max_light = 0.0;
|
||||
max_light += get_sun_diffuse2(f_norm, /*time_of_day.x, */sun_dir, moon_dir, /*cam_to_frag*/view_dir, k_a/* * (shade_frac * 0.5 + light_frac * 0.5)*/, k_d, k_s, alpha, emitted_light, reflected_light);
|
||||
reflected_light *= vert_light * point_shadow * shade_frac;
|
||||
emitted_light *= vert_light * point_shadow * max(shade_frac, MIN_SHADOW);
|
||||
max_light *= vert_light * point_shadow * shade_frac;
|
||||
reflected_light *= /*vert_light * */point_shadow * shade_frac;
|
||||
emitted_light *= /*vert_light * */point_shadow * max(shade_frac, MIN_SHADOW);
|
||||
max_light *= /*vert_light * */point_shadow * shade_frac;
|
||||
// get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light, 1.0);
|
||||
// float point_shadow = shadow_at(f_pos, f_norm);
|
||||
// diffuse_light *= f_light * point_shadow;
|
||||
@ -83,7 +83,7 @@ void main() {
|
||||
// diffuse_light += point_light;
|
||||
// reflected_light += point_light;
|
||||
|
||||
max_light += lights_at(f_pos, f_norm, cam_to_frag, k_a, k_d, k_s, alpha, emitted_light, reflected_light);
|
||||
max_light += lights_at(f_pos, f_norm, view_dir, k_a, k_d, k_s, alpha, emitted_light, reflected_light);
|
||||
/* vec3 point_light = light_at(f_pos, f_norm);
|
||||
emitted_light += point_light;
|
||||
reflected_light += point_light; */
|
||||
|
@ -17,7 +17,7 @@ out vec3 f_pos;
|
||||
flat out vec3 f_norm;
|
||||
out vec3 f_col;
|
||||
out float f_ao;
|
||||
out float f_light;
|
||||
// out float f_light;
|
||||
|
||||
const float SCALE = 1.0 / 11.0;
|
||||
|
||||
@ -53,7 +53,7 @@ void main() {
|
||||
f_col *= 4.0;
|
||||
}
|
||||
|
||||
f_light = 1.0;
|
||||
// f_light = 1.0;
|
||||
|
||||
gl_Position =
|
||||
all_mat *
|
||||
|
Loading…
Reference in New Issue
Block a user