|
|
// ========================
// Variable scale patterns.
// by Mike Andrews
// 20th September 2000
// ========================
#version unofficial Megapov 0.5;
global_settings{
assumed_gamma 1
}
// These are the functions to give local x, y and z values ...
#declare pig_crack = pigment { crackle form <1,0,0> }
#declare pig_crackn = pigment { crackle }
#declare fn_crack = function { pigment { pig_crack } }
#declare fn_crackn = function { pigment { pig_crackn } }
#declare fn_x = function {
fn_crack*(fn_crack(x+0.0005,y,z)-fn_crack(x-0.0005,y,z))*1000
}
#declare fn_y = function {
fn_crack*(fn_crack(x,y+0.0005,z)-fn_crack(x,y-0.0005,z))*1000
}
#declare fn_z = function {
fn_crack*(fn_crack(x,y,z+0.0005)-fn_crack(x,y,z-0.0005))*1000
}
// Find the 'centre' point of the current crackle cell ...
#declare fn_cx = function { x-fn_x }
#declare fn_cy = function { y-fn_y }
#declare fn_cz = function { z-fn_z }
// ... and the value at that point
#declare fn_cc = function { fn_crackn(fn_cx,fn_cy,fn_cz) }
// Pwr controls amount of 'push':
// +ve to go away from centres
// -ve to go towards centres
#declare Pwr = 2;
// Find the new points for the pigment function
#declare fn_rm = function { (1-(1-fn_crack)*(fn_crackn/fn_cc))^Pwr }
#declare fn_xp = function { fn_cx+fn_rm*fn_x }
#declare fn_yp = function { fn_cy+fn_rm*fn_y }
#declare fn_zp = function { fn_cz+fn_rm*fn_z }
// Define various test pigment functions.
//#declare pig_test = pigment { crackle form x scale 0.2 frequency -2 }
#declare pig_test = pigment { crackle scale 0.2 }
#declare fn_test = function { pigment { pig_test } }
// #declare fn_test = function { pigment { granite scale 0.1 } }
// #declare fn_test = function { abs(sin(x*pi*5)*sin(y*pi*5)) }
// Produce the 'warped' pigment
#declare MyPigment = pigment {
function { fn_test(fn_xp, fn_yp, fn_zp) }
pigment_map {
[0.0 colour rgb 0]
[0.1
pig_crackn
colour_map {
[0 rgb <.5,.5,.3>]
[1 rgb <.5,1,.5>]
}
]
[1.0
pig_crackn
colour_map {
[0 rgb <.3,.3,.5>]
[1 rgb <1,.5,.5>]
}
]
}
}
// And the test scene.
camera {
location <0.0, 0.5, -4.0>
direction 1.5*z
right x*image_width/image_height
look_at <0.0, 0.0, 0.0>
}
light_source {
0*x
color rgb 1.0
translate <-30, 30, -30>
}
sphere {
0.0, 1
texture {
pigment{MyPigment}
finish{specular 0.5 roughness 0.001}
}
}
plane {
z, 0
texture {
pigment{MyPigment}
finish{specular 0.5 roughness 0.001}
}
}
// Bye for now ...
Post a reply to this message
|
|