Problems with texture export

I‘m using OpenNurbs to read a 3dm file, but I have some troubles in texture exporting.
Here is the file I want to read.
X20231028103.3dm (11.7 MB)

Here is my problems.

  1. I have got the ON_Material from the InstanceDefinitionGeometry’s Attributes for ON_InstanceRef geometrys. But the texture file name read from the ON_Material .m_textures[0].m_image_file_reference (rdk$0200-0200-A8C9A081.tiff) differs from the real bitmap name(钻石颜色贴图.png).
  2. The m_T array of the ON_Mesh on layer01 is empty, leading to a wrong texture mapping.
  3. I have got the coresponding ON_Meshes from ON_Brep.GetMesh() on layer17. But the texture coordinates read from ON_Mesh.m_T seems to wrong, leading to a misalignment of textures.
    Is there any thing I can do with these problems? Thanks.

Hi @sw11

Which version of openNURBS are you using?

You need to set up texture coordinates based on the texture mapping used. Texture mappings are defined by object’s texture mapping channels. And each texture on a material defines which texture mapping channel is uses.

For the latest versions of openNURBS we’ve added functionality to make this process easier. Here’s sample code. The idea is to first set up cached texture coordinates on the mesh by material and then get the correct set of cached texture coordinates by texture.

I am using the latest openNURBS.
I tried the cached texture coordinates of mesh on layer 17, but it seems wrong either. And the mesh on layer01 has no texture coordinates.

Sorry, I was not paying attention to the model.
I see why that happens. Those objects have materials with base color texture (GoldDull_1) that uses environment projection instead of a texture mapping.

I need to investigate a little bit more.

The way texture is shown on object with environment projection depends on the camera. So any fixed texture coordinate values only give the right result for a specific viewing angle.

Are you exporting the model together with a fixed camera location?