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


#1

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 class=“attachment” href="/uploads/def

ault/original/2X/3/36168029a69dcbe5d905c06d8d4e0c8232671716.skp">Hi_res_version_of_The_A_Team_Van…skp

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


#2

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…


#3

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?


#4

Hi TT,

I saw your comments in another post

http://forums.sketchup.com/t/cant-get-correct-uv-coordinates-of-the-texture-for-cylinder-face/7021

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.


#5

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…)