创建纹理并将其添加到材质

create_texture.py

# This example shows how to create a texture and add it to a material.
print("Executing material create-texture script!")

newScene()
loadGeometry("$VRED_EXAMPLES/geo/teddy.osb")
base_dir = getFileIOBaseDir()
calcVertexNormals()
updateScene()

fur = findMaterial("fur_brown")

# creates a image.
img = createImage()
img.read(base_dir + "/../textures/Wasser1.png")

fields = fur.fields()
# set the image to the colorMap field.
fields.setFieldContainerId('colorMap', img.getID())
# turn on colorMap
fields.setBool("useColorTexture", True)