POV-Ray : Newsgroups : povray.binaries.images : metal thing (80 k) ... and macros : Re: metal thing (80 k) ... and macros Server Time
4 Nov 2024 17:55:19 EST (-0500)
  Re: metal thing (80 k) ... and macros  
From: helge h
Date: 28 Feb 2006 08:35:00
Message: <web.4404509e56098cd61c6902970@news.povray.org>
"Hasan3" <PRO### [at] Yahoocom> wrote:
> "helge_h" <nomail@nomail> wrote:
> > I have no idea what this is, it just evolved, perhaps inspired by mops'
> > corals (
> >
http://news.povray.org/povray.binaries.images/thread/%3C43f75349%40news.povray.org%3E/
> > ). Maybe it also is a reflective sphere on a checkered surface. :-)
> >
> > I used it to test a couple of texture (finish) macros:
> >
> > // ordinary finish:
> >
> > #macro _shinyness ( _g1 )
> > finish {
> >  ambient 0
> >  diffuse min (1, (1.65 - _g1))
> >  specular _g1
> >  roughness 1 / pow (500, _g1)
> >  reflection { 0.5 * max ( 0, _g1 - 0.65 ), 2 * max ( 0, _g1 - 0.65 ) }
> > }
> > #end
> >
> > // metal finish:
> >
> > #macro _metal ( _g1 )
> > finish {
> >  ambient 0
> >  diffuse 1 - _g1
> >  specular _g1 * 2
> >  roughness 1 / pow (250, _g1)
> >  metallic
> >  reflection { _g1 / 2, _g1 metallic }
> > }
> > #end
> >
> > I think they work well, but I would be interested in comments. The parameter
> > value should be 0.0 to 1.0, higher values makes the object more shiny. I
> > have used several sources for the algorithms: mainly the good old
> > StrataVision 4.0 and 3d World magazine.
> >
> > H
>
> Great!.. Can you share metal texture?
>
> Regards.
> Hasan

Here you go (for the main object):

#local Brass_color = color rgb <0.7, 0.612, 0.35>;

#local Bump0 = normal {
 granite
 scale 5
 bump_size -0.3
    slope_map {
      [ 0 <0, 1> ]
      [ 0.3 <1, 0> ]
      [ 1 <1, 0> ]
    }
}
#local Bump1 = normal { bumps scale 0.25 bump_size 0.3 }
#local Bump2 = normal { bumps scale 5 bump_size 0.3 }

#local CastMetal_normal = normal {
 average normal_map {
  [ 1 Bump0 ]
  [ 1 Bump1 ]
  [ 1 Bump2 ]
 }
}

#local CastMetal_texture = texture {
 pigment { Brass_color }
 normal { CastMetal_normal }
 _metal (0.4) // the macro from original post
}

H


Post a reply to this message

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