// Persistence of Vision Ray Tracer Scene Description File // File: landscape_HF.pov // Vers: 3.5 #declare Test = 5; // Test = 1: No problem // Test = 2: Using 'cosd' and 'sind': Problem visible // Test = 3: Using 'cos(radians)' and 'sin(radians)': Problem visible too // Test = 4: L2 and W2 twenty times smaller and now more expected result // Test = 5: L2 and W2 with numbers instead of 'cos' and 'sin' #include "math.inc" // View #declare CamH = 20; // km Camera Height #declare CamD = -20; // km Camera Distance: Standard at -LndScpDepth #declare CamS = 10; // km Camera Shift Left - Right: Standard at +LndScpWidth/2 // LandScapeDimension #declare LndScpWidth = 50; // km Landscape Width X-dir: > #declare LndScpDepth = 25; // km Landscape Depth Z-dir: ^ #declare LndScpHeight = 15; // km Landscape max height // When Export = off a low res of max MinRes points is used to keep parsetime low #declare Export = off; // on; // // Toggle between fast overview and slow export quality. #declare MaxRes = 1000; // // Max resolution of exported Heightfield in biggest dimension of landscape #declare MinRes = 300; // // View resolution // Landscape parts #declare WaterLevel = 0.5; // km Above sea level, must be positive, else weird terrain. // Mountain 1 #declare H1 = 9; // km: Height #declare L1 = 3; // km: Length X, > #declare W1 = 12; // km: Width Z, ^ #declare PosX1 = 25; // km: > #declare PosZ1 = 10; // km: ^ // Mountain 2 #declare H2 = 9; // km: Height #if (Test!=4) #declare L2 = 12; // km: Length X, > #declare W2 = 03; // km: Width Z, ^ #else #declare L2 = 12/20; // km: Length X, > #declare W2 = 03/20; // km: Width Z, ^ #end // #declare Rot2 = 60; // degrees rotation #declare PosX2 = 38; // km: > #declare PosZ2 = 5; // km: ^ #macro Mnt1() H1*exp(-pow((y-(LndScpDepth-PosZ1)/LndScpDepth)/(W1/LndScpDepth/4),2))*exp(-pow((x-PosX1/LndScpWidth)/(L1/LndScpWidth/4),2)) #end #switch (Test) #case (1) #macro Mnt2() H2*exp(-pow((y-(LndScpDepth-PosZ2)/LndScpDepth)/(W2/LndScpDepth/4),2)) *exp(-pow((x-PosX2/LndScpWidth)/(L2/LndScpWidth/4),2)) #end #debug concat("\nW2 = ",str(W2,0,-1),"\n") #break #case (2) #macro Mnt2() H2*exp(-pow((y-(LndScpDepth-PosZ2)/LndScpDepth)/((W2*cosd(Rot2)+L2*sind(Rot2))/LndScpDepth/4),2)) *exp(-pow((x-PosX2/LndScpWidth)/((W2*sind(Rot2)+L2*cosd(Rot2))/LndScpWidth/4),2)) #end #debug concat("\nW2*cosd = ",str(W2*cosd(60),0,-1),"\n") #break #range (3,4) #macro Mnt2() H2*exp(-pow((y-(LndScpDepth-PosZ2)/LndScpDepth)/((W2*cos(radians(Rot2))+L2*sin(radians(Rot2)))/LndScpDepth/4),2)) *exp(-pow((x-PosX2/LndScpWidth)/((W2*sin(radians(Rot2))+L2*cos(radians(Rot2)))/LndScpWidth/4),2)) #end #debug concat("\nW2*cos(radians) = ",str(W2*cos(radians(60)),0,-1),"\n") #break #case (5) #macro Mnt2() H2*exp(-pow((y-(LndScpDepth-PosZ2)/LndScpDepth)/((W2*0.5+L2*0.5)/LndScpDepth/4),2)) *exp( -pow( (x-PosX2/LndScpWidth) / ( (W2*0.5+L2*0.5)/LndScpWidth/4 ) ,2) ) #end #debug concat("\nW2*0.5 = ",str(W2*0.5,0,-1),"\n") #break #end //switch // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #declare Tex = texture { pigment { gradient y color_map { [0.00 color rgb <.5, .5, .05>] [0.13 color rgb <.1, .5, .4>] [0.46 color rgb <.4, .3, .1>] [0.58 color rgb <.9, .9, .9>] [1.00 color rgb <.95, .95, .95>] } } finish { ambient 1 diffuse 0.6 } } // Height_field Resolution #declare Res = (Export ? MaxRes : MinRes); #if (LndScpWidth>=LndScpDepth) #declare ResX = Res; #declare ResZ = int(Res*LndScpDepth/LndScpWidth); #else #declare ResZ = Res; #declare ResX = int(Res*LndScpWidth/LndScpDepth); #end //if object { height_field { function ResX, ResZ { 1/LndScpHeight*( WaterLevel +Mnt1() +Mnt2() ) } //func } texture { Tex } scale } //obj // parallel light_source light_source { <-LndScpWidth*2,LndScpDepth*3, -LndScpDepth*2> color rgb <1,1,1> parallel point_at } // camera wide angle (90) camera { perspective location <(LndScpWidth/2+CamS), CamH, (-LndScpDepth-CamD)> look_at right x*image_width/image_height angle 90 }