POV-Ray : Newsgroups : povray.binaries.images : Crater field : Re: Crater field Server Time
8 Aug 2024 04:09:53 EDT (-0400)
  Re: Crater field  
From: PM 2Ring
Date: 30 Nov 2005 08:20:00
Message: <web.438da5cd133a23eb3dc12f230@news.povray.org>
"PM 2Ring" <nomail@nomail> wrote:
> "Kenneth" <kdw### [at] earthlinknet> wrote:

> > Which gave me an
> > idea!!  I took the image, stuck it into Photoshop, and inverted it (whites
> > to blacks and blacks to whites.) I couldn't resist; hope you don't mind!
> > Ah, the evils of post-processing!  :-)
> >
> > Here's the result...
>
> I like it! I'll try to post the craterfield generator tonight. I just need
> to write some docs for it...

I've written the docs, but now it looks like I can't upload .zip archives
(or maybe it's the downloading that causes archive corruption). Anyway,
here's a
simple scene file that can render using either a heightfield or a
isosurface, and a image to feed to it.

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

// Persistence of Vision Ray Tracer Scene Description File
// File: Crater.pov
// Desc: Render a contour map either as a heightfield or isosurface.
// Date: 2004.11.14
// Auth: PM 2Ring
//
// +A0.2 +AM2 +R3
// +A0.3 +AM2 +R2

#version 3.6;

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

#declare Use_Iso = 0;  //Render using heightfield or isosurface?

global_settings {
  assumed_gamma 1
}

camera {
  location <0, 2.25, -3.5> * 3.25 // * 2.875
  right x*image_width up y*image_height
  direction z
  angle 45

  look_at -2.5*y
}

light_source {<1, 5, -3>*50 rgb 1}

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

//RGB "rainbow" colour map
#declare CMRainbow =
color_map{
  [1/8 rgb<0,0,0>]
  [1/8 rgb<1,0,0>]
  [2/8 rgb<1,0,0>]
  [2/8 rgb<1,1,0>]
  [3/8 rgb<1,1,0>]
  [3/8 rgb<0,1,0>]
  [4/8 rgb<0,1,0>]
  [4/8 rgb<0,1,1>]
  [5/8 rgb<0,1,1>]
  [5/8 rgb<0,0,1>]
  [6/8 rgb<0,0,1>]
  [6/8 rgb<1,0,1>]
  [7/8 rgb<1,0,1>]
  [7/8 rgb<1,1,1>]
}

#declare CMIce0 =
color_map{
  [0 rgb <.1,.075,0.025>]
  [0.25 rgb <0.2 0.2 0.25>]
  [0.75 rgb <.7 .7 .8>]
  [1 rgb 1]
}

#declare CMIce1 =
color_map{
  [.15 rgb <.8 .9 1>]
  [.85 rgb <1 1 1.15>]
}

#declare Shiny2 =
finish {
  ambient .05
  diffuse .85
  specular .25 roughness 1e-3
  //phong .25 phong_size 25
  //brilliance 1.25
}

#declare TMount =
texture{
  pigment {
    #if(0)
      rgb <1,1,1.2>
    #else
      gradient y
      //wrinkles scale <.2 1 .2>

      color_map{
        //CMRainbow
        //CMIce0
        //CMIce1
        [0 rgb <.6,.7,.8>][1 rgb <1 1 1.1>]
      }
    #end
  }
  finish {Shiny2}
}

//-------------------------------------------
//Heightfield stuff
#declare GX = 1;       //horizontal repetitions
#declare GY = GX;      //vertical repetitions
#declare Grid = 1500;  //Heightfield grid size

//Heightfield source image
#declare CraterPigment =
pigment {
  image_map {
    //pgm "CraterHF.pgm"
    jpeg "CraterHF.jpg"
    interpolate 2
  }
  scale 2
  translate <mod(GX,2), mod(GY,2), 0>
}

//Heightfield source function
#declare NFunc = function{pigment{CraterPigment}}
#declare Scale = 8;
#declare Height = .035;

#declare Craters =
#if(Use_Iso)
  isosurface{
    function {y-NFunc(GX*x,GY*z,0).x}
    contained_by{box{<-1,0,-1>,<1,1,1>}}
    accuracy 0.0075
    max_gradient 12
  }
#else
  height_field{
    function Grid,Grid {NFunc(GX*(2*x-1),GY*(1-2*y),0).x}
    smooth
    translate <-1, 0, -1>/2
    scale <2 1 2>
  }
#end

object {
  Craters

  texture{TMount}
  scale <GX, Height, GY> * Scale/max(GX,GY)
}

background{rgb 0}

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


Post a reply to this message


Attachments:
Download 'craterhf.jpg' (183 KB)

Preview of image 'craterhf.jpg'
craterhf.jpg


 

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