How can I get the UV of a projected texture on a component instance using CPP SDK?

Hi Experts,

I am writing an exporter for SKP. I ran into a very weird problem that I could not find the correct texture coordinates for particular component instances in the model. One of such model is attached here.

The extracted texture coordinates of center part of the 4 wheels are all wrong using SUMeshHelperGetFront(Back)STQCoords even if I divide the output ST by Q and then multiply them with the scale of the texture.

I checked them in the Sketchup and found textures of the wheel are set to projected. Is there special arithmetic calculation I need to do myself after I have STQ? Please advise. Thanks a lot.

The sketchup file

A closeup view in sketchup pro 2015 and the problematic UV extracted and rendered in my own renderer.

There shouldn’t be any need for special handling - should be the same for any other non-projected texture which has perspective mapping (using the Q value).
I am not sure what is going on there…

Thanks TT,

Here are some more details.

I remove the unrelated geometry and keep only the problemtatic wheel.
wheel.skp (1.3 MB)

I did a close investigation on 130th face of this group/component instance. Here is its 4 UV coordinates and related information.

is there anything that looks suspicious to you?

Hi TT,

I saw your comments in another post

that sketch team will provide an example of computing UV for components with no materials. I’d like to know if this example is available yet? Thanks.

I’m sorry, but the example is not ready. We’re currently in a very intense phase.

One thing though - are you using the texture writer? It will some times modify the UV values returned - if it thinks you want faces with perspective mapping exported as unique textures. (I have outlined this in another thread … trying to find it…)