Free Support Forum - aspose.com

Apply different material / texture to different sides of a mesh

I have a mesh which has been loaded from an external resource, and I need to be able to apply 2 different materials / textures to 2 different “surfaces” on the mesh. So picture a cube mesh, where the 2 triangles representing one face of the cube displays picture A, and another face displays picture B.

The textures are determined at runtime so trying to do a wrapped texture is not an option.

I have all the code working to be able to calculate the UV’s for any given vertex on the face; the piece I can’t seem to figure out is how to set up the vertex elements with your (somewhat confusing / inscrutable) MappingMode and ReferenceMode paradigms.

Is there any chance you have any, or could write, some example code showing how to build a simple cube, and apply 2 different materials / textures to 2 different faces on the cube? It would be INCREDIBLY helpful. All my outputs are in GLB, if that makes a difference.

@OBCad

Thanks for contacting support.

We are looking into your inquiry and checking related information at our side. We will get back to you shortly with our feedback.

@OBCad

Please find attached sample code for building a simple cube with different materials on different faces and save to .gltf.SampleCode.zip (1.6 KB)