// Demonstrate long standing isosurface issue when container intersection // at local min or max for the function. We both can get artefact shapes // and bogus gradient message values from whatever is going on. // // Note. The artefact shapes can occur nowhere near the actual shape // though of course only inside the container. When they appear they // often end up where x, y or z values for the container is near zero. // #version 3.8; global_settings { assumed_gamma 1 } default { finish { ambient 0.01 } } #declare GreyNurse = srgb <0.90588,0.92549,0.90196>; background { color GreyNurse } #declare Camera00 = camera { perspective location <2.5,2.9,-2.501> sky y angle 35 right x*(image_width/image_height) look_at <0.25,0,-0.25> } #declare White = srgb <1,1,1>; #declare Light00 = light_source { <50,150,-250>, White } #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 Finish0 = finish { phong 0.7 } #declare Black = rgb <0,0,0>; #declare VarDepthScale = 0.07; #declare VarFunctionScale = 1/1; #declare VarCalkSize = 0.10; #declare Amazon = srgb <0.23137,0.47843,0.34118>; #declare Amazonite = srgb <0,0.76863,0.6902>; #declare AmericanBronze = srgb <0.22353,0.09412,0.00784>; #declare AmberSAE = srgb <1,0.49412,0>; #declare GrassHopper = srgb <0.48627,0.46275,0.19216>; #declare GreenBlue0 = srgb <0,0.80392,0.03922>; #declare ColorMap3 = color_map { [ 0/3 Amazon ] [ (1-VarCalkSize)/3 Amazonite ] [ (1-VarCalkSize)/3 Black ] [ 1/3 Black ] [ 1/3 AmericanBronze ] [ (2-VarCalkSize)/3 AmberSAE ] [ (2-VarCalkSize)/3 Black ] [ 2/3 Black ] [ 2/3 GrassHopper ] [ (3-VarCalkSize)/3 GreenBlue0 ] [ (3-VarCalkSize)/3 Black ] [ 3/3 Black ] } #declare VarTiling11_NrmScale = <1/3,1,1/3>; #declare FnY = function (x,y,z) { y-(0.01/2.0) } #declare FnY_inv = function (x,y,z) { -(y)-(0.01/2.0) } #declare FnYY = function (x,y,z) { max(FnY(x,y,z),FnY_inv(x,y,z)) } #macro Pattern_Tiling11_3() tiling 11 frequency 1 scale VarTiling11_NrmScale #end #declare Fn00a_Tiling11_3 = function { pattern { Pattern_Tiling11_3() } } #declare Fn00b_Tiling11_3 = function { pattern { Pattern_Tiling11_3() } } #declare Fn00c_Tiling11_3 = function (x,y,z) { Fn00b_Tiling11_3(x*VarFunctionScale, y*VarFunctionScale,z*VarFunctionScale) } #declare Fn00d_Tiling11_3 = function (x,y,z) { mod(Fn00a_Tiling11_3(x*VarFunctionScale,y*VarFunctionScale, z*VarFunctionScale),1.0/3)*(VarDepthScale*3) } #declare Fn00e_Tiling11_3 = function (x,y,z) { FnYY(x,y+Fn00d_Tiling11_3(x,y,z),z) } #declare Fn00f_Tiling11_3 = function { pattern { function { max(0,-Fn00e_Tiling11_3(x,y,z)) } } } #declare Fn00_Tiling11_3 = function (x,y,z) { 0.001-Fn00f_Tiling11_3(x,y,z) } #declare Iso00_Tiling11_3 = isosurface { function { Fn00_Tiling11_3(x,y,z) } contained_by { box { <-1.01,-0.2,-1.00>,<1.00,0.2,1.00> } } // Bug // contained_by { box { <-1.01,-0.2,-1.01>,<1.01,0.2,1.01> } } // OK threshold 0 accuracy 0.0005 max_gradient 1.1 max_trace 1 } #declare Pigm00_Tiling11_3 = pigment { function { Fn00c_Tiling11_3(x,y,z) } color_map { ColorMap3 } } #declare Txtr00_Tiling11_3 = texture { pigment { Pigm00_Tiling11_3 } finish { Finish0 } } #declare Obj00o_Tiling11_3 = object { Iso00_Tiling11_3 texture { Txtr00_Tiling11_3 } } //--- scene --- camera { Camera00 } light_source { Light00 } // object { CylinderX } // object { CylinderY } // object { CylinderZ } object { Obj00o_Tiling11_3 }