Skip to content

Instantly share code, notes, and snippets.

@tallytalwar
Last active August 27, 2018 22:14
Show Gist options
  • Save tallytalwar/fe49fdcdad28bd2c250027b027eaf0c8 to your computer and use it in GitHub Desktop.
Save tallytalwar/fe49fdcdad28bd2c250027b027eaf0c8 to your computer and use it in GitHub Desktop.
test scene
global:
feature_order: function() { return feature.sort_rank; }
sources:
mapzen:
type: MVT #GeoJSON, MVT, TopoJSON
url: https://tile.nextzen.org/tilezen/vector/v1/512/all/{z}/{x}/{y}.mvt
url_params:
api_key: global.sdk_api_key
tile_size: 512
max_zoom: 16
cameras:
isometric:
type: perspective
axis: [-.2, .2]
scene:
background:
color: global.earth_color
styles:
hillshade:
base: raster
raster: normal
lighting: none
shaders:
uniforms:
u_mult: 1.
u_envmap: mapzen-logo.png
u_strength_array: [30., 20., 15., 15., 8.,
5., 4., 3., 2.,
1.5, 1.25, 1.25, 1.25,
1.25, 1.25, .8, .4,
.4, .4, .4]
u_boost_array: [0., 0., 0., 0., 0.,
0., 0., 0., 0.,
0., 0., 0., 0.,
0., 0., 0., 0.,
.0, .0, .0]
blocks:
global: |
// Simplified view-independent environment map
vec4 applyEnvmap (in sampler2D _tex, in vec3 _normal) {
vec2 uv = 0.5 * _normal.xy + 0.5;
return texture2D(_tex, uv);
}
color: |
float mult = 1.;
float boost = 0.;
for (int x = 0; x < 21; ++x) {
if (x == int(u_tile_origin.z)) {
// mult = u_strength_array[x];
mult = mix(u_strength_array[x], u_strength_array[x+1], clamp(fract(u_map_position.z), 0., 1.));
boost = mix(u_boost_array[x], u_boost_array[x+1], clamp(fract(u_map_position.z), 0., 1.));
}
}
normal = normal * mult;
color *= applyEnvmap(u_envmap, normal) + boost;
color += boost;
terrain-green3:
mix: hillshade
shaders:
uniforms:
u_envmap: mapzen-logo.png
layers:
water:
data: { source: mapzen, layer: water }
draw:
polygons:
style: polygons
visible: true
order: global.feature_order
color: blue
landuse:
data: { source: mapzen, layer: landuse }
draw:
polygons:
order: global.feature_order
visible: false
forest-landcover:
draw:
polygons:
style: terrain-green3
visible: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment