docs(7): Add section descriptions
This commit is contained in:
parent
4ee02fd3b9
commit
b7461cef99
1 changed files with 19 additions and 4 deletions
|
@ -59,7 +59,7 @@ void main()
|
||||||
normal = normalize(normal);
|
normal = normalize(normal);
|
||||||
|
|
||||||
/* * * * * * *
|
/* * * * * * *
|
||||||
* Color *
|
* Color-pre *
|
||||||
* * * * * * */
|
* * * * * * */
|
||||||
float sun_specular_exponent = 1000.0;
|
float sun_specular_exponent = 1000.0;
|
||||||
vec3 ka = vec3(0.1, 0.1, 0.1);
|
vec3 ka = vec3(0.1, 0.1, 0.1);
|
||||||
|
@ -69,7 +69,12 @@ void main()
|
||||||
float bump = bump_height(is_moon, normalize(sphere_fs_in));
|
float bump = bump_height(is_moon, normalize(sphere_fs_in));
|
||||||
|
|
||||||
if (!is_moon) {
|
if (!is_moon) {
|
||||||
if (bump < 0.0) { /* Water */
|
/* * * * * * *
|
||||||
|
* Planet *
|
||||||
|
* * * * * * */
|
||||||
|
|
||||||
|
/* Water */
|
||||||
|
if (bump < 0.0) {
|
||||||
kd = vec3(0.2, 0.35, 0.8);
|
kd = vec3(0.2, 0.35, 0.8);
|
||||||
sun_specular_exponent = 4000.0;
|
sun_specular_exponent = 4000.0;
|
||||||
|
|
||||||
|
@ -84,7 +89,9 @@ void main()
|
||||||
|
|
||||||
normal = normal_dir + normal*wave;
|
normal = normal_dir + normal*wave;
|
||||||
normal = normalize(normal);
|
normal = normalize(normal);
|
||||||
} else { /* Land */
|
}
|
||||||
|
/* Land */
|
||||||
|
else {
|
||||||
ks = vec3(0.0, 0.0, 0.0);
|
ks = vec3(0.0, 0.0, 0.0);
|
||||||
kd = vec3(0.2, 0.8, 0.3);
|
kd = vec3(0.2, 0.8, 0.3);
|
||||||
|
|
||||||
|
@ -102,6 +109,7 @@ void main()
|
||||||
kd *= terrain_color;
|
kd *= terrain_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Clouds */
|
||||||
// Generate clouds, by creating cloud clusters and then filling those clusters with clouds.
|
// Generate clouds, by creating cloud clusters and then filling those clusters with clouds.
|
||||||
vec3 cloud_rotation = vec3(animation_seconds * cloud_speed, 0.0, animation_seconds * cloud_speed);
|
vec3 cloud_rotation = vec3(animation_seconds * cloud_speed, 0.0, animation_seconds * cloud_speed);
|
||||||
|
|
||||||
|
@ -124,6 +132,7 @@ void main()
|
||||||
// Modify the normals to make the clouds look fluffy
|
// Modify the normals to make the clouds look fluffy
|
||||||
normal = mix(normal, normal_dir, cloud);
|
normal = mix(normal, normal_dir, cloud);
|
||||||
|
|
||||||
|
/* Color */
|
||||||
color = blinn_phong(ka, kd, ks, sun_specular_exponent, normal, view_dir, light_dir);
|
color = blinn_phong(ka, kd, ks, sun_specular_exponent, normal, view_dir, light_dir);
|
||||||
|
|
||||||
/* Twinking lights */
|
/* Twinking lights */
|
||||||
|
@ -154,10 +163,15 @@ void main()
|
||||||
color = clamp(color, 0.0, 1.0);
|
color = clamp(color, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/* * * * * * *
|
||||||
|
* Moon *
|
||||||
|
* * * * * * */
|
||||||
|
|
||||||
kd = vec3(0.2, 0.2, 0.2);
|
kd = vec3(0.2, 0.2, 0.2);
|
||||||
sun_specular_exponent = 500.0;
|
sun_specular_exponent = 500.0;
|
||||||
ks = vec3(0.1, 0.1, 0.1);
|
ks = vec3(0.1, 0.1, 0.1);
|
||||||
|
|
||||||
|
/* Charcoal color */
|
||||||
float charcoal = perlin_noise(sphere_fs_in.xyz * 2.3);
|
float charcoal = perlin_noise(sphere_fs_in.xyz * 2.3);
|
||||||
charcoal = pow(charcoal, 0.3);
|
charcoal = pow(charcoal, 0.3);
|
||||||
charcoal = 1.1 * smoothstep(0.1, 0.9, charcoal);
|
charcoal = 1.1 * smoothstep(0.1, 0.9, charcoal);
|
||||||
|
@ -168,9 +182,10 @@ void main()
|
||||||
// Smoothen the bumped normal
|
// Smoothen the bumped normal
|
||||||
normal = mix(normal, normal_dir, 1 - charcoal);
|
normal = mix(normal, normal_dir, 1 - charcoal);
|
||||||
|
|
||||||
|
/* Color */
|
||||||
color = blinn_phong(ka, kd, ks, sun_specular_exponent, normal, view_dir, light_dir);
|
color = blinn_phong(ka, kd, ks, sun_specular_exponent, normal, view_dir, light_dir);
|
||||||
|
|
||||||
/* Add charcoal glow */
|
/* Charcoal glow */
|
||||||
color = mix(color, kd, 1.0 - charcoal);
|
color = mix(color, kd, 1.0 - charcoal);
|
||||||
float glow_intensity = perlin_noise(vec3(0.25 * animation_seconds));
|
float glow_intensity = perlin_noise(vec3(0.25 * animation_seconds));
|
||||||
glow_intensity = pow(glow_intensity, 0.3);
|
glow_intensity = pow(glow_intensity, 0.3);
|
||||||
|
|
Reference in a new issue