|
|
*This* code is what took so long to come up with: re-inventing the brick pattern
from scratch.
After a LOT of trial and error, I finally came up with something that uses
gradient patterns instead (x,y and z), embedding a 'cells' pattern into this,
then using some warp{repeat...} statements. It was an interesting experiment, if
nothing more.
There's a subtle quirk in this code that I haven't figured out yet, having to do
with the 'mortar' thickness (only when the brick y-dimension exceeds the
x-dimension.) Basically, there's a dynamically-changing 'limit' involved as to
the mortar thickness, based on the brick x/y ratio. Otherwise, it works OK.
Also, the mortar pattern is 'discontinuous' -- it is 'offset' in odd ways
because of the warp repeats . But it nevertheless remains scaled correctly in
all axes.
-----------
#declare BRICK_RATIO = <8,3,4.5>; // z doesn't really matter,
// it's ignored in MY code(?) . X and y are really just a RATIO,
// not a size scaler. I.e., <1,1,4.5> is the same as <37,37,4.5>
#declare MORTAR_PATTERN = pigment{bumps color_map{[0 rgb 0][1 rgb .8]}}
#declare MORTAR_PATTERN_SCALE = .05; // the bump pattern here
#declare MORTAR_THICKNESS = .124;
#declare PIG_X =
pigment{
gradient x
pigment_map{
[0
cells
color_map{
[0 rgb .1*<1,.28,.24>]
[1 rgb .7*<1,.28,.24>]
}
]
[1 - (BRICK_RATIO.y/BRICK_RATIO.x)*MORTAR_THICKNESS
cells
color_map{
[0 rgb .1*<1,.28,.24>]
[1 rgb .7*<1,.28,.24>]
}
]
[1 - (BRICK_RATIO.y/BRICK_RATIO.x)*MORTAR_THICKNESS
// VERTICAL mortar line, only to the RIGHT of brick...
MORTAR_PATTERN scale MORTAR_PATTERN_SCALE*
<BRICK_RATIO.y/BRICK_RATIO.x,1,BRICK_RATIO.y/BRICK_RATIO.x>
]
}
}
#declare PIG_X_PLUS_Y =
pigment{
gradient y
pigment_map{
[1 - MORTAR_THICKNESS PIG_X]
// HORIZONTAL mortar line, only at the TOP of brick...
[1 - MORTAR_THICKNESS
MORTAR_PATTERN scale MORTAR_PATTERN_SCALE*
<BRICK_RATIO.y/BRICK_RATIO.x,1,BRICK_RATIO.y/BRICK_RATIO.x>
]
}
warp{repeat y offset <500.5,600,700>} // x needs the added .5
scale <BRICK_RATIO.x/BRICK_RATIO.y,1,1>
}
#declare PIG_FULL =
pigment{
gradient z
pigment_map{
[1 - (BRICK_RATIO.y/BRICK_RATIO.x)*MORTAR_THICKNESS PIG_X_PLUS_Y]
[1 - (BRICK_RATIO.y/BRICK_RATIO.x)*MORTAR_THICKNESS
MORTAR_PATTERN scale MORTAR_PATTERN_SCALE*
<1,1,BRICK_RATIO.y/BRICK_RATIO.x>
]
}
warp{repeat y offset <0,199,900.5>} // y needs to be an ODD integer,
// and z needs the added .5
translate .5*z // important for side walls
scale <1,1,BRICK_RATIO.x/BRICK_RATIO.y>
}
//---- end of the brick texture ----
//plane{z,0
// OR...
difference{
box{0,<10.60,10.34,9.54>}
box{-.5,<5.34,6.0,6.40>}
translate <.0001,.0001, .0001>
texture{
pigment{PIG_FULL scale .40} // FINAL brick scale
finish{ambient .1 diffuse .9}
}
translate -5
rotate -40*y
rotate 15*x
translate 20*z
}
Post a reply to this message
Attachments:
Download 'multicolored_bricks_remade.jpg' (989 KB)
Preview of image 'multicolored_bricks_remade.jpg'
|
|