POV-Ray : Newsgroups : povray.text.scene-files : Re: Brick wall and paving stones macros (~80kb) : Re: commentary on my macro (was Re: Brick wall and paving stones macros) Server Time
28 Jul 2024 16:30:31 EDT (-0400)
  Re: commentary on my macro (was Re: Brick wall and paving stones macros)  
From: Sander
Date: 25 Jan 2000 15:31:28
Message: <388e0820@news.povray.org>
Thanks, Ron, that helps me a lot to understand those complicated things.
What a wonderful program POV-Ray is! (you knew that already ...)

--
Regards,
Sander


Ron Parker <ron### [at] povrayorg> schreef in berichtnieuws
slr### [at] parkerrfwicom...
> Here's an explanation of my irregular bricks macro, so everyone
> can have a chance to understand some of the magic that's at work
> deep within it.
>
> On 19 Jan 2000 10:15:35 -0500, Ron Parker wrote:
> >#macro Irregular_Bricks( Brick, Mortar, MortarThick, Vary )
>
> You probably already guessed this one, but I'll spell it out
> just in case:
>
> * Brick is a pigment that will be used to color the bricks.
>
> * Mortar is a pigment that will be used to color the mortar.
>
> * MortarThick is a number between 0 and 1, and it represents
>   the ratio of mortar to bricks.
>
> * Vary is a nonnegative number that represents the maximum
>   deviation in the length of a brick from its nominal length
>   of 1 unit.  If you specify .3, for example, the resulting
>   bricks will range in length from .7 units to 1.3 units.
>
> The final pattern has rows of width 1 unit and bricks of average
> length 1 unit.  The regular rows are perpendicular to the Z axis.
> The texture is designed to be applied to a planar surface parallel
> to the XZ plane.  You may scale and rotate appropriately.
>
> >  gradient z
> >  pigment_map {
>
> This is the gradient that establishes the regular rows of
> irregular bricks.  Each interval of this gradient is a row
> of bricks.
>
> >    [MortarThick Mortar]
>
> The first part of a row of bricks is the mortar between rows.
> That's what this piece of the map defines.
>
> >    [MortarThick gradient x
>
> This piece of the map defines a row of bricks.  Gradient x is
> the basic pigment, but the stuff below mixes it up a bit.
>
> >      pigment_map {[MortarThick Mortar][MortarThick Brick]}
>
> Each interval of this gradient consists of a bit of mortar and
> a bit of brick.
>
> >      translate 1000*x
>
> This gets us away from the origin, where the mortar would be
> double-thickness due to the symmetry there.  We could probably
> also use a warp {repeat x} here to achieve the same effect
> without prematurely sending our bozo textures to bad-noise-land.
>
> >      warp {turbulence Vary octaves 1}
>
> Octaves 1 means "make only one step in a random direction of a
> distance somewhere between zero and Vary."  By itself, this would
> tend to mix up the gradient a bit so it became wavy but not like
> you normally expect from turbulence.  In this macro, it has the
> effect of moving the sample point a random distance in a random
> direction, which is the primary factor in how random the bricks
> are.  This turbulence is also what's ultimately responsible for
> the sections of wide and narrow mortar that appear some places,
> but I don't know how to fix that.
>
> >      warp {planar z 0}
>
> This forces the pigment to be an extrusion of what it looks like in
> the x-y plane, something like a planar image map.  In this macro, it
> fixes the mortar lines so they're once again perfectly straight,
> while leaving any turbulence-induced changes in the X and Y
> directions intact.  Remove it, and the mortar lines will be somewhat
> wavy.  a better way to achieve that, though, would be to apply light
> turbulence to the texture as a whole once it's constructed.
>
> >      warp {reset_children}
>
> This "turns off" the turbulence and the planar warp for the child
> textures, which are the pigments you specified for the bricks and
> the mortar.  This ensures that the pigment on each brick looks like
> you expected it to.
>
> >    ]
> >  }
> >  warp {repeat z offset 97.5*x}
>
> This last warp has two effects.  First, the repeat z fixes the
> symmetry problem of the gradient pigment in the z direction.
> Second, the offset 97.5*x causes POV to sample a different part
> of the x-y plane for each row of bricks.  If you look at a large
> area of these bricks, you'll see that the brick pattern repeats
> exactly 97.5 units away on adjacent rows.  The .5 makes it so
> that usually, bricks on adjacent rows don't begin and end at the
> same spot.  You could offset in y too, which would sample a
> different pattern of bricks entirely and remove the repetition.
> I didn't think of this when I originally wrote it.
>
> >#end
>
> --
> These are my opinions.  I do NOT speak for the POV-Team.
> The superpatch: http://www2.fwi.com/~parkerr/superpatch/
> My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

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