POV-Ray : Newsgroups : povray.text.scene-files : Re: Brick wall and paving stones macros (~80kb) Server Time
1 Nov 2024 15:25:42 EDT (-0400)
  Re: Brick wall and paving stones macros (~80kb) (Message 1 to 8 of 8)  
From: Ron Parker
Subject: Re: Brick wall and paving stones macros (~80kb)
Date: 19 Jan 2000 10:15:35
Message: <slrn88bl9b.v8.ron.parker@ron.gwmicro.com>
On Tue, 18 Jan 2000 14:45:06 +0100, Sander wrote:
>Now re-reading my post it seems very unclear to me too!
>What I am after is a floor with long rows of stones having equal widths but
>lengths differing slightly and randomly. Like:
>-------------------------------------------------------
>   |        |          |      |           |       |
>-------------------------------------------------------
>      |      |        |          |            |       |
>-------------------------------------------------------
>This would result in rows of stones that are all different from each
>other....

Note: this requires the superpatch or megapov for the planar and
reset_children warps.  Followups set to povray.text.scene-files.  

---------- code begins here ------------
#macro Irregular_Bricks( Brick, Mortar, MortarThick, Vary )
  gradient z
  pigment_map {
    [MortarThick Mortar]
    [MortarThick gradient x
      pigment_map {[MortarThick Mortar][MortarThick Brick]}
      translate 1000*x
      warp {turbulence Vary octaves 1}
      warp {planar z 0}  
      warp {reset_children}
    ]
  }
  warp {repeat z offset 97.5*x}
#end
                                 
camera {location 5*y sky z look_at 0}
light_source {5*y rgb 1}

plane {y,0
  texture {
    pigment {
      Irregular_Bricks( 
        pigment {bozo color_map {[0 rgb .5][1 rgb .8]} scale <.1,.1,.2>},
        pigment {bozo color_map {[0 rgb .9][1 rgb 1]} scale <.05,.05,.1>},
        .1,
        .5
      )
      scale <1,1,.5>
    }
  }
}  
---------- code ends here ------------

-- 
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

From: Bill DeWitt
Subject: Re: Brick wall and paving stones macros (~80kb)
Date: 19 Jan 2000 11:01:40
Message: <3885dfe4@news.povray.org>
"Ron Parker" <ron### [at] povrayorg> wrote :
>
> ---------- code ends here ------------
>

    That's kinda cool. Lots of room to play with it too!


Post a reply to this message

From: Ron Parker
Subject: Re: Brick wall and paving stones macros (~80kb)
Date: 19 Jan 2000 11:12:39
Message: <slrn88bokf.v8.ron.parker@ron.gwmicro.com>
On Wed, 19 Jan 2000 11:01:34 -0500, Bill DeWitt wrote:
>
>"Ron Parker" <ron### [at] povrayorg> wrote :
>>
>> ---------- code ends here ------------
>>
>
>    That's kinda cool. Lots of room to play with it too!

It has some problems, as you'll see if you move the camera to 15*y and
render at a higher resolution.  The 97.5*x offset pushes the bozo pattern
I've put on the bricks into bad-noise-land by the third-to-last row. 
A workaround is to either use a different pattern, offset the bozo 
pattern in the negative x direction, or scale it bigger.  This is a bug
in POV, ultimately.

-- 
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

From: Sander
Subject: Re: Brick wall and paving stones macros (~80kb)
Date: 19 Jan 2000 14:57:23
Message: <38861723@news.povray.org>
Thanks Ron: I'll go and try it soon. What a kind bunch of people I've found
out here!

--
Regards,
Sander


Ron Parker <ron### [at] povrayorg> schreef in berichtnieuws
slr### [at] rongwmicrocom...
> On Tue, 18 Jan 2000 14:45:06 +0100, Sander wrote:
>
> Note: this requires the superpatch or megapov for the planar and
> reset_children warps.  Followups set to povray.text.scene-files.
>
> ---------- code begins here ------------
> #macro Irregular_Bricks( Brick, Mortar, MortarThick, Vary )
<snip>


Post a reply to this message

From: Sander
Subject: Re: Brick wall and paving stones macros (~80kb)
Date: 19 Jan 2000 15:27:20
Message: <38861e28@news.povray.org>
Got your macro in p.p.! Thanks.

--
Regards,
Sander


Ron Parker <ron### [at] povrayorg> schreef in berichtnieuws
slr### [at] rongwmicrocom...
> On Tue, 18 Jan 2000 14:45:06 +0100, Sander wrote:
>
> Note: this requires the superpatch or megapov for the planar and
> reset_children warps.  Followups set to povray.text.scene-files.
>
> ---------- code begins here ------------


Post a reply to this message

From: Sander
Subject: Re: Brick wall and paving stones macros (~80kb)
Date: 23 Jan 2000 11:37:20
Message: <388b2e40@news.povray.org>
Ron,

I tried your macro out in the scene that needed a good floor: it works fine.
The macro itself completely eludes me: I will have to study even more :)

Thanks,  regards,  Sander

Ron Parker <ron### [at] povrayorg> schreef in berichtnieuws
slr### [at] rongwmicrocom...
>
> Note: this requires the superpatch or megapov for the planar and
> reset_children warps.  Followups set to povray.text.scene-files.
>
> ---------- code begins here ------------
> #macro Irregular_Bricks( Brick, Mortar, MortarThick, Vary )


Post a reply to this message

From: Ron Parker
Subject: commentary on my macro (was Re: Brick wall and paving stones macros)
Date: 23 Jan 2000 12:49:39
Message: <slrn88mfl0.v8.ron.parker@parkerr.fwi.com>
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

From: Sander
Subject: Re: commentary on my macro (was Re: Brick wall and paving stones macros)
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.