Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

geometry.set_material

Attach a material to a geometry. The shape is the input's own; only the material differs. The material is what a material node answers (material.pbrMat, material.shader, io.import of a .material) or a reference to a material asset; the record kind it names is stated on the detail attribute records. io.output draws the geometry with it and io.export saves it with the mesh.

Inputs

  • geometry (Geometry). What the material is put on. A copy carrying it comes out, and the wired value keeps whatever material it already had.
  • material (Points or AssetRef<material>, optional). The material to attach, written asset.resolve("<identity>", "material") for an asset. Left out, the geometry keeps the material it has.

Outputs

  • geometry (Geometry). The geometry carrying the material.
local red = g.material.pbrMat({ baseColor = { 1, 0.1, 0.1, 1 }, roughness = 0.4 })
local ball = g.geometry.set_material({ geometry = g.mesh.sphere({}), material = red })