POV-Ray : Newsgroups : povray.binaries.images : True catenary : Re: True catenary Server Time
19 May 2024 09:01:33 EDT (-0400)
  Re: True catenary  
From: PM 2Ring
Date: 12 Aug 2005 07:10:01
Message: <web.42fc7e285de03cffba8a7c6f0@news.povray.org>
This chain uses an interesting texture posted by Ross a few months ago.
See thread containing Message: <42c5bb9d@news.povray.org> for details

//Chain making macro
#include "Catenary.inc"

#declare Use_Normal = 1;

#declare Shiny = finish {ambient 0 specular 1 roughness 0.003 diffuse 0.3
reflection {0.2, 0.4 fresnel on} }
#declare Dull= finish {ambient 0 specular 0.6 roughness 0.03 diffuse 0.3 }

#declare Turb = <0.34, 0.3, 0.7>;

//Create a multi-warped pattern
#macro Pat(Step)
    leopard scale 0.15
    #local I = Step;
    #while (I > 0)
      warp {repeat x flip y}
      warp {turbulence Turb}
      scale 1.2
      #local I = I - 1;
    #end
#end

//Create texture using multi-warped pattern for normals & texture_map
#macro Tex(Step)
  #local fnPat = function {pattern {Pat(Step)}}
  #local n1 = normal {function {fnPat(x, y, z)} bump_size 2}

  #local t1 = texture {pigment {rgb 1} finish {Shiny} #if(Use_Normal) normal
{n1} #end }
  #local t2 = texture {pigment {rgb 0.2} finish {Dull} #if(Use_Normal)
normal {n1} #end }

  function {fnPat(x, y, z)}
  texture_map {[0 t1][1 t2]}
#end

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

//Simple chain macro. Parameters: Start point,End Point
#macro ChainQ(Start, End) Chain(Link, Start, End, Slack, Overlap, Twist)
#end

//Chain terminal post
#macro Terminal(Pos)
union{
  sphere{Pos, PostRad*1.6}
  cylinder{Pos*<1,0,1>, Pos-0.35*PostRad*y, PostRad}

  //pigment{rgb <.2, .5, 1>}
  //finish{Dull}
  //texture{Tex(8) scale PostRad}
}
#end

//Chain, with terminal at start
#macro TermChain(Start, End)
union{
  Terminal(Start)
  ChainQ(Start, End)
}
#end

//Link objects
#declare Torus = torus {.75, .175 scale 0.035*<1, 1, .65> }
#declare Torus1 = object {Torus scale 3 rotate 90*x}

//Chain parameters
#declare Link = Torus1;            //Link object
#declare Slack = 1.25;            //Slackness of the chain.
#declare Overlap = 1.65;          //Link overlap
#declare Twist = 0;               //Chain twist (in cycles)

#declare PostRad= 0.10;          //Post radius

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

/**** test scene ****/
sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>*.85]
      [0.6 rgb <0.0,0.1,0.8>*.75]
    }
  }
}

#declare Sandy = colour rgb <1, .80, 0.45>;

#declare PSand = pigment{
  granite scale 1e-3
  colour_map{
    [0 Sandy*.80]
    [0.5 Sandy]
    [1 Sandy*1.50]
  }
}

//Ground
plane {
  y, -1e-3
  texture {
    pigment {PSand}
    finish{ambient 0 diffuse .8 brilliance 0.75 specular 1 roughness 3e-3}
    normal{
      average
      normal_map{
        [1.5 wrinkles scale 3 bump_size 1]
        [.5 granite scale 1e-2 bump_size .75]
      }
    }
  }
}

//Points to connect
#declare V0 = <-1, 1, 0>;
#declare V1 = < 1, 1, 0>;

#if(1)
union{
  Terminal(V1)
  TermChain(V0, V1)

  texture{Tex(12) scale .5*PostRad}
}
#end

camera {
  right x*image_width/image_height up y
  direction z

  location  <0, 3*2.5, -12> * 0.375 * .275
  look_at   y*.75  * .75
  angle 30
}

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

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


Post a reply to this message


Attachments:
Download 'rnchaina1.jpg' (79 KB)

Preview of image 'rnchaina1.jpg'
rnchaina1.jpg


 

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