Customize Non-PBR to PBR Materials Conversion and Export 3D Scene to GLTF 2.0 using Aspose.3D for .NET 17.6

Aspose.3d for net 100x100 Customize Non PBR to PBR Materials Conversion and Export 3D Scene to GLTF 2.0 using Aspose.3D for .NET 17.6

We are pleased to announce the availability of new version 17.6 of Aspose.3D for .NET API. The new version 17.6 of the API adds support of exporting 3D scenes to GLTF 2.0 (ASCII or Binary) format. GLTF 2.0 only supports PBR materials and Aspose.3D for .NET API internally converts Non-PBR materials to PBR materials as well as allows developers to customize the convert procedure. The recent version 17.6 also incorporates various bug fixes and internal improvements.

Export 3D Scene to GLTF 2.0 and Customize Non-PBR Material Conversion

With the help of Aspose.3D for .NET API, developers can start transition of 3D models to GLTF 2.0 to reap performance, portability and to gain quality benefits. GLTF 2.0 only supports PBR materials and PBR materials are a flexible way for 3D content creators to specify the rendering characteristics of their surfaces. During the export of a 3D model, Aspose.3D API internally converts non-PBR materials to PBR materials.

The materials in the scene will remain unchanged, and the developers can customize the conversion behavior. The code example demonstrates the customized export of 3D models to GLTF 2.0 format with Aspose.3D for .NET API: 

// initialize a new 3D scene
var s = new Scene();
// add a Box entity instance with phong material
var box = new Box();
s.RootNode.CreateChildNode("box1", box).Material =
new PhongMaterial() {DiffuseColor = new Vector3(1, 0, 1)};
GLTFSaveOptions opt = new GLTFSaveOptions(FileFormat.GLTF2);

//Custom material converter to convert PhongMaterial to PbrMaterial
opt.MaterialConverter = delegate(Material material)
{
PhongMaterial m = (PhongMaterial) material;
return new PbrMaterial() {Albedo =
new Vector3(m.DiffuseColor.x, m.DiffuseColor.y, m.DiffuseColor.z)};
};

// save in GLTF 2.0 format
s.Save(@"c:\temp\test.gltf", opt);

Please check this help topic to get inside other details: Customize Non-PBR to PBR Materials Conversion before saving 3D Scenes to GLTF 2.0 Format

Public API Changes

The following API changes in the new version are also worth noticing:

  • MaterialConverter member is added to Aspose.ThreeD.Formats.GLTFSaveOptions class. It helps in customizing non-PBR to PBR materials conversion.

Aspose.3D for .NET Resources

The following resources will help you work with Aspose.3D for .NET:

We hope you will enjoy this new release that save time and huge efforts for related files manipulation. The API is quite simple and can easily be used in any application.

No related posts.


To keep up with our news, you can follow us on Twitter or follow our Facebook page.

Leave a Reply