POV-Ray : Newsgroups : povray.advanced-users : Apparent circular pattern of scratches : Re: Apparent circular pattern of scratches Server Time
26 Apr 2024 02:17:16 EDT (-0400)
  Re: Apparent circular pattern of scratches  
From: omniverse
Date: 23 Jan 2019 19:20:00
Message: <web.5c4903f85e3f44509c5d6c810@news.povray.org>
"omniverse" <omn### [at] charternet> wrote:
Retry of random sticks scene I posted before, thanks to Thomas for the different
pattern.
Still not sure what I'm doing with it, making guesses about warp {} and scaling.
Lighting and surface finishes really play a major part in how the scratches
appear. As does antialiasing and image/object size, to name other things.

// BEGIN SCENE
//cmd: +w640 +h480 +am2 +a0.2 +r2

#version 3.8;
global_settings{ assumed_gamma 1.0 }

camera {
 perspective angle 90
 location <1.0, 3.0, -9.0>
    right x*image_width/image_height
    look_at <2.0, 3.0, 4.0>
}

light_source { 0, color rgb <1,0.1,0.1>
 looks_like {
  sphere {0,3 pigment {rgb <1,0.1,0.1>}
  finish {emission <1,0.1,0.1>}
  }
 }
 area_light 1*x,1*y,8,8 area_illumination on
 translate <-6,-1,-9>
}

light_source { 0, color rgb 1
 looks_like {
  sphere {0,1 pigment {rgb 1}
  finish {emission 1}
  }
 }
 area_light 1*x,1*y,8,8 area_illumination on
 translate <6,3,9>
}

sky_sphere { pigment { gradient <0,1,0>
                       color_map { [0.0 rgb <0.3,0.2,0.1>]
                                   [0.2 rgb <0.1,0.1,0.1>]
                                   [0.5 rgb <0.0,0.0,0.0>]
                                   [1.0 rgb <0.2,0.3,0.5>]
                                 }
                       scale 2
                     }
           }

// checkered floor
plane{ <0,1,0>, 0
       texture{
        pigment{
        checker color rgb <0.5,0.5,0.5> color rgb <0.1,0.1,0.1>
        scale 5
        }
        finish { phong 0.1}
       }
       translate -9*y
     }

// random sticks
    #for (R,1,333)
    #local S=seed(R*9);
    #local Rx=rand(S)*9;
cylinder {
 -x,x,1
    scale <3*Rx,0.1,0.1>
 texture {
  pigment {rgb 0}
  finish {specular 1 roughness 0.05}
 }
    rotate <0,90,180>*Rx
 translate <3*Rx,2*Rx,1*Rx>
    rotate <360,360,360>*Rx
    //scale 0.5
    translate <-3,1,13>
}
    #end

#declare SphericalScratches=
material {
    texture {
     pigment {rgb <0.1,0.1,0.1>}
   normal {
    average
    normal_map {
 #for (R,3,33)
 #local S=seed(R);
 #local Rx=rand(S);
 #local Ry=rand(S);
 #local Rz=rand(S);
  [0.5+Ry/2
   crackle solid bump_size 3*Ry
   warp {turbulence 0.2*Rz}
   scale <0.9+9*Rx,0.2+0.3*Ry,0.5+1*Rz>
   rotate <9*Rx,360*Ry,9*Rz>
   ]
 #end
  [0.5 granite 1.00 scale 0.01]
    }
   scale 1/10 // adjust for object size
     warp {spherical}
   }
  finish {
   specular albedo 0.3
   diffuse albedo 0.5
   roughness 0.001
   reflection {0.05,0.5}
  }
    }
}

#declare CylindricalScratches=
material {
    texture {
     pigment {rgb <0.1,0.1,0.1>}
   normal {
    average
    normal_map {
 #for (R,3,33)
 #local S=seed(R);
 #local Rx=rand(S);
 #local Ry=rand(S);
 #local Rz=rand(S);
  [0.5+Ry/2
   crackle solid bump_size 3*Ry
   warp {turbulence 0.2*Rz}
   scale <0.9+9*Rx,0.2+0.3*Ry,0.5+1*Rz>
   rotate <9*Rx,360*Ry,9*Rz>
   ]
 #end
  [0.5 granite 1.00 scale 0.01]
    }
   scale 1/10 // adjust for object size
     warp {spherical}
   }
  finish {
   specular albedo 0.3
   diffuse albedo 0.5
   roughness 0.001
   reflection {0.05,0.5}
  }
    }
}

// reflective sphere with scratches/bumps?
sphere { <0,0,0>, 1.0 scale <1,1,1>
material {
 SphericalScratches
} // material
 scale 3 rotate <0,0,0> translate <-3,1.5,3>
}

// reflective cylinder with curved scratches/bumps?
cylinder { <0,0,0>, <0,1,0>, 1.0 scale <1,1,1>
material {
 CylindricalScratches
} // material
rotate 90*x
 scale 4 rotate <15,-15,0> translate <-6,-4,4>
}
// END SCENE


Post a reply to this message

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