Made sprite/block selection effect more subtle

This commit is contained in:
Joshua Barretto 2021-04-18 12:11:38 +01:00 committed by Monty Marz
parent a4d56e7843
commit 483276b082
3 changed files with 10 additions and 6 deletions

View File

@ -18,7 +18,7 @@
in vec3 f_pos;
flat in vec3 f_norm;
flat in float f_light;
flat in float f_select;
// flat in vec3 f_pos_norm;
in vec2 f_uv_pos;
in vec2 f_inst_light;
@ -181,7 +181,10 @@ void main() {
emitted_light *= ao;
reflected_light *= ao;
surf_color = illuminate(max_light, view_dir, surf_color * emitted_light, surf_color * reflected_light) * f_light;
f_col += f_select * 0.05;
reflected_light += f_select * 0.03 * max_light / PERSISTENT_AMBIANCE;
surf_color = illuminate(max_light, view_dir, surf_color * emitted_light, surf_color * reflected_light);
// vec3 surf_color = illuminate(f_col, light, diffuse_light, ambient_light);
// tgt_color = vec4(color, 1.0);

View File

@ -72,7 +72,7 @@ uniform u_terrain_locals {
out vec3 f_pos;
flat out vec3 f_norm;
flat out float f_light;
flat out float f_select;
// flat out vec3 f_pos_norm;
// out vec3 f_col;
// out float f_ao;
@ -228,7 +228,7 @@ void main() {
// f_light = 1.0;
// if (select_pos.w > 0) */{
vec3 sprite_pos = /*round*/floor(((inst_mat * vec4(-offs.xyz, 1)).xyz) * SCALE/* - vec3(0.5, 0.5, 0.0)*/) + inst_offs;
f_light = (select_pos.w > 0 && select_pos.xyz == sprite_pos/* - vec3(0.5, 0.5, 0.0) * SCALE*/) ? 10.0 : 1.0;
f_select = (select_pos.w > 0 && select_pos.xyz == sprite_pos/* - vec3(0.5, 0.5, 0.0) * SCALE*/) ? 1.0 : 0.0;
// }
gl_Position =

View File

@ -268,8 +268,9 @@ void main() {
vec3 glow = glow_light(f_pos) * (pow(f_glow, 6) * 5 + pow(f_glow, 1.5) * 2);
reflected_light += glow;
float f_select = (select_pos.w > 0 && select_pos.xyz == floor(f_pos - f_norm * 0.5)) ? 0.2 / PERSISTENT_AMBIANCE : 0.0;
reflected_light += f_select;
float f_select = (select_pos.w > 0 && select_pos.xyz == floor(f_pos - f_norm * 0.5)) ? 1.0 : 0.0;
f_col += f_select * 0.05;
reflected_light += f_select * 0.03 * max_light / PERSISTENT_AMBIANCE;
max_light += lights_at(f_pos, f_norm, view_dir, mu, cam_attenuation, fluid_alt, k_a, k_d, k_s, alpha, f_norm, 1.0, emitted_light, reflected_light);