Can't get correct UV coordinates of the texture for cylinder face

Hi Experts,

In SketchUp application, I create a model without texture and saved it into NoTexture.skp.

First I open NoTexture.skp file and assign a texture to polygon mesh and re-save it into polygonmesh_texture.skp.
polygonmesh_texture.skp (159.6 KB)
Second, I open NoTexture.skp file again; then I create a component and assign the same texture with the same width/height to component and save it into component_texture.skp.
component_texture.skp (166.1 KB)

I query UV coordinates of polygonMesh texture by the following functions:
SUFaceGetUVHelper(); SUFaceGetUVHelperWithTextureHandle() and SUUVHelperGetFrontUVQ().
My application doesn’t perspective distortion of textures, so I get UV from UVQ by
u = u / q
v = v / q
q = 1.0
Then I dumped the UV coordinates into the file polygonmesh_texture_UV.txt in the zip package
polygonmesh_texture_UV.zip (1.3 KB)

I query UV coordinates of component texture by the functions:
SUTextureWriterGetFrontFaceUVCoords()
Then I dumped the UV coordinates into the file component_texture_UV.txt in the zip package
component_texture_UV.zip (1.2 KB)

If you compare these two texture UV files, you will find the UV coordinates are the same. If you open polygonmesh_texture.skp and component_texture.skp in SketchUp application, you will find the texture of the cylinder face are different. Logically I should get different UV coordinates for texture on cylinder face.

Could you please take a look at the issue? Appreciated for your help.

Thanks
Phenix

The model with the component has the material applied to the component instance. There is no UV mapping applied to the faces inside it - you get the default ones. So you must take that data and use the width and height of the material to calculate what the actual UV data would be.

I’ll file an issue internally for us to create an example for this.

Hi Experts,

According to your response, I should be able to get correct results when “Assign Material to PolygonMesh”. And Process the material in different way when applied to Component. However, Component assignment got correct result but the PolygonMesh assignment got wrong results.

Is it correct to call SUUVHelperGetFrontUVQ() to get the polygonmesh texture’s UV coordinates in my first post?
PS: Now I am getting different UV coordinates by calling the different functions “SUUVHelperGetFrontUVQ()” and “SUTextureWriterGetFrontFaceUVCoords()”. Bugra said in my another post I should be able to get the same UV coordinates by calling these two functions.

Hi Experts,

Could you please take a look at my issue? @tt_su, @bugra

Appreciated for your help.

Thanks
Phenix

Sorry, I’ve been out travelling recently, and I still got a bit of travel to do. I’ll see if I can on top of my todo-list next week.