/********************************************************************************** Persistence of Vision Ray Tracer Scene Description File File name : Cedeaq_Semi-random landscape.pov Version : 3.71 Description : Cedeaq wrote: "Some times ago, I wrote an endless pseudo random landscape scroller. It is based on a heightfield with a "Dents"-pattern as a function to the heightfield. IMO a very easy way, to generate pseudo random landscapes." Date : 10 October 2010 (original scene code) Author : Cedeaq (2010) + Thomas de Groot (2018) + Jörg "Yadgar" Bleimann (2018) E-mail : povray.general; in answer to Patrick Elliott's message: Need a way to make a semi random "landscape": http://news.povray.org/povray.general/thread/%3C4ca93948%40news.povray.org%3E/?ttop=371487&toff=200&mtop=351355 Copyright (C) 2010-2018. All rights reserved. Use and/or modification of this scene is free, except for commercial purposes. Commercial distribution is not allowed without written permission from the authors. **********************************************************************************/ // Render settings 3.7 (right-click on a line below): // +w1280 +h640 +a0.3 +am2 +bm2 +bs8 +wt6 //================================================================================= // VERSION, DEFAULTS, AND INCLUDES //================================================================================= // Choose your prefered version: //#version 3.71; #version 3.7; #local textpath = "/home/Raytracing/Povscn/Fonts/"; // change this according to your fonts location! global_settings {assumed_gamma 1.0} #default {pigment {rgb <1,0,0>}} #default {finish {ambient 0}} #include "colors.inc" //#include "rand.inc" //#include "functions.inc" //#include "transforms.inc" //================================================================================= // LANDSCAPE SWITCHES //================================================================================= #local Relief = 0.12; //accentuates or flatten the relief #local Turb1 = <1.5, 0.3, 1.8>; #local Turb2 = <0.8, 0.5, 0.5>; #local Pscale = <0.3, 0.15, 0.2>; //scale of the pattern #local Lscale = <10, 6, 10>; //scale of the height_field #local SnowLine = 0.00; #local TopVeg = -0.02; #local mapping = 1; // 0: no map is rendered, normal landscape views instead //================================================================================= // Textures: #local RockTex = texture { pigment { cells turbulence <1, 1, 1> omega 1 lambda 6 color_map { [ 0.00+0.2 color srgb <0.68627, 0.52157, 0.32157>] [ 0.95-0.1 color srgb <0.21176, 0.23922, 0.26275>] [ 0.98-0.1 color srgb <0.81569, 0.69412, 0.45098>] } matrix < 5, 0, 0, -1, 1, 0, 0, 0, 1, 0, 0, 0 > warp {turbulence <0.8, 0.5, 0.8>} } normal { cells 1 turbulence <1, 1, 1> omega 1 lambda 6 matrix < 5, 0, 0, -1, 1, 0, 0, 0, 1, 0, 0, 0 > accuracy 0.01 warp {turbulence <0.8, 0.5, 0.8>} scale 0.001 } } #local SnowTex = texture { pigment { slope { <0, -0.1, 0>, 0.0, 0.5 altitude <0, 0.9, 0>, 0.0, 1.0 } pigment_map { [0.30+SnowLine srgbf <0.8, 0.8, 0.9, 1.0>] [0.31+SnowLine srgbf <0.8, 0.8, 0.9, 0.0>] } warp {turbulence <0.05, 0.10, 0.05>} } normal { granite 1.0 scale 0.0001 } finish { diffuse 0.7 specular 0.5 roughness 0.0001 } } #local VegPig = pigment { cells pigment_map { [0.4 srgbf <0.1, 0.3, 0.1, 0.0>] [0.4 srgbf <0.9, 0.7, 0.0, 0.0>] [0.6 srgbf <0.9, 0.7, 0.0, 0.0>] [0.6 srgbf <0.3, 0.5, 0.1, 0.0>] [0.9 srgbf <0.3, 0.5, 0.1, 0.0>] [0.9 srgbf <0.2, 0.3, 0.1, 0.0>] } warp {turbulence 0.3} scale 0.05 warp {turbulence 0.4} } #local VegTex = texture { pigment { slope { <0, -0.1, 0>, 0.0, 0.5 altitude <0, 0.9, 0>, 0.0, 1.0 } pigment_map { [0.18+TopVeg VegPig] [0.20+TopVeg srgbt <0.2, 0.5, 0.1, 1.0>] } warp {turbulence <0.05, 0.10, 0.05>} } normal { granite 1.0 scale 0.0001 } finish { diffuse 0.7 specular 0.5 roughness 0.0001 } } #if (mapping) #local F_SelfShine = finish { ambient 1 diffuse 0 } #local PhyMapColors = array[28]{color rgb <0, 0, 0.15>, color rgb <0, 0, 0.3>, color rgb <0, 0, 0.6>, color rgb <0, 0, 0.9>, color rgb <0, 0.05, 1>, color rgb <0, 0.25, 1>, color rgb <0, 0.5, 1>, color rgb <0, 0.75, 1>, color rgb <0, 1, 1>, color rgb <0.2, 1, 1>, color rgb <0.4, 1, 1>, color rgb <0.6, 1, 1>, color rgb <0, 0.7, 0>, color rgb <0, 1, 0>, color rgb <0.3, 1, 0.45>, color rgb <1, 1, 0.75>, color rgb <1, 1, 0.4>, color rgb <1, 1, 0>, color rgb <1, 0.9, 0>, color rgb <1, 0.75, 0>, color rgb <1, 0.6, 0>, color rgb <1, 0.45, 0>, color rgb <1, 0.3, 0>, color rgb <1, 0.2, 0>, color rgb <1, 0.1, 0>, color rgb <0.8, 0.08, 0>, color rgb <0.6, 0.06, 0>, color rgb <0.4, 0.04, 0>}; #local ElevationLevels = array[29]{-10000, -8000, -6000, -4000, -3000, -2000, -1500, -1000, -500, -200, -100, -50, 0, 50, 100, 200, 300, 500, 700, 1000, 1500, 2000, 2500, 3000, 4000, 5000, 6000, 8000, 10000}; #local CM_PhysicalMap = color_map { #local elevRange = ElevationLevels[28]-ElevationLevels[0]; #local basis = ElevationLevels[0]; [0 PhyMapColors[0]] #local a=1; #while (a < 28) #local colorMapPos = (ElevationLevels[a]-ElevationLevels[0])/elevRange; #warning str(colorMapPos, 1, 5) [colorMapPos PhyMapColors[a-1]] [colorMapPos PhyMapColors[a]] #local a=a+1; #end [1 PhyMapColors[27]] } #local CM_Legend = color_map { [0 PhyMapColors[0]] #local a=1; #while (a < 28) [a/28 PhyMapColors[a-1]] [a/28 PhyMapColors[a]] #local a=a+1; #end [1 PhyMapColors[27]] // 10000 m } #local T_PhysicalMap = texture { pigment { gradient y color_map { CM_PhysicalMap } } finish { F_SelfShine } } #local T_Text = texture { pigment { color rgb 1 } finish { F_SelfShine } } #end //================================================================================= // Pattern: #declare fn_pattern = function { pattern { dents warp {turbulence Turb1} scale Pscale warp {turbulence Turb2} //translate y*5*clock } } #local HF = height_field { // Play with the function. change y to -y for instance function 2000, 2000 {fn_pattern (x, y, z)*Relief + fn_pattern (x*2, y*2, z*2)*Relief/2} scale Lscale rotate <0, 0, 0> translate <-Lscale.x/2, 0, -Lscale.z/2> #if (mapping) texture { T_PhysicalMap translate <0, -0.5, 0> scale 10 } #else texture {RockTex} texture {SnowTex scale <1, 1.1, 1> translate -0.1*y} texture {VegTex scale <1, 1.1, 1> translate -0.1*y} #end } HF #if (mapping) #local Legend = union { mesh2 { vertex_vectors { 4, <-Lscale.x/2, 0, -Lscale.z/2-0.2>, <-Lscale.x/2, 0, -Lscale.z/2-0.4>, , } face_indices { 2, <0, 1, 2>, <0, 2, 3> } texture { pigment { gradient -x color_map { CM_Legend } scale Lscale.x translate <-Lscale.x/2, 0, 0> } finish { F_SelfShine } } } union { #local a=0; #while (a < 29) text { #local eLevel=ElevationLevels[a]; #if (eLevel < 0) #local eLevel = abs(eLevel); #end ttf concat(textpath, "arial.ttf") str(eLevel, 1, 0), 0.01, 0 rotate <90, 0, 180> scale 0.12 #local digits=0; #while (eLevel > 0) #local eLevel = div(eLevel, 10); #local digits = digits + 1; #end translate } #local a = a + 1; #end texture { T_Text } } } text { ttf concat(textpath, "arial.ttf"), "Sea depths and land elevations in metres", 0.01, 0 scale 0.16 rotate <90, 0, 180> translate <4, 0, -Lscale.z/2-0.77> texture { T_Text } } box { <-3, 0, -Lscale.z/2-0.77>, <-4, 0.1, -Lscale.z/2-0.75> texture { T_Text } } text { ttf concat(textpath, "arial.ttf"), "1 km", 0.01, 0 scale 0.16 rotate <90, 0, 180> translate <-3.35, 0, -Lscale.z/2-0.93> texture { T_Text } } Legend #end //================================================================================= // Camera and light controls: #local Min = min_extent(HF); #local Max = max_extent(HF); #debug concat("\nminextent HF: <",vstr(3, Min, ", ", 0,3),">\n") #debug concat("maxextent HF: <",vstr(3, Max, ", ", 0,3),">\n\n") #if (!mapping) light_source { <4, 5, -5>*10e3 srgb <0.9, 0.9, 0.9>*2 parallel } #end #local Norm = <0,0,0>; #local Loc = trace(HF, <0, 1000, Min.z+0.20>, -y, Norm); #if (mapping) camera { orthographic up <0, 0, 12> right <12, 0, 0> location <0, 20, 0> look_at 0 } #else camera { perspective location sky <0, 1, 0> direction <0, 0, 1> right x*image_width/image_height up <0, 1, 0> look_at <0, Min.y, Max.z> angle 56 } #end //================================================================================= // Switch 'on' if you want to use a typical UperPOV features like no_cache #local Uber = off; #if (!mapping) global_settings { adc_bailout 0.00392157 noise_generator 2 radiosity { #if (Uber) no_cache brilliance on #end pretrace_start 0.08 // start pretrace at this size pretrace_end 0.004 // end pretrace at this size count 100, 1000 // higher -> higher quality (1..1600) [35] nearest_count 10, 5 // higher -> higher quality (1..10) [5] error_bound 1 // higher -> smoother, less accurate [1.8] recursion_limit 2 // how much interreflections are calculated (1..5+) [3] low_error_factor .3 // reduce error_bound during last pretrace step gray_threshold 0.0 // increase for weakening colors (0..1) [0] minimum_reuse 0.015 // reuse of old radiosity samples [0.015] maximum_reuse 0.1 // new parameter 3.7 [0.2] brightness 1 // brightness of radiosity effects (0..1) [1] adc_bailout 0.01/2 normal on // take surface normals into account [off] media off // take media into account [off] always_sample off // turn sampling in final trace off [on] //max_sample 1.0 // maximum brightness of samples } } //================================================================================= sky_sphere { pigment { gradient y color_map { [0.0 srgb <0.6, 0.7, 1.0>] [0.7 srgb <0.0, 0.1, 0.8>] } } } #declare NearFogColor = <0.799, 0.799, 0.80>*1.2; //Blueish color #declare FarFogColor = <0.900, 0.900, 0.90>; //Light gray horizon color //Near fog fog { fog_type 2 distance 1.000 fog_offset -0.5 fog_alt 0.3 color srgb NearFogColor up <0, 1, 0> } //Distant fog fog { fog_type 2 distance 10.000 fog_offset -0.5 fog_alt 0.3 color srgb FarFogColor-NearFogColor up <0, 1, 0> } #end