|
|
I've reassembled my sampled bricks into a couple of macros, in case anyone
wanted to play with it more easily.
See thread
http://news.povray.org/povray.binaries.images/thread/%3Cweb.5ad633941828641ca47873e10%40news.povray.org%3E/
for images and background...
// - - - - - - - - - - - - - - - - - - - - - - - - - - -
// bricks with brightness sampled from specified pigment
//
// pattern only with no mortar
// call this macro instead of a pattern type in a pigment
// block - this allows a color_map to be specified
//
#macro BrickSampledPattern(Bricksize, SamplePig)
#local BSX = Bricksize.x;
#local BSY = Bricksize.y;
#local BSZ = Bricksize.z;
#local SamplePigFn = function { pigment { SamplePig } }
#local PigFnOffset = function {
SamplePigFn(x - 0.5*BSX*floor(y/BSY), y, z - 0.5*BSZ*floor(y/BSY)).x
}
pigment_pattern {
function {
PigFnOffset(
BSX*floor((x+0.5*BSX*floor(y/BSY))/BSX) + 0.5*BSX,
BSY*floor(y/BSY) + 0.5*BSY,
BSZ*floor((z+0.5*BSZ*floor(y/BSY))/BSZ) + 0.5*BSZ
)
}
translate z*0.5*BSZ
}
#end
// - - - - - - - - - - - - - - - - - - - - - - - - - - -
// bricks with brightness sampled from specified pigment
//
// complete pigment with mortar and color_map
// call this macro in place of a pigment block
//
#macro BrickSampled(Bricksize, Mortarsize, Colormap, MortarPig, SamplePig)
#local Bricks = pigment {
BrickSampledPattern(Bricksize, SamplePig)
color_map { Colormap }
}
pigment {
brick
pigment { MortarPig }
pigment { Bricks }
brick_size Bricksize
mortar Mortarsize
}
#end
// a couple of usage examples
// actual pigments and color_maps left as an exercise for the reader!
#declare LCol = <1, 0.5, 0.5>;
#declare DCol = <0.2, 0.2, 0.5>;
box {
<-6, 0, -2.9>, <6, 10, 2.9>
pigment {
BrickSampledPattern(<0.5,0.25,0.5>, MyWallPigment)
color_map {
[0 rgb 0.1*DCol]
[0.5 rgb DCol]
[0.5001 rgb 0.1*LCol]
[1 rgb LCol]
}
}
finish { ambient 0 }
}
box {
<-6, 0, -2.9>, <6, 10, 2.9>
BrickSampled(<0.5,0.25,0.5>, 0.035, MyColorMap, MyMortarPigment, MyWallPigment)
finish { ambient 0 }
}
Post a reply to this message
|
|