POV Ray 3.7 code /=============================================== // Random Newton's method mountain landscape // generation (POV-Ray 3.7 small spheres) //=============================================== #include "colors.inc" // Standard Color definitions #include "glass.inc" // Glass pigments #include "metals.inc" // Metal pigments global_settings {assumed_gamma 1.0} // set display gamma #declare Th = -60; // set rotation angles #declare Ph = 0; // Set a color of the background (sky) background { color red 0.2 green 0.6 blue 0.8 } plane { < 0.0, 10, 0.0 >, 1 // normal vector to palne | -1 is the height of the floor pigment { color .3*Green } normal { bumps 0.5 scale 0.6} // grass effect rotate < 0, Th, Ph >} camera {{ // set view point (camera) location location < 0, 120, -180> look_at < 0, -20, 0> angle 90} light_source // create a regular point light source { 0*x // light's position (translated below) color Gold // light's color translate <1000, 1000, -100> } light_source // Area light source (creates soft shadows) { 0*x // light's position (translated below) color Silver // light's color // nLightsWide mLightsHigh area_light <8, 0, 0> <0, 0, 8> // lights spread out across this distance (x * z) 4, 4 // total number of lights in grid (4x*4z = 16 lights) adaptive 0 // 0,1,2,3... jitter // adds random softening of light translate <40, 80, -40> // position of light } #declare R = 0.9; // set radius value #declare L = 1.0; // set square area side #declare X = 0.01; // set co-ordinate x initial value #declare Y = 0.01; // set co-ordinate y initial value #declare Cx = 0.0; // set x shift #declare Cy = 0.0; // set y shift #declare n = 400; // alternative value n = 300 // set number of pixels per area side #declare N = 20; // set number of cycles #declare K = array[n+1][n+1]; // image point matrix #for (p, 0, n, 1) // partial values -n/4, 0, n/4 #declare IncX = -L + 2*p*L/n; #for (q, 0, n, 1) #declare IncY = -L + 2*q*L/n; #declare X = IncX; #declare Y = IncY; #declare K[p][q] = 0; #for (k,0,N) #declare XX = 3*X/4 - X*(X*X - 3*Y*Y)/((X*X + Y*Y)*(X*X + Y*Y)* (X*X + Y*Y)*4); #declare YY = 3*Y/4 - Y*(Y*Y - 3*X*X)/((X*X + Y*Y)*(X*X + Y*Y)* (X*X + Y*Y)*4); #declare X = XX; #declare Y = YY; #if ((X - Cx)*(X-Cx) + (Y - Cy)*(Y - Cy) < R) #declare K[p][q] = k; #end // end if #end // end for k #end // end for q #end // end for p #declare Rnd_1 = seed (1153); // random numbers generator #declare Rnd_2 = seed (553); // replace n*n by n*n*clock for animation #for(j,0,n*n) // partial values n*n/64, n*n/16, n*n/4 #declare p = int(n*rand(Rnd_1)); #declare q = int(n*rand(Rnd_2)); #for(i,0,K[p][q]) sphere { < p-n/2, i, q-n/2 >, 1 hollow radiosity { importance 1.0 } texture { pigment { color rgb < abs(sin(.5*pi*i/N)), 0.3, abs(cos(.5*pi*(i/N))) > } } finish { ambient rgb <0.3,0.1,0.2> diffuse .3 reflection .3 specular 1 } rotate < 0, Th, Ph > translate < 0, 0, 0 > } #end // end for i #end // end for j