Material Nodes - MacCurdyLab/OpenVCAD-Public GitHub Wiki
The f_grade
node performs a functional grading of the material of its children. The f_grade
node uses overlapping probability density function(PDF) to define the material composition of child geometry. The f_grade
node can be used to create complex pseudo alloys and digital materials.
The f_grade
node has two modes threshold
and probabilty
. When a specific voxel is evaluated in space and its material is defined using the f_grade
node, OpenVCAD will evaluate the PDFs to determine probability of each material being present at that location. In threshold
mode the material with the highest probability is assigned to the voxel. In probabilty
mode the PDFs are used as weighted inputs to a stochastic selection process.
f_grade
must only have one child.
f_grade(["<expression>", "<expression>", ...], ["<material_name>", "<material_name>", ...], "mode"){ <child node>; }
, where mode is either "thresh"
for threshold or "prob"
for probability.
fgrade(["0.2", "sin(4.5 * z + 1.57) - 0.1", "100 * (sin(atan(50 * sin(4.5 * z - 1.57) - 60)) + 1) - rho * sin(phic) + 0.1"], ["red", "blue", "green"], "thresh")
{
function("(0.5 * (rho * sin(phic) - 0.5)^4 + (rho * sin(phic + 0.5 * pi))^4 + 0.5 * (sin(atan(100 * sin(4.5 * z - 1.57) - 60)) + 1) * (sin(atan(20 * sin(phic))) + 1) - 1)", "red");
}
The convolve
node performs a 3D convolution of the materials of its children. The convolve
node uses a convolution kernel to define the material composition of child geometry. The convolve
node can be used to perform blurring, sharpening, and blending operations.
convolve
must only have one child.
convolve([[[X,X,X], [X,X,X], [X,X,X]],
[[X,X,X], [X,X,X], [X,X,X]],
[[X,X,X], [X,X,X], [X,X,X]]
]){ <child node>; }
Square brackets are used to define a 3D kernel grid
// A 10x10x1 kernel of all ones
convolve([[[1], [1], [1], [1], [1], [1], [1], [1], [1], [1]],
[[1], [1], [1], [1], [1], [1], [1], [1], [1], [1]],
[[1], [1], [1], [1], [1], [1], [1], [1], [1], [1]],
[[1], [1], [1], [1], [1], [1], [1], [1], [1], [1]],
[[1], [1], [1], [1], [1], [1], [1], [1], [1], [1]],
[[1], [1], [1], [1], [1], [1], [1], [1], [1], [1]],
[[1], [1], [1], [1], [1], [1], [1], [1], [1], [1]],
[[1], [1], [1], [1], [1], [1], [1], [1], [1], [1]],
[[1], [1], [1], [1], [1], [1], [1], [1], [1], [1]],
[[1], [1], [1], [1], [1], [1], [1], [1], [1], [1]]])
{
union()
{
translate(-1, -1, 0){rectprism((2, 2, 0.35), "red");}
translate( 1, -1, 0){rectprism((2, 2, 0.35), "blue");}
translate( 1, 1, 0){rectprism((2, 2, 0.35), "yellow");}
translate(-1, 1, 0){rectprism((2, 2, 0.35), "cyan");}
}
}