Better sun halo colours

This commit is contained in:
Joshua Barretto 2019-09-25 14:16:02 +01:00
parent 6dbeda3267
commit 7e6eede740
2 changed files with 13 additions and 6 deletions

View File

@ -6,11 +6,13 @@ const vec3 SKY_DAY_TOP = vec3(0.1, 0.2, 0.9);
const vec3 SKY_DAY_MID = vec3(0.02, 0.08, 0.8);
const vec3 SKY_DAY_BOT = vec3(0.02, 0.01, 0.3);
const vec3 DAY_LIGHT = vec3(1.2, 1.0, 1.0);
const vec3 SUN_HALO_DAY = vec3(0.35, 0.35, 0.0);
const vec3 SKY_DUSK_TOP = vec3(0.06, 0.1, 0.20);
const vec3 SKY_DUSK_MID = vec3(0.35, 0.1, 0.15);
const vec3 SKY_DUSK_BOT = vec3(0.0, 0.1, 0.13);
const vec3 DUSK_LIGHT = vec3(3.0, 1.0, 0.3);
const vec3 SUN_HALO_DUSK = vec3(0.6, 0.1, 0.0);
const vec3 SKY_NIGHT_TOP = vec3(0.001, 0.001, 0.0025);
const vec3 SKY_NIGHT_MID = vec3(0.001, 0.005, 0.02);
@ -54,7 +56,7 @@ void get_sun_diffuse(vec3 norm, float time_of_day, out vec3 light, out vec3 diff
vec3 sun_chroma = sun_color * sun_light;
light = sun_chroma + PERSISTENT_AMBIANCE;
diffuse_light = sun_chroma * (dot(-norm, sun_dir) * 0.5 + 0.6) + PERSISTENT_AMBIANCE;
diffuse_light = sun_chroma * (dot(-norm, sun_dir) * 0.5 + 0.5) + PERSISTENT_AMBIANCE;
ambient_light = vec3(SUN_AMBIANCE * sun_light);
}
@ -137,12 +139,17 @@ vec3 get_sky_color(vec3 dir, float time_of_day, bool with_stars) {
max(dir.z, 0)
);
vec3 sun_halo_color = mix(
SUN_HALO_DUSK,
SUN_HALO_DAY,
max(-sun_dir.z, 0)
);
// Sun
const vec3 SUN_HALO_COLOR = vec3(1.5, 0.65, 0.0) * 0.3;
const vec3 SUN_SURF_COLOR = vec3(1.5, 0.9, 0.35) * 200.0;
vec3 sun_halo = pow(max(dot(dir, -sun_dir) + 0.1, 0.0), 8.0) * SUN_HALO_COLOR;
vec3 sun_halo = pow(max(dot(dir, -sun_dir) + 0.1, 0.0), 8.0) * sun_halo_color;
vec3 sun_surf = pow(max(dot(dir, -sun_dir) - 0.0045, 0.0), 1000.0) * SUN_SURF_COLOR;
vec3 sun_light = (sun_halo + sun_surf) * clamp(dir.z * 10.0, 0, 1);

View File

@ -699,7 +699,7 @@ fn handle_lantern(server: &mut Server, entity: EcsEntity, args: String, action:
.write_storage::<comp::LightEmitter>()
.get_mut(entity)
{
light.strength = s.max(0.1).min(20.0);
light.strength = s.max(0.1).min(10.0);
server.clients.notify(
entity,
ServerMsg::private(String::from("You played with flame strength.")),
@ -727,9 +727,9 @@ fn handle_lantern(server: &mut Server, entity: EcsEntity, args: String, action:
offset: Vec3::new(0.5, 0.2, 0.8),
col: Rgb::new(1.0, 0.75, 0.3),
strength: if let Some(s) = opt_s {
s.max(0.0).min(20.0)
s.max(0.0).min(10.0)
} else {
6.0
3.0
},
},
);