POV-Ray : Newsgroups : povray.binaries.images : IsoStones : Re: IsoStones Server Time
8 Aug 2024 12:26:44 EDT (-0400)
  Re: IsoStones  
From: PM 2Ring
Date: 20 Sep 2005 10:15:01
Message: <web.4330189c8195286cf00e1300@news.povray.org>
Chris Cason <nos### [at] deletethispovrayorg> wrote:

> This is nice work. Perhaps once you've finished with your tweaks to it you
> may like to consider submitting it (or a variation thereof) for consideration
> as a standard POV-Ray example scene.

Here's my latest polished-up version. Um, I suppose I should ask, how do I
submit it for consideration, Chris? :)

//------------------------------------------------------------

// Persistence of Vision Ray Tracer Scene Description File
// File: IsoStones.pov
// Vers: 3.6
// Desc: Tumbled stones in a square grid using a single isosurface
// Date: 2005.09.03
// Auth: PM 2Ring
//
// -D +A0.1 +AM2 +R2
// -F +A0.6 +AM2 +R2
//

#include "colors.inc"
#include "stones.inc"
#include "functions.inc"

global_settings {
  assumed_gamma 1.0
}

//Scene control
#declare Do_Sky = 1;              //Render sky sphere
#declare Do_Ground = 1;           //Render ground plane
#declare Do_Water = 1;            //Make ground plane reflective

#declare Use_SpotLight = 1;
#declare Use_AreaLight = 0;

//Stone parameters
#declare GridSize = 4;            //Total number of stones =
GridSize*GridSize
#declare Width = 1/GridSize;      //Cell width.
#declare Radius = Width*.70;      //Stone radius
#declare DRate = .875/Radius;     //Radius deformation rate
#declare Height = .55;            //Stone height

//---Functions------------------------------------------------

//Positive modulus: never returns negative values
#declare smod = function(A,B){mod(B + mod(A, B), B)}

//Centred modulus
#declare cmod = function(A,B){smod(A, 2*B) - B}

//2D cells: returns a random value for each unit square
#declare f_cell2D = function(x,z){f_snoise3d(floor(x), 0, floor(z))}

//Noisy modulus. Makes a random centre for each stone
#declare f_modnoise =
function(x,z){cmod(x, Width) + (Width-Radius)*f_cell2D(x*.5/Width,
z*.5/Width)}

//Randomized radius for tumbled stone shape
#declare f_Rad = function{1 + .45*f_snoise3d(x*DRate, y*DRate, z*DRate)}

//Displaced, vertically squashed spheres
#declare f_Stone = function{f_r(f_modnoise(x,z), y/Height,
f_modnoise(-z,x))}

//---Textures-------------------------------------------------

#declare StoneMax=44;             //Number of stone textures

//All the textures from stones.inc
#declare T_Stones =
array[StoneMax]{
  T_Stone1, T_Stone2, T_Stone3, T_Stone4, T_Stone5,
  T_Stone6, T_Stone7, T_Stone8, T_Stone9, T_Stone10,
  T_Stone11, T_Stone12, T_Stone13, T_Stone14, T_Stone15,
  T_Stone16, T_Stone17, T_Stone18, T_Stone19, T_Stone20,
  T_Stone21, T_Stone22, T_Stone23, T_Stone24, T_Stone25,
  T_Stone26, T_Stone27, T_Stone28, T_Stone29, T_Stone30,
  T_Stone31, T_Stone32, T_Stone33, T_Stone34, T_Stone35,
  T_Stone36, T_Stone37, T_Stone38, T_Stone39, T_Stone40,
  T_Stone41, T_Stone42, T_Stone43, T_Stone44,
}

//Build a random cellfield of all the stone textures
#declare MultiStone =
texture{
  //function{.5+f_cell2D(x,z-7)}
  cells translate y*.5
  texture_map{
  #declare I=0;
  #while(I<StoneMax)
    [I/StoneMax T_Stones[I]]
    [(I+1)/StoneMax T_Stones[I]]
    #declare I=I+1;
  #end
  }
}

//---The scene------------------------------------------------

//The stones. Scaled so that textures appears the same,
//no matter how many stones are done.
isosurface{
  function{f_Stone(x,y,z) - Radius*f_Rad(x,y,z)}
  //function {f_r(cmod(x, Width), y/Height, cmod(z, Width)) - Radius}

  contained_by{box{<-1,-Width*Height,-1>, <1,Width*Height,1>}}
  max_gradient 5
  accuracy 5e-3

  texture{MultiStone scale 2*Width}

  //scale 1.7             //Fill view with stones
  rotate -3*y
  translate <0, .35*Radius*Height-1, 1>
}

#if(Do_Sky)
  sky_sphere {
    pigment {
      gradient y
      color_map {
        [.4 rgb .1]
        [.9 rgb .8]
        [1 rgb 1]
      }
    }
  }
#else
  background{rgb .5}
#end

#if(Do_Ground)
  plane {
    y, -1.0001
    pigment {rgb <1, .915, .620>}
    finish{
      ambient 0 diffuse .85
      specular .25 roughness 1e-3
      #if(Do_Water) diffuse 0.65 reflection{0, .9} #end
    }
    normal {
       ripples .075
       turbulence .175
       frequency 12
       scale .4
       translate -1
    }
  }
#end

camera {
  location  <.45, 8, -8> * .2
  direction z
  right     x*image_width/image_height up y
  look_at   y*-.175
  angle 40
}

light_source {
  <-1, 1, -1> * 30
  rgb 120 fade_distance 3 fade_power 2

  #if(Use_SpotLight)
    spotlight point_at <-1,-1,0> falloff 2.25 radius .35
  #end
  #if(Use_AreaLight)
    area_light 9*x,9*z,7,7 jitter adaptive 1 orient circular
  #end
}

//------------------------------------------------------------


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.