// Cityscape inspired by old town + distant castle (fast iteration) - FIXED // Single-file POV-Ray SDL #version 3.7; global_settings { assumed_gamma 1.8 max_trace_level 16 radiosity { pretrace_start 0.08 pretrace_end 0.01 count 200 nearest_count 10 error_bound 0.5 recursion_limit 2 low_error_factor 0.5 gray_threshold 0.0 } } background { color rgb <0.58, 0.70, 0.92> } #include "colors.inc" #include "textures.inc" fog { distance 220 color rgb <0.58, 0.70, 0.92> fog_type 2 fog_offset 0 fog_alt 5 turbulence 0.4 } camera { location <5, 9, -25> look_at <0, 5, 22> angle 48 } light_source { <45, 65, -40> color rgb <1.00, 0.82, 0.62>*0.55 area_light <10,0,0>, <0,0,10>, 5, 5 adaptive 1 jitter } light_source { <-30, 35, -10> color rgb <1.00, 0.90, 0.80>*0.40 area_light <7,0,0>, <0,0,7>, 4, 4 adaptive 1 jitter } #declare MAT_Ground = texture { pigment { color rgb <0.24,0.24,0.26> } finish { diffuse 0.9 specular 0.05 roughness 0.15 } }; #declare MAT_Stone = texture { pigment { color rgb <0.55,0.54,0.52> } normal { bumps 0.35 scale 0.25 } finish { diffuse 0.85 specular 0.08 roughness 0.18 } }; #declare MAT_Plaster = texture { pigment { color rgb <0.78,0.74,0.68> } normal { bumps 0.25 scale 0.35 } finish { diffuse 0.9 specular 0.04 roughness 0.22 } }; #declare MAT_Wood = texture { pigment { color rgb <0.30,0.18,0.10> } normal { wrinkles 0.3 scale 0.2 } finish { diffuse 0.85 specular 0.08 roughness 0.15 } }; #declare MAT_RoofRed = texture { pigment { color rgb <0.48,0.18,0.13> } normal { bumps 0.45 scale 0.18 } finish { diffuse 0.85 specular 0.08 roughness 0.22 } }; #declare MAT_RoofSlate = texture { pigment { color rgb <0.22,0.25,0.30> } normal { bumps 0.35 scale 0.22 } finish { diffuse 0.85 specular 0.06 roughness 0.25 } }; #declare MAT_WindowGlow = texture { pigment { color rgb <1.00,0.70,0.35> } finish { emission 1 diffuse 0 } }; #declare MAT_LampGlow = texture { pigment { color rgb <1.00,0.78,0.45> } finish { emission 1.2 diffuse 0 } }; // Ground and main street plane { y, 0 texture { MAT_Ground } } box { <-2.8, 0.001, -40>, <2.8, 0.02, 80> texture { pigment { color rgb <0.20,0.20,0.22> } finish { diffuse 0.85 specular 0.05 roughness 0.2 } } } // Sidewalk strips box { <-4.0, 0.001, -40>, <-2.8, 0.03, 80> texture { pigment{color rgb <0.28,0.28,0.30>} finish{diffuse 0.9 specular 0.03} } } box { < 2.8, 0.001, -40>, < 4.0, 0.03, 80> texture { pigment{color rgb <0.28,0.28,0.30>} finish{diffuse 0.9 specular 0.03} } } // Gentle hill for the castle sphere { <0, -80, 95>, 90 texture { pigment { color rgb <0.22,0.27,0.22> } finish { diffuse 0.9 specular 0.02 roughness 0.3 } } } // ---------- Building macro ---------- #macro OldTownBuilding(Pos, W, D, H, WallTex, RoofTex, WinCount, WinStartY) union { // Main volume box { <0,0,0>, texture { WallTex } } // Slight base plinth box { <-0.05,0,-0.05>, texture { pigment{ color rgb <0.45,0.44,0.42> } finish{ diffuse 0.9 specular 0.04 roughness 0.2 } } } // Roof (simple gable) - CLOSE PROFILE to avoid prism warnings prism { linear_sweep linear_spline 0, D 4, <0, H>, , , <0, H> texture { RoofTex } } // Windows on the street-facing side (z=0 face) #local i = 0; #local denom = max(WinCount-1, 1); #while (i < WinCount) #local wx = 0.35 + (W-0.7) * (i/denom); box { , texture { MAT_WindowGlow } } #local i = i + 1; #end // Door box { , texture { MAT_Wood } } translate Pos } #end // ---------- Street lamps ---------- #macro StreetLamp(P) union { cylinder { <0,0,0>, <0,3.0,0>, 0.06 texture { pigment{color rgb <0.12,0.12,0.13>} finish{diffuse 0.7 specular 0.2 roughness 0.08} } } cylinder { <0,3.0,0>, <0.45,3.15,0>, 0.05 texture { pigment{color rgb <0.12,0.12,0.13>} finish{diffuse 0.7 specular 0.2 roughness 0.08} } } sphere { <0.60,3.15,0>, 0.16 texture { MAT_LampGlow } } sphere { <0.60,3.15,0>, 0.18 texture { pigment{color rgbt <1,1,1,0.75>} finish{diffuse 0.1 specular 0.1 roughness 0.2} } } translate P } #end // ---------- Old town blocks ---------- #declare z0 = -6; OldTownBuilding(<-9.5,0,z0>, 3.2, 4.2, 7.2, MAT_Plaster, MAT_RoofRed, 3, 2.7) OldTownBuilding(<-6.0,0,z0>, 2.4, 3.6, 6.2, MAT_Stone, MAT_RoofSlate, 2, 2.6) OldTownBuilding(<-3.2,0,z0>, 2.0, 3.2, 5.6, MAT_Plaster, MAT_RoofRed, 2, 2.4) OldTownBuilding(< 3.2,0,z0>, 2.1, 3.3, 5.8, MAT_Stone, MAT_RoofSlate, 2, 2.5) OldTownBuilding(< 5.9,0,z0>, 2.6, 3.7, 6.6, MAT_Plaster, MAT_RoofRed, 3, 2.6) OldTownBuilding(< 9.0,0,z0>, 3.1, 4.0, 7.4, MAT_Stone, MAT_RoofRed, 3, 2.8) // Second row (back and staggered) OldTownBuilding(<-10.2,0, 2>, 3.5, 4.6, 8.0, MAT_Stone, MAT_RoofSlate, 3, 3.0) OldTownBuilding(< -6.2,0, 2.4>, 2.2, 3.3, 6.0, MAT_Plaster, MAT_RoofRed, 2, 2.6) OldTownBuilding(< -3.5,0, 3.0>, 2.4, 3.6, 6.8, MAT_Plaster, MAT_RoofSlate, 2, 2.8) OldTownBuilding(< 3.8,0, 2.8>, 2.5, 3.5, 6.7, MAT_Stone, MAT_RoofRed, 2, 2.7) OldTownBuilding(< 6.8,0, 2.2>, 2.1, 3.2, 6.1, MAT_Plaster, MAT_RoofSlate, 2, 2.6) OldTownBuilding(< 9.6,0, 2.0>, 3.2, 4.4, 8.2, MAT_Stone, MAT_RoofRed, 3, 3.1) // Street lamps StreetLamp(<-3.6,0, 2>) StreetLamp(< 3.6,0, 8>) StreetLamp(<-3.6,0, 14>) StreetLamp(< 3.6,0, 20>) StreetLamp(<-3.6,0, 26>) // Chimneys #macro Chimney(P, H) union { box { <-0.12,0,-0.12>, <0.12,H,0.12> texture { MAT_Stone } } translate P } #end Chimney(<-8.8,7.2, -4.0>, 1.0) Chimney(<-5.6,6.2, -3.4>, 0.9) Chimney(< 7.2,6.6, -3.0>, 1.0) Chimney(< 9.8,7.4, -3.5>, 1.1) // ---------- Distant castle on hill ---------- #declare CastleColor = texture { pigment { color rgb <0.42,0.42,0.45> } finish { diffuse 0.85 specular 0.05 roughness 0.2 } }; #macro Tower(P, R, H) union { cylinder { <0,0,0>, <0,H,0>, R texture { CastleColor } } // Simple crenellations #local k = 0; #local n = 8; #while (k < n) box { , texture { CastleColor } rotate <0, (360/n)*k, 0> } #local k = k + 1; #end translate P } #end union { // Main keep box { <-6, 0, 90>, <6, 10, 106> texture { CastleColor } } // Battlements on keep #local b = -5.5; #while (b <= 5.5) box { , texture { CastleColor } } box { , texture { CastleColor } } #local b = b + 1.2; #end // Towers Tower(<-7.5, 0, 92>, 2.2, 14) Tower(< 7.5, 0, 92>, 2.2, 14) Tower(<-7.5, 0,104>, 2.2, 14) Tower(< 7.5, 0,104>, 2.2, 14) // Gatehouse hint (FIX: remove degenerate cylinder; use torus as arch cutter) box { <-2.2, 0, 88>, <2.2, 7.5, 92> texture { CastleColor } } difference { // solid gate block box { <-1.4, 0, 88.0>, <1.4, 5.0, 92.0> } // rectangular opening lower part box { <-0.9, 0, 87.99>, <0.9, 3.2, 92.01> } // rounded top cutter (a "half-ring" torus pushed through the gate) torus { 0.9, 0.12 rotate <90,0,0> translate <0,3.2,90> } texture { CastleColor } } // Slight darkening for distant silhouette pigment { color rgb <0.36,0.36,0.40> } finish { diffuse 0.85 specular 0.03 roughness 0.25 } // Place on hill translate <0, 6.5, 0> } // Subtle distant haze plane plane { z, 140 texture { pigment { color rgbt <0.58,0.70,0.92,0.85> } finish { diffuse 0 } } hollow }