Proper tree colour variation

This commit is contained in:
Joshua Barretto 2019-10-07 09:05:18 +01:00
parent 6fc6864e7c
commit 087bfffc8a
3 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,7 @@ uniform u_shadows {
vec3 illuminate(vec3 color, vec3 light, vec3 diffuse, vec3 ambience) {
float avg_col = (color.r + color.g + color.b) / 3.0;
return ((color - avg_col) * light + (diffuse + ambience) * avg_col) * diffuse;
return ((color - avg_col) * light + (diffuse + ambience) * avg_col) * (diffuse + ambience);
}
float attenuation_strength(vec3 rpos) {

View File

@ -31,11 +31,11 @@ vec3 get_sun_dir(float time_of_day) {
const float PERSISTENT_AMBIANCE = 0.1;
float get_sun_brightness(vec3 sun_dir) {
return max(-sun_dir.z + 0.6, 0.0) * 0.8;
return max(-sun_dir.z + 0.6, 0.0);
}
void get_sun_diffuse(vec3 norm, float time_of_day, out vec3 light, out vec3 diffuse_light, out vec3 ambient_light) {
const float SUN_AMBIANCE = 0.1;
const float SUN_AMBIANCE = 0.0;
vec3 sun_dir = get_sun_dir(time_of_day);

View File

@ -564,7 +564,7 @@ pub fn block_from_structure(
let field = RandomField::new(structure_seed + 0);
let lerp = 0.5
+ ((field.get(Vec3::from(structure_pos)) % 256) as f32 / 256.0 - 0.5) * 0.65
+ ((field.get(Vec3::from(structure_pos)) % 256) as f32 / 256.0 - 0.5) * 0.85
+ ((field.get(Vec3::from(pos)) % 256) as f32 / 256.0 - 0.5) * 0.15;
match sblock {