POV-Ray : Newsgroups : povray.binaries.images : Simple Patina Macro (7kb jpg) : Simple Patina Macro (7kb jpg) Server Time
12 Aug 2024 01:31:04 EDT (-0400)
  Simple Patina Macro (7kb jpg)  
From: Rune
Date: 28 Nov 2003 08:28:36
Message: <3fc74d84@news.povray.org>
In the thread "Subsurface Scattering: macro now available (21kb jpeg)"
Gilles Tran wrote this:

> Also: could a trick like this be used to create patina effects?

I don't know that much about how patina should look, but I've got the
impression that it's not dependent on light source location, like
subsurface scattering is? If it's more a matter of curvature of the
surface and nearby surfaces, then this macro might be sufficient:


#macro patina_pattern(Obj,Blur,Samples,Stream)
   // by Rune S. Johansen 2003
   #local FN =
   function {
      pigment {
         average
         pigment_map {
            #local C = 0;
            #while (C<Samples)
               [1
                  object{Obj rgb 0, rgb 1}
                  translate <
                     rand(Stream)-rand(Stream),
                     rand(Stream)-rand(Stream),
                     rand(Stream)-rand(Stream)
                  >*Blur
               ]
               #local C = C+1;
            #end
         }
      }
   }
   function {FN(x,y,z).red}
#end


Here's a simple sample scene which produces the attached image:


#declare Object =
union {
   plane {y,0}
   box {-1,1 scale <3.2,1.0,0.7> translate y}
   box {-1,1 scale <1.0,1.0,3.0> translate y}
   box {-1,1 scale <1.0,2.0,1.0> translate 2*y}
   box {-1,1 scale <0.5,0.7,3.5> translate 0.7*y}
   sphere {4*y, 1}
   torus {2.4, 0.5 translate y}
   scale 2
}
object {
   Object
   pigment {
      patina_pattern(Object, 2, 256, seed(0) )
      color_map {
         [0.1, rgb 1][0.9, rgb 0]
      }
   }
}
light_source {< 2, 3,-1>*100, color rgb <1.2,1.2,0.9> shadowless}
light_source {<-2, 3,-2>*100, color rgb <0.5,0.5,0.8> shadowless}
camera {location <9,12,-13> look_at 3*y}


Let me know if this is any useful...

Rune
--
3D images and anims, include files, tutorials and more:
rune|vision:  http://runevision.com **updated Sep 28**
POV-Ray Ring: http://webring.povray.co.uk


Post a reply to this message


Attachments:
Download 'patina.jpg' (7 KB)

Preview of image 'patina.jpg'
patina.jpg


 

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