Open mdeabreuatsafe opened 5 months ago
SketchUp isn't designed to be used with really large coordinates from the origin.
Typical workflow is to set the geolocation of the model to somewhere around the centre of your geometry, then use functions that convert from local coords to world coords.
In the Ruby API we have model.point_to_utm(point)
and model.utm_to_point(utm)
. There is even the UTM
class: https://ruby.sketchup.com/Geom/UTM.html
However, now that I'm looking, I'm not seeing this exposed to the C API... 🤔
Looks like we have to add those.
Related: #828
I haven't tested this but it's how you resolve this issue in other rending engines...
Create the elements with UVs close to 0,0,0. Then put these into a Group/Component and move to your large coordinate basepoint. Hopefully the UVs will be rendered correctly.
We're working the SketchUp C SDK and have run into an issue when creating geometry with UV coordinates when the geometry is distant from the origin. I've modified the Texture Mapping example included in the SDK to show this issue. If we build our geometry near the origin and apply a texture using UV coordinates, everything will display correctly. This is using the texture in the sample, but the thing to notice is that everything is contiguous.
Now if we offset the geometry quite far from the origin (400 000, 5 000 000, 100; to mimic the UTM-32N coordinate system) we see that the texture has become quite disconnected.
This has been reproduced on SketchUP C SDK 2023.1.315 (what we're currently using), and the latest available 2024.0.553. This was done on Windows 11 Pro 23H2.
Here is the complete TextureMapping main.cpp, the main thing to note is the offsetting of the coordinates. Disable that line to see the correct working case, enable that line to see the broken case.