diff --git a/walkabout-style.yaml b/walkabout-style.yaml index 0583864..398088d 100644 --- a/walkabout-style.yaml +++ b/walkabout-style.yaml @@ -922,75 +922,40 @@ styles: raster: normal shaders: uniforms: - # u_envmap: images/relief-shading-environment-map.jpg u_envmap: images/draw-test10.jpg - # u_envmap: https://raw.githubusercontent.com/tangrams/walkabout-style/gh-pages/images/draw-test10.jpg u_contrast: 1. u_brightness: 1. + u_zoom_scale: 3.5 blocks: global: | // Simplified view-independent environment map - vec4 terrainEnvmap (in sampler2D _tex, in vec3 _normal) { - const vec3 eye = vec3(0.,0.,-1.); - vec3 r = reflect(eye, _normal); - r.z += 1.; - float m = 2. * length(r); - vec2 uv = r.xy / m + .5; - return texture2D(_tex, uv); + vec4 applyEnvmap (in sampler2D _tex, in vec3 _normal, in float scale) { + _normal.z *= scale; + return texture2D(_tex, .5*(normalize(_normal).xy + 1.)); } - const float e = 2.71828; color: | - // scale up normals with a function - // https://www.desmos.com/calculator/bv4mzh8erz - //float scale = 10./(u_map_position.z-.7) + 1.8; - float scale1 = 20./(u_map_position.z) + 1.5; - normal.z /= scale1; // turn terrain exaggeration up/down + // turn terrain exaggeration up/down // fade out spheremap normals with a function - // https://www.desmos.com/calculator/ptgkzcnfyc - float m = 3.5 * (u_map_position.z - 0.8) * pow(e, u_map_position.z * -.29); + float scale1 = 20./(u_map_position.z) + 1.5; + float m = u_zoom_scale * (u_map_position.z - 0.8) * exp(u_map_position.z * -.29); m = clamp(m, 0., 1.5); - color = terrainEnvmap(u_envmap, normal); + color = applyEnvmap(u_envmap, normal, 1./scale1); - // Apply contrast + // apply contrast and brightness float contrast = m; color.rgb = ((color.rgb - 0.5) * max(contrast, 0.)) + 0.5; - // Apply brightness float brightness = .5 - m * .5; color.rgb += brightness; - color *= v_color; // apply layer color + // apply layer color + color *= v_color; terrain-park: - base: polygons - lighting: false - raster: normal + mix: terrain shaders: uniforms: u_envmap: images/walkabout-green1.jpg - blocks: - global: | - vec4 terrainEnvmap (in sampler2D _tex, in vec3 _normal) { - const vec3 eye = vec3(0.,0.,-1.); - vec3 r = reflect(eye, _normal); - r.z += 1.; - float m = 2. * length(r); - vec2 uv = r.xy / m + .5; - return texture2D(_tex, uv); - } - const float e = 2.71828; - color: | - float scale1 = 20./(u_map_position.z) + 1.5; - normal.z /= scale1; - float m = 3.95 * (u_map_position.z - 0.8) * pow(e, u_map_position.z * -.29); - m = clamp(m, 0., 1.5); - color = terrainEnvmap(u_envmap, normal); - - float contrast = m; - color.rgb = ((color.rgb - 0.5) * max(contrast, 0.)) + 0.5; - float brightness = .5 - m * .5; - color.rgb += brightness; - - color *= v_color; + u_zoom_scale: 3.95 # HSV/RGB functions hsv: