# Author @patriciogv - 2015 import: - https://raw.githubusercontent.com/skorasaurus/sc3n3/master/pericoli/default.yaml - https://tangrams.github.io/blocks/color/tools.yaml - https://tangrams.github.io/blocks/generative/noise.yaml - https://tangrams.github.io/blocks/geometry/normal.yaml - https://tangrams.github.io/blocks/space/tile.yaml - https://tangrams.github.io/blocks/texture/zoom-fade.yaml - https://tangrams.github.io/blocks/filter/hatch.yaml textures: hatch_0: url: https://raw.githubusercontent.com/skorasaurus/sc3n3/master/pericoli/hatch_0.png hatch_1: url: https://raw.githubusercontent.com/skorasaurus/sc3n3/master/pericoli/hatch_1.png hatch_2: url: https://raw.githubusercontent.com/skorasaurus/sc3n3/master/pericoli/hatch_2.png sem: url: https://raw.githubusercontent.com/skorasaurus/sc3n3/master/pericoli/sem-pericoli.png scene: background: color: [0.788,0.773,0.765] cameras: cam: type: isometric axis: [1,1] lights: dir: type: directional direction: [0, 1, -.5] lightTopLeft: type: point position: [-500px, 200px, 500px] origin: ground diffuse: .55 ambient: .1 radius: 1000px lightTopRight: type: point position: [900px, 200px, 500px] origin: ground diffuse: .55 ambient: .1 radius: 1000px lightBottomRight: type: point position: [700px, -800px, 200px] origin: ground diffuse: .55 ambient: .1 radius: 1000px lightBottomLeft: type: ambient position: [-700px, -800px, 200px] origin: ground diffuse: .55 ambient: .1 radius: 1000px layers: water: data: { source: osm } draw: water: color: [0.271,0.267,0.243] earth: data: { source: osm } draw: earth: color: [0.271,0.267,0.243] landuse: data: { source: osm } draw: landuse: color: [0.271,0.267,0.243] roads: data: { source: osm } filter: { not: { kind: [rail, ferry] } } draw: roads: color: '#343434' buildings: data: { source: osm } draw: buildings: color: white extrude: true buildingsLines: order: global.order-top width: [[12, .1px], [14, 0.1px], [15, 0.5px], [17, 1.0px], [18, 1px]] extrude: true color: [0.217,0.217,0.217] places: data: { source: osm } draw: text: font: family: Baskerville size: 20px style: italic fill: black stroke: { color: white , width: 7 } landuse_labels: data: { source: osm } filter: { name: true, kind: park, $zoom: { min: 16 } } draw: text: font: family: Baskerville size: 18px style: italic fill: black stroke: { color: white , width: 7 } styles: earth: base: polygons mix: texture-zoom-fade lighting: false shaders: uniforms: u_hatch: hatch_1 blocks: filter: | float pattern = 1.0-TileTexture(u_hatch,3.).a; color.rgb = mix(vec3(0.271,0.267,0.243), vec3(0.949,0.957,0.949), pattern); landuse: base: polygons mix: [earth] shaders: uniforms: u_hatch: hatch_2 water: base: polygons mix: [earth] shaders: uniforms: u_hatch: hatch_0 blocks: filter: | color.rgb = mix(vec3(0.396,0.867,1.000),vec3(0.271,0.267,0.243),pattern); roads: base: lines mix: [generative-noise] texcoords: true lighting: false shaders: blocks: filter: | vec2 uv = fract(v_texcoord*vec2(1.,.1)); color.rgb = mix(vec3(0.302,0.302,0.306),vec3(0.976,0.953,0.890),1.0-(smoothstep(0.,0.1,uv.x) * smoothstep(0.0,0.1,1.0-uv.x)+noise(uv*vec2(2.,70.)) )); buildings: base: polygons mix: [color-tools, geometry-normal, filter-hatch, generative-noise ] texcoords: true material: diffuse: 1. ambient: texture: sem mapping: spheremap shaders: blocks: position: | position.z *= max(1.0,0.5+(1.0-(u_map_position.z/20.0))*5.0); filter: | vec2 uv = v_texcoord; float b = getBrightness(light_accumulator_diffuse.rgb); float pattern = 1.0; if ( isWall() ){ // Walls b *= clamp(uv.y*1.5,0.0,1.0)+0.2; pattern = 1.-getHatch(uv,b); vec2 edge = vec2(0.1,0.05)*noise(uv*20.); vec2 blend = smoothstep(vec2(0.0),edge,uv)*smoothstep(vec2(0.0),edge,vec2(1.)-uv); pattern = mix(1.0,pattern,blend.x*blend.y); } else { // Roof b *= 1.8; //uv = worldPosition().xy*0.01; const float pixel_scale = 695.; float meter_pixels = u_meters_per_pixel / u_device_pixel_ratio; uv = gl_FragCoord.xy/pixel_scale; const float dot_wrap = 1000.; uv += mod(u_map_position.xy / meter_pixels, dot_wrap)/pixel_scale; uv *= 5.00; pattern = 1.-getHatch(uv,b); } color.rgb = clamp(color.rgb+noise(v_texcoord*5.)*0.2,0.,1.); color.rgb *= mix(vec3(0.271,0.267,0.243),vec3(0.949,0.957,0.949),pattern); buildingsLines: base: lines lighting: false shaders: blocks: width: | width *= 0.2+min(pow(position.z*0.006,2.),.6); position: | position.z *= max(1.0,0.5+(1.0-(u_map_position.z/20.0))*5.0);