在将 3D 个场景保存为 GLTF 个2.0格式之前,自定义非PBR到PBR材质的转换

非PBR到PBR材料转换

此代码示例演示如何将材质转换为PBR材质,然后以 GLTF 格式保存 3D 场景:

C#


import aspose.threed as a3d

# initialize a new 3D scene

s = a3d.Scene()

box = a3d.Box()

mat = a3d.shading.PhongMaterial()
mat.diffuse_color = Vector3(1, 0, 1)

s.root_node.create_child_node("box1", box).material = mat

opt = a3d.formats.GLTFSaveOptions(FileFormat.GLTF2);

# save in GLTF 2.0 format

s.save("test.gltf", opt);