POV-Ray : Newsgroups : povray.general : finite texture : Re: finite texture Server Time
1 Aug 2024 22:22:59 EDT (-0400)
  Re: finite texture  
From: bmc
Date: 12 Apr 2005 12:50:00
Message: <web.425bfb64e46da0b4fd28b6860@news.povray.org>
"Steely" <nomail@nomail> wrote:
> In our german POV forum a guy came up with this question and no one of us
> was able  to solve it. So I decided to forward it.
> // -----------------
>
> The task is to make a big stone wall made by boxes, half a unit high and a
> unit wide. The single stones shall have a marble texture that way, that
> every stone is slight different from the others. But instead of building
> the wall out of 500 single stones, he wants *one* box with a brick pattern
> *and* every brick shall have a different look.
> // -----------------
>
> Any Ideas ?
>
> TIA
>
> Steely


i had a similar problem a few weeks ago. this is what i came up with:

#declare brick_length = 2;
#declare brick_d = .1;  // thickness of the motar
// position "inside" the stone
#declare fn_brick_u = function(u,v) { u - floor(v)*brick_length/2 - floor((u
- floor(v)*brick_length/2)/brick_length)*brick_length }
#declare fn_brick_v = function(u,v) { v - floor(v) }
// middle point of the stone
#declare fn_brick_n_u = function(u,v) { floor((u -
floor(v)*brick_length/2)/brick_length)*brick_length }
#declare fn_brick_n_v = function(u,v) { floor(v) }
// mask for motar
#declare fn_mortar = function(u,v) {
  max (
    select(u-brick_d,1,select(brick_length-brick_d-u,1,0)),
    select(v-brick_d,1,select(1-brick_d-v,1,0))
  )
}

....together with a pattern for the stones...

#declare fn_pig = function {
  pattern {
    marble
    warp { turbulence 1 }
  }
}

.... gives a nice stone wall pigment:

pigment {
  function { fn_mortar(fn_brick_u(x,y),fn_brick_v(x,y)) }
  pigment_map {
    [ 0.0 //the stones
      function { fn_pig(
                   fn_brick_u(x,y)+fn_brick_n_u(x,y)*100,
                   fn_brick_v(x,y)+fn_brick_n_v(x,y)*100,z) }
      color_map {
        [0.0 color rgb 0.0 ]
        [1.0 color rgb 1.0 ]
      }
    ]
    [ 1.0 // the mortar
      color Red
    ]
  }
  scale .5
}

hope that helps!

thilo mack


Post a reply to this message

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