POV-Ray : Newsgroups : povray.binaries.images : glossy metallic reflection : glossy metallic reflection Server Time
6 Aug 2024 16:55:57 EDT (-0400)
  glossy metallic reflection  
From: nemesis
Date: 6 Nov 2006 11:50:01
Message: <web.454f674dce679533976a8750@news.povray.org>
hi, guys.  I hope to contribute a bit more to the discussion of getting good
glossy reflective metal textures in povray.

I've made several tests, starting from a basic shiny metal texture and also
using Warp's FAQ method and Jaime Vives Piqueres' micronormals and finally
a little discovery i made by simply changing the used normal pattern:  wood
rather than the usual bumps, crackle, facets or granite one would usually
think about.  This came from the observation that "brushed" metal bears
several scratches throughout its surface.  I tried to emulate that with a


My solution is slightly faster than Jaime's because of less normal_map
entries, i guess.

Here are the textures, from fastest to slowest to render:

#declare f_reflective_metal = finish {
 ambient .2 diffuse .2
 specular 1.5 roughness .02 brilliance 2
 reflection { .6 metallic 1 } metallic
}
#declare f_metal_shiny = f_reflective_metal

// basic shiny metal
#declare t_shiny_metal =
texture {
 pigment { rgb .8 }
 finish { f_metal_shiny }
}

/* straight from warp's method from the povray FAQ */
#local BlurAmount = .2; // Amount of blurring
#local BlurSamples = 10*4; // How many rays to shoot

#declare t_metal_glossy_warp =
  texture
  { average texture_map
    { #local Ind = 0;
      #local S = seed(0);
      #while(Ind < BlurSamples)
        [1 // The pigment of the object:
           pigment { rgb .7 }
           // The surface finish:
           finish { f_metal_shiny }
           // This is the actual trick:
           normal
           { bumps BlurAmount
             translate <rand(S),rand(S),rand(S)>*10 //200
             scale 1000
           }
        ]
        #declare Ind = Ind+1;
      #end
    }
  }

#declare t_metal_glossy_warp_lesser =
  texture
  { average texture_map
    { #local Ind = 0;
      #local S = seed(0);
      #while(Ind < BlurSamples)
        [1 // The pigment of the object:
           pigment { rgb .7 }
           // The surface finish:
           finish { f_metal_shiny }
           // This is the actual trick:
           normal
           { bumps BlurAmount
             translate <rand(S),rand(S),rand(S)>*10/200
             scale 1000
           }
        ]
        #declare Ind = Ind+1;
      #end
    }
  }

// *************************
// *** Jaime Vives Piqueres' micronormals ***
// *************************
// + microsurface normal
#local p_jvp_micro2=
pigment{
 crackle turbulence 1
 color_map{
  [0.00 rgb .7]
  [0.01 rgb .7]
  [0.02 rgb 1]
  [1.00 rgb 1]
 }
 scale 5
}
#local p_jvp_micro1=
pigment{
 cells
 turbulence .5
 color_map{
  [0.0 rgb .9]
  [1.0 rgb 1]
 }
 scale .01
}
// + average all the normals
#local p_jvp_brushed_new=
pigment{
 average turbulence 0
 pigment_map{
  [0.0 p_jvp_micro1]
  [0.1 p_jvp_micro1 rotate 45*x]
  [0.2 p_jvp_micro1 rotate -45*x]
  [0.3 p_jvp_micro2]
  [0.4 p_jvp_micro1 rotate 45*y]
  [0.5 p_jvp_micro1 rotate -45*y]
  [0.6 p_jvp_micro1 rotate 90*z]
  [0.7 p_jvp_micro2 rotate 45]
  [0.8 p_jvp_micro1 rotate 45*z]
  [0.9 p_jvp_micro1 rotate 90*y]
  [1.0 p_jvp_micro1 rotate -45*z]
 }
 scale .1
}

#declare n_jvp_micronormals = normal { pigment_pattern{p_jvp_brushed_new} .4
}
#declare t_jvp_micronormal_glossy_metal = texture {
 pigment { rgb .7 }
 normal { n_jvp_micronormals scale .5 }
 finish { f_reflective_metal }
}
#declare t_metal_glossy_jvp = t_jvp_micronormal_glossy_metal


/**
 * a mix of warp's method and Jaime Vives Piqueres micronormals.
 * But with a completely unrelated and surprising pattern...
**/
#macro m_metal_glossy( BlurAmount, BlurSamples )
texture { average
 texture_map {
  #local Ind = 0;
  #local S = seed(0);
  #while(Ind < BlurSamples)
   [1 // The pigment of the object:
      pigment { rgb .78 }
      // The surface finish:
      finish { f_reflective_metal }
      // This is the actual trick:
      normal { wood ramp_wave
    rotate rand(S)*30 turbulence .6
    bump_size -BlurAmount
        translate <rand(S),rand(S),rand(S)>*.02
        scale .002
        //scale 1000
      }
   ]
   #declare Ind = Ind+1;
  #end
 }
}
#end

#declare t_glossy_brushed_metal = m_metal_glossy( .2, 1*4 )
#declare t_metal_brushed_glossy = t_glossy_brushed_metal
#declare t_metal_glossy = t_glossy_brushed_metal
#declare t_metal_glossy_weak = m_metal_glossy( .1, 1*4 )


// test scene

camera { location -5*z look_at y+2*x rotate <20,0,0> angle 40 }

light_source { 4-8*z 1.3 }
light_source { 4-6*x 1.3 }

plane { y, 0 pigment { checker rgb 1 rgb 0 } finish { ambient .3 diffuse .4
} }

sphere { y-7*z, 1 rotate -y*40
 pigment { rgb y }
 finish { ambient 0 diffuse .6 phong .7 brilliance .5 }
}

#local n0 = normal { facets coords .04 bump_size .9 turbulence .0 scale
9*(z+x) scale .04 }

box { -.5,.5 rotate y*20 translate .5*y+1.3*x scale 2 rotate -y*20
        //texture { t_shiny_metal }
        //texture { t_metal_glossy_warp }
        //texture { t_metal_glossy_warp_lesser }
        //texture { t_metal_glossy }
        texture { t_metal_glossy_weak }
        //texture { t_metal_glossy_jvp scale .04 }
}


Shown are the test scenes renders.  Getting as reference the basic shiny
metal with no distortions, it can be seen that Warp's method (using huge
normals) distorts too much the reflected environment.  I made a few changes
to values in order to prevent too much of it.  OTOH, Warp's method is the
fastest and the only one that looks ok without antialiasing.  Jaime's in
particular, seem to need quite a lot.  I suggest +AM2 +A0.08 +J1.0 on the
command-line.  Mine and Jaime's get this.
Jaime's seem to need yet more AA or a smaller scale, i don't know... his
reference picture looks a lot better:
http://www.ignorancia.org/uploads/experiments/micronormals/micro.jpg

Although not seen here, spherical surfaces get somewhat weird at the
equatorial area near the borders of the shape with Warp's or Jaime's, but
do just fine with the wood pattern.


Post a reply to this message


Attachments:
Download 'basic_shiny.jpg' (60 KB)

Preview of image 'basic_shiny.jpg'
basic_shiny.jpg


 

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