// Demonstrate new pattern_modifiers {} capability to get // x,y,z values after all pigment / pattern modifiers are // applied. Used with sphere placements and an isosurface. See ***. #version 3.8; global_settings { assumed_gamma 1 } default { finish { ambient 0.03 } } #declare GreyNurse = srgb <0.90588,0.92549,0.90196>; background { color GreyNurse } #declare Camera00 = camera { perspective location <2.6,3.6,-2.601> sky y angle 20 right x*(image_width/image_height) look_at <0,0,0> } #declare VarOrthoMult = 2.5/max(image_width/image_height,image_height/image_width); #declare Camera01x = camera { orthographic location <2,0,0> direction -x right VarOrthoMult*z*max(1,image_width/image_height) up VarOrthoMult*y*max(1,image_height/image_width) } #declare White = srgb <1,1,1>; #declare Light00 = light_source { <50,150,-250>, White*1.5 } #declare Red = srgb <1,0,0>; #declare CylinderX = cylinder { <-1,0,0>, <1,0,0>, 0.01 pigment { Red } } #declare Green = srgb <0,1,0>; #declare CylinderY = cylinder { <0,-1,0>, <0,1,0>, 0.01 pigment { Green } } #declare Blue = srgb <0,0,1>; #declare CylinderZ = cylinder { <0,0,-1>, <0,0,1>, 0.01 pigment { Blue } } #include "functions.inc" #declare Cyan = rgb <0,1,1>; #declare Yellow = rgb <1,1,0>; #declare VarStraightenFactor = 50.0; #declare PigmentA = pigment { Red } #declare PigmentB = pigment { Green } #declare PigmentC = pigment { Blue } #declare PigmentD = pigment { Yellow } #declare PigmentE = pigment { Cyan } #declare PigmentMap00 = pigment_map { [ 0 PigmentA ] [ 0.25 PigmentA ] [ 0.25 PigmentB ] [ 0.5 PigmentB ] [ 0.5 PigmentC ] [ 0.75 PigmentC ] [ 0.75 PigmentD ] [ 1 PigmentD ] [ 1 PigmentE ] } // *** All modifiers below used manipulate the pigment applied // to both the isosurface and placed spheres - which are themselves // perturbed by the same modifiers. Pigment and shape align. Shapes // can too if pre-modifier coordinates are set up the same - if // the spheres had been placed on the isosurface surface they would // be on the post-perturbed isosurface surface too. #macro Pattern00() gradient y // *** Matters only to pigment_map turbulence <0.15,0.15,0.15> octaves 2 omega 0.47 lambda 2 rotate x*33 #end #declare Pigment00 = pigment { Pattern00() pigment_map { PigmentMap00 } } #declare FnHelix1_5a = function (x,y,z) { f_helix1(x,y,z,8,1/VarStraightenFactor, 0.02,0.20-(0.04*div(abs(y),0.25)), VarStraightenFactor/0.04,1,0) } #declare FnHelix1_5b = function (x,y,z) { f_helix1(x,y,z,8,1/VarStraightenFactor, 0.02,0.21-(0.04*div(abs(y),0.25)), VarStraightenFactor/0.04,1,0) } #declare FnHelix1_5c = function (x,y,z) { max(FnHelix1_5a(x,y,z),-FnHelix1_5b(x,y,z)) } #declare FnHelix1_5p = function { pattern_modifiers { Pigment00 } // *** } #declare FnHelix1_5 = function (x,y,z) { FnHelix1_5c(FnHelix1_5p(x,y,z).x, // *** FnHelix1_5p(x,y,z).y, // *** FnHelix1_5p(x,y,z).z) // *** } #declare IsoHelix1_5 = isosurface { // function { FnHelix1_5c(x,y,z) } function { FnHelix1_5(x,y,z) } contained_by { box { <-1,-1,-1>,<1,1,1> } } threshold 0 accuracy 0.0005 max_gradient 6.1 max_trace 4 } #declare Texture00 = texture { pigment { Pigment00 } } #declare Object00 = object { IsoHelix1_5 texture { Texture00 } } #declare Union00 = union { #for (i,0,49,1) #local thisY = -1+(i*(2/50)); //sphere { <-0.3,thisY,-0.3>,0.02 } sphere { // *** Calc each x,y,z pattern delta and add. <(-0.3-FnHelix1_5p(-0.3,thisY,-0.3).x)+(-0.3), // *** (thisY-FnHelix1_5p(-0.3,thisY,-0.3).y)+(thisY), // *** (-0.3-FnHelix1_5p(-0.3,thisY,-0.3).z)+(-0.3)>, // *** 0.02 } #end texture { Texture00 } } //--- scene --- camera { Camera00 } // camera { Camera01x } light_source { Light00 } object { CylinderX } object { CylinderY } object { CylinderZ } object { Object00 } object { Union00 }