POV-Ray : Newsgroups : povray.general : How to generate grain boundaries ? : Re: How to generate grain boundaries ? Server Time
5 Jul 2024 10:58:46 EDT (-0400)
  Re: How to generate grain boundaries ?  
From: eticre
Date: 21 Jan 2015 19:30:00
Message: <web.54c043d08a1f7f441591f79b0@news.povray.org>
"z.ss.ulr" <z.s### [at] gmailcom> wrote:
> Dear friends , Please visit link below :
> http://upload.wikimedia.org/wikipedia/commons/c/cd/CrystalGrain.jpg
>
> I am a beginner with Pov-Ray , Yet I wonder is there anyone who could help me to
> create a code which generates a photo similar to the one above ?
>
> any help is greatly appreciated

hi

try this
posted image in povray.binary.imge

//*PMRawBegin
#version 3.7;
//*PMRawEnd

global_settings {
   adc_bailout 0.0039216
   ambient_light rgb<0, 0, 0>
   assumed_gamma 1
   noise_generator 2

   radiosity {
      recursion_limit 3
   }
}

light_source {
   <11, 10, 0>, rgb<1, 1, 1>
   parallel
}

camera {
   perspective
   location <0, 4.66, -0.4>
   sky <0, 1, 0>
   direction <0, 0, 1>
   right <1.33333, 0, 0>
   up <0, 1, 0>
   look_at <0, 0, 0>
}

#declare Fnp = function{ pigment {
   average

   pigment_map {
      [ 1 crackle
      turbulence <0.06, 0.05, 0.06>

      color_map {
         [ 0 color rgb<0, 0, 0> ]
         [ 0.01 color rgb<1, 1, 1> ]
      }
      ]
      [ 0.7 marble
      turbulence <2, 0, 0>
      omega 0.2

      color_map {
         [ 0 color rgb<1, 1, 1> ]
         [ 0.025 color rgb<1, 1, 1> ]
         [ 0.03 color rgb<0, 0, 0> ]
         [ 0.07 color rgb<0, 0, 0> ]
         [ 0.08 color rgb<1, 1, 1> ]
      }
      scale <0.025, 1, 10>
      ]
      [ 0.7 marble
      turbulence <2, 0, 0>
      omega 0.2

      color_map {
         [ 0 color rgb<1, 1, 1> ]
         [ 0.02 color rgb<1, 1, 1> ]
         [ 0.02 color rgb<0, 0, 0> ]
         [ 0.04 color rgb<0, 0, 0> ]
         [ 0.04 color rgb<1, 1, 1> ]
      }
      scale <0.4, 1, 10>
      rotate y*90
      ]
   }
}
}

isosurface {
function { y - Fnp(x,y,z).gray }
contained_by { box { <-10, 0.9, -10>, <10, 1, 10> } }
accuracy 0.01
max_gradient 1200
max_trace 1

texture {
   pigment {
      color rgbt <1, 1, 1, 0.5>
   }

   finish {
      diffuse 1
      brilliance 1
      metallic 1
      specular 0.1
      roughness 0.05

      reflection {
         rgb<0, 0, 0>, rgb<1, 1, 1>
         fresnel
         metallic 1
      }
   }

   normal {
      bumps
      0.1
      turbulence <0.2, 0.2, 0.2>
      scale 0.01
   }
}
hollow
}


Post a reply to this message

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