#include "colors.inc" #include "rand.inc" #declare NOOB = object { box { 0 0 } pigment { rgbf<0, 0, 0, 0> } }; camera { perspective location <-30, 300, 200> up 2 * y right x rotate x * 15 } #macro windows(THRESHOLD, TEX_LIGHT_1, TEX_LIGHT_2, TEX_DARK) texture { pigment_pattern { cells } texture_map { [0 TEX_LIGHT_1 ] [THRESHOLD / 4 TEX_LIGHT_1 ] [THRESHOLD / 3 TEX_LIGHT_2 ] [THRESHOLD TEX_LIGHT_2 ] [THRESHOLD TEX_DARK ] [1 TEX_DARK ] } scale <3, 1, 3> } #end #macro tex_cr(COL, REFLECTION) texture { pigment { COL } finish { reflection { REFLECTION } ambient 0 diffuse 0.7 } } #end #macro tex_crad(COL, REFLECTION, AMBIENT, REFLECTION) texture { pigment { COL } finish { reflection { REFLECTION } ambient AMBIENT diffuse REFLECTION } } #end #declare TEX_WIN_LIGHT_1 = tex_crad(rgb<1, 0.5, 0.2>, 0, 0.8, 0.3); #declare TEX_WIN_LIGHT_2 = tex_crad(rgb<1, 0.8, 0.4>, 0, 0.8, 0.3); #macro roof_boxes(Y, MAX_HEIGHT, MAX_HORZ, MAX_COUNT, MAT_WALL, MAT_WINDOW) #local TOTAL = RRand(1, MAX_COUNT, RdmA); #local COUNT = 0; #while (COUNT < TOTAL) #local X1 = RRand(-MAX_HORZ, MAX_HORZ, RdmA); #local Z1 = RRand(-MAX_HORZ, MAX_HORZ, RdmA); #local X2 = RRand(-MAX_HORZ, MAX_HORZ, RdmA); #local Z2 = RRand(-MAX_HORZ, MAX_HORZ, RdmA); #local HEIGHT = RRand(MAX_HEIGHT / 2, MAX_HEIGHT, RdmA); box { material { MAT_WALL } } box { material { MAT_WINDOW } } box { material { MAT_WALL } } #local COUNT = COUNT + 1; #end #end #macro scraper_1(HEIGHT, WIDTH, WIN_THRESHOLD, TEX_WALL, CORNER_CUT) union { intersection { union { box { <-WIDTH, 0, -WIDTH> material { windows(WIN_THRESHOLD, TEX_WIN_LIGHT_1, TEX_WIN_LIGHT_2, TEX_WALL) } } box { <-(WIDTH + 1), HEIGHT - 5, -(WIDTH + 1)> material { texture { TEX_WALL } } } roof_boxes(HEIGHT, 3, WIDTH, 3, material { texture { TEX_WALL } }, material { texture { TEX_WIN_LIGHT_1 } }) } #local COUNT = 0; #while (COUNT < 4) object { plane { #if (CORNER_CUT < 0) <1, -CORNER_CUT, 1>, -10 #else <1, CORNER_CUT, 0>, -10 #end translate material { texture { TEX_WALL } } } rotate y * COUNT * 90 } #local COUNT = COUNT + 1; #end } box { <-WIDTH, 0, -WIDTH> material { texture { TEX_WALL } } } } #end #macro scraper_2(HEIGHT, RADIUS, WIN_THRESHOLD, TEX_WALL) #local MAT = material { windows(WIN_THRESHOLD, TEX_WIN_LIGHT_1, TEX_WIN_LIGHT_2, TEX_WALL) }; union { cylinder { <0, 0, 0> <0, HEIGHT - 3, 0> (RADIUS / 2) material { MAT } } cylinder { <0, HEIGHT - 3, 0> <0, HEIGHT, 0> (RADIUS / 2 + 1) material { texture { TEX_WALL } } } #local SHIP = intersection { union { #local Z = RADIUS / 8; box { <0, HEIGHT * 0.3, -Z> material { MAT } } box { <0, 0, -Z> material { texture { TEX_WALL } } } box { <0, HEIGHT * 0.8, -Z> material { texture { TEX_WALL } } } cylinder { <0, 0, 0> <0, HEIGHT * 0.3, 0> (RADIUS / 10) translate material { MAT } } } plane { <0.2, 1, 0>, 0 translate material { texture { TEX_WALL } } } }; object { SHIP rotate y * 0 } object { SHIP rotate y * 120 } object { SHIP rotate y * 240 } roof_boxes(HEIGHT, 2, RADIUS / 3, 2, material { texture { TEX_WALL } }, material { texture { TEX_WIN_LIGHT_2 } }) cylinder { 0, <0, 3, 0> (RADIUS * 0.7) material { texture { TEX_WALL } } } } #end #macro rand_scraper(MAX_HEIGHT) #local HEIGHT = RRand(150, MAX_HEIGHT, RdmA); #local WIN_THRESHOLD = RRand(0.05, 0.1, RdmA); #local C = RRand(0, 0.5, RdmA); #local COLOR = rgb; #local REFLECTION = RRand(0, 0.5, RdmA); #local AMBIENT = RRand(0, 0.5, RdmA); #local DIFFUSE = RRand(0, 0.5, RdmA); #local TEX_WALL = tex_crad(COLOR, REFLECTION, AMBIENT, DIFFUSE); #switch (RRand(0, 1, RdmA)) #range (0, 0.5) #local CORNER_CUT = RRand(-0.2, 0, RdmA); object { scraper_1(HEIGHT, 30, WIN_THRESHOLD, TEX_WALL, CORNER_CUT) } #break #range (0.5, 1) object { scraper_2(HEIGHT, 40, WIN_THRESHOLD, TEX_WALL) rotate y * RRand(0, 360, RdmA) } #break; #end #end #macro place_rand_scraper(COL, ROW) #local DIST = 120; #local Z = ROW * DIST * pow(1.01, ROW) + RRand(-10, 10, RdmA); #local X = COL * DIST + RRand(-10, 10, RdmA); object { #if ((COL = 0) & ((ROW = 2) | (ROW = 3))) #if (ROW = 3) object { scraper_2(180, 40, 0.1, tex_crad(color Gray20, 0.3, 0.5, 0.5)) rotate y * -50 } // object { scraper_1(180, 40, 0.1, tex_cr(rgb<0.5, 0.5, 0.6>, 1)) rotate y * 20 translate <0, 0, 100> } #else NOOB #end #else #local HEIGHT = Z / 10 + 150; #if (SHOW_RANDOM_SCRAPERS) rand_scraper(HEIGHT) #else NOOB #end #end translate } #end #macro street(LENGTH, WIDTH, LIGHT_DIST) union { #local HW = WIDTH / 2; #local Z = 0; #local COUNT = 0; #while (Z < LENGTH) #local EVEN = (mod(COUNT, 2) = 0); union { #if (SHOW_STREET_LIGHTS) light_source { , rgb<1, RRand(0.7, 1, RdmA), RRand(0.4, 0.6, RdmA)> spotlight radius 0 falloff 45 point_at <0, 0, 0> } #else object { NOOB } #end union { cylinder { 0 (y * 5) 1 rotate (z * (EVEN ? 30 : -30)) translate (y * 20) material { tex_cr(color Gray, 0) } } cylinder { 0 (y * 20) 0.5 material { tex_cr(color Black, 0.2) } } translate <(EVEN ? HW : -HW), 0, 0> } translate <0, 0, Z> } #local Z = Z + LIGHT_DIST; #local COUNT = COUNT + 1; #end union { box { <-HW, 0, 0> } box { <-HW, 0, 0> <-(HW - 1), 3, LENGTH> } box { } box { <-0.5, 0, 0> <0.5, 5, LENGTH> } material { texture { pigment { color White } } } } } #end #macro main() light_group { #if (SHOW_SCRAPERS) #local ROW = 0; #while (ROW < 20) #local COL = -10; #while (COL < 10) place_rand_scraper(COL, ROW) #local COL = COL + 1; #end #local ROW = ROW + 1; #end object { scraper_2(600, 120, 0.1, tex_cr(rgb<0, 0, 0>, 0.3)) rotate y * -50 translate <-60, 0, 5000> } #end } #if (SHOW_SKY) sky_sphere { pigment { gradient <0.05, 1, -0.43> color_map { [0 rgb<222 / 256, 98 / 256, 0>] [0.05 rgb<222 / 256, 98 / 256, 0>] [0.1 rgb<210 / 256, 116 / 256, 54 / 256>] [0.15 rgb<221 / 256, 184 / 256, 90 / 256>] [0.2 rgb<165 / 256, 160 / 256, 165 / 256>] [0.3 rgb<93 / 256, 102 / 256, 136 / 256>] [0.4 rgb<26 / 256, 52 / 256, 117 / 256>] [1 rgb<0, 0, 0>] } scale 2 translate -1 } } #end #if (SHOW_GROUND) plane { y, 0 material { texture { pigment { color Gray } // normal { agate 0.03 scale 100 } // finish { reflection { 0.2 } ambient 0.5 diffuse 0.6 } // finish { reflection { 0 } ambient 0.5 diffuse 0.6 } } } } #end #if (SHOW_CLOUDS) plane { y, 400 material { texture { pigment { bozo color_map { [ 0 rgbf<1, 1, 1, 1> ] [ 0.3 rgbf<1, 1, 1, 1> ] [ 1 rgbf<0.8, 0.3, 0.0, 0.8> ] } scale 300 turbulence 1 } } } } plane { y, 410 material { texture { pigment { bozo color_map { [ 0 rgbf<1, 1, 1, 1> ] [ 0.4 rgbf<1, 1, 1, 1> ] [ 1 rgbf<0, 0, 0, 0.8> ] } scale 300 turbulence 1 } } } } #end #if (SHOW_STREETS) object { street(20000, 30, 50) translate <-60, 0, -100> } object { street(20000, 30, 50) translate <60, 0, -100> } #end global_settings { max_trace_level 5 } #end #declare SHOW_CLOUDS = 1; #declare SHOW_GROUND = 1; #declare SHOW_SKY = 1; #declare SHOW_SCRAPERS = 1; #declare SHOW_RANDOM_SCRAPERS = 1; #declare SHOW_STREETS = 1; #declare SHOW_STREET_LIGHTS = 1; #debug "===================================================\n" main() #debug "===================================================\n"