POV-Ray : Newsgroups : povray.binaries.scene-files : "Crown of diamond" source code : "Crown of diamond" source code Server Time
2 Sep 2024 18:22:01 EDT (-0400)
  "Crown of diamond" source code  
From: Tor Olav Kristensen
Date: 27 May 2000 23:02:17
Message: <3930897A.1324FEC8@hotmail.com>
Below is the source code for an image I posted 27. May to the
povray.binaries.images news group.

Tor Olav

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
// Copyright 2000 by Tor Olav Kristensen
//
// Except for the code for the DiamondTexture and the DiamondInterior 
// which I borrowed (and modified) from the posting Sigmund Kyrre Aas 
// made to this news group; povray.binaries.scene-files, 26. May 2000:
// "Brilliant diamond".
//
// mailto:tor### [at] hotmailcom
// http://www.crosswinds.net/~tok/tokrays.html
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.1;

#include "colors.inc"

global_settings { 
  ambient_light 0.5
  max_trace_level 30
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#macro Tilt(Thing, Vector)

  #local xAngle = degrees((Vector.z < 0 ? -1 : 1)*
                  acos(vnormalize((x + z)*Vector).x));
  #local yAngle = degrees(acos(vnormalize(Vector).y));

  object {
    Thing
    rotate  xAngle*y
    rotate -yAngle*z
    rotate -xAngle*y
  }

#end // macro Tilt


#macro MCircleSpread(Thing, Radius, NrOfThings, Start)

  #local dAngle = 360/NrOfThings;

  #local Angle = Start*dAngle;
  #local Cnt = 0;
  #while (Cnt < NrOfThings)
    object { 
      Thing 
      translate Radius*x 
      rotate Angle*y
    }
    #local Angle = Angle + dAngle;
    #local Cnt = Cnt + 1;
  #end // while

#end // macro MCircleSpread

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#declare cR = 1.4; // To adjust the brightness of pigment

#declare RedPigment =
pigment {
  granite 
  turbulence 0.4
  color_map {
    [ 0.0 rgb <0.6, 0.1, 0.1>*cR ]
    [ 0.8 rgb <0.3, 0.0, 0.0>*cR ]
    [ 0.8 rgb <0.6, 0.1, 0.1>*cR ]
    [ 1.0 rgb <0.2, 0.0, 0.0>*cR ]
  }
}

#declare DiamondTexture =
texture { 
  pigment {
    color rgbf <0.81, 0.81, 0.8, 0.8>
  }
  finish {
    ambient 0.01
    diffuse 0.4 
  }
}

#declare DiamondInterior =
interior { 
  caustics 1
  ior 2.417 
  fade_power 1000   // Experiment with
  fade_distance 80  // these values
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

// Also try other numbers here
#declare FacetSides = 8; // This will make 8*9 + 2 = 74 facets 

#declare Brilliant =
intersection {
  plane { y, 0 }
  MCircleSpread(plane { y, 0 rotate  -27*z }, 3.00, FacetSides, 1/2) 
  MCircleSpread(plane { y, 0 rotate  -42*z }, 3.25, FacetSides,  0 )
  MCircleSpread(plane { y, 0 rotate  -47*z }, 3.62, FacetSides, 1/4)
  MCircleSpread(plane { y, 0 rotate  -47*z }, 3.62, FacetSides, 3/4)
  MCircleSpread(plane { y, 0 rotate  -90*z }, 6.20, FacetSides, 1/4)
  MCircleSpread(plane { y, 0 rotate  -90*z }, 6.20, FacetSides, 3/4)
  MCircleSpread(plane { y, 0 rotate -135*z }, 9.10, FacetSides, 1/4)
  MCircleSpread(plane { y, 0 rotate -135*z }, 9.10, FacetSides, 3/4)
  MCircleSpread(plane { y, 0 rotate -137*z }, 9.43, FacetSides,  0 )
  plane { -y, 8.2 }

  bounded_by { cylinder { 0.1*y, -8.3*y, 6.20/cos(pi/FacetSides) } }
}

#declare Diamond = 
object {
  Brilliant
  interior { DiamondInterior }
  texture { DiamondTexture }
}


#declare DimLight = light_source { -3*y, color White*0.15 }

#declare NrOfStringLights = 9;

#declare LightString = // Lights to be put inside diamond
union {
  #declare Cnt = 0;
  #while (Cnt < NrOfStringLights) 
    object { DimLight translate -(Cnt + 0.1)*y }  
    #declare Cnt = Cnt + 1;
  #end // while
}

#declare NrOfRingLights = 8;

#declare LightRing = // Can be used instead of LightString
union {
  MCircleSpread(DimLight, 1, NrOfRingLights, 0.0)
  translate -y
}


#declare LitDiamond =
union {
  object { Diamond }
  object { LightString }
//  object { LightRing }
  translate 4*y
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#declare vCamera = <5, 2, 0>;

// Make the diamond's crown face the camera
object {
  Tilt(LitDiamond, vCamera) 
//  translate 6*z // To make place for the second copy below
} 

/*
// Second copy of diamond viewed from another angle
object {
  Tilt(LitDiamond, <-1, 2, 0>)
  translate -16*z
}
*/

plane { 
  y, -8
  pigment { color Blue/2 }
  finish {
    ambient 0.2
    specular 0.3
    reflection 0.3
  }
}

sky_sphere {
  pigment { 
    RedPigment 
    scale 4
    rotate -20*y
  }
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#declare AreaLight =
light_source { 
  50*y, 
  color White*0.6
  area_light 3*x, 3*z, 3, 3
  adaptive 1 
  jitter 
}

Tilt(AreaLight, <-1, 2, 0>)

camera {
  location vCamera*4
  look_at -4*z 
  angle 100
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7


Post a reply to this message

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