vvoovv / blosm

Blosm addon for Blender. A few clicks import of Google 3D cities, OpenStreetMap, terrain. Global coverage. Source code is in the branch 'release'.
1.56k stars 185 forks source link

Gaps from tiles when downloading from Google #430

Open Nerosetsfire opened 9 months ago

Nerosetsfire commented 9 months ago

I love your add-on but when I try and download anything from Google there are basically gaps and some kind of grit that you can see through. I really don't know what to do about this because anyone have any advice? https://youtu.be/mGXrTx0BXog

vvoovv commented 9 months ago

Hi @Nerosetsfire

This a well known problem. I'll try to carry out some experiments later this week. I'll report the results in this issue.

Nerosetsfire commented 9 months ago

Thank you for letting me know aside from this I really love the add-ons I really hope that I can figure out how to fix this problem

vvoovv commented 9 months ago

@Nerosetsfire

May I know the coordinates of your area of interest? That's needed for testing.

Nerosetsfire commented 9 months ago

-73.57432,45.52248,-73.56306,45.53030

Thnk_u-)

vvoovv commented 9 months ago

The problem is seemingly caused by floating point errors. Internally Blender uses single precision 32 bits format for floating point variables, while Python use double precision 64 bits one.

As a test I tried to replace Blender floating point structures with Python ones. It seems it helped to decrease the width of gaps by two.

The gap in your area of interest used for comparison is marked with the red color:

image


Gap in the current release of the Blosm addon;

image


Gap after replacing Blender floating point structures with Python ones:

image

vvoovv commented 9 months ago

As a test I tried to replace Blender floating point structures with Python ones. It seems it helped to decrease the width of gaps by two.

I also made changes in Blender's built-in glTF importer, on which the Blosm addon relies to import Google 3D Tiles. So it will be required to change the glTF add-on as well.

WarnerV commented 9 months ago

Great to see that you're managing this improvement vvoovv!

Can you drop a note when there's a release out that has these changes included (including an updated glTF importer, I guess)?

Nerosetsfire commented 9 months ago

wow...thank you for figuring this out. I'm amazed actually. So I guess I will just need to wait for everything to get an update for it to work properly? Or is there something I can do in the mean time to make it work? Thank you either way for your help.

vvoovv commented 9 months ago

Making changes in a Blender's built-in addon and having them a future Blender release will take time.

I'll figure out how to override glTF stuff from the Blosm addon.

cyberlecs commented 9 months ago

As a test I tried to replace Blender floating point structures with Python ones. It seems it helped to decrease the width of gaps by two.

I also made changes in Blender's built-in glTF importer, on which the Blosm addon relies to import Google 3D Tiles. So it will be required to change the glTF add-on as well.

Hi @vvoovv, thanks for your great work! Any chance to release a experimental build with your solution, please? =)

vvoovv commented 9 months ago

Hi @cyberlecs

I hope to release it by the end of January.

vvoovv commented 7 months ago

The feature is finally out. The gap size was reduced up to 3 times. The feature will work in Blender 3.6, 4.0, 4.1.

To test the feature, install the latest version of the Blosm addon (currently 2.7.5).

image

cyberlecs commented 7 months ago

Thanks! Just tested here, the result is much better!

vvoovv commented 7 months ago

Some technical details.

Internally Blender uses single precision 32 bits format for floating point variables, while Python uses double precision 64 bits one. The more the magnitude of a variable is, the more the precision loss is, when converting from a Python structure to a Blender one. That can be seen in the example below. Enter the first two lines below in Blender's Python console to reproduce the example.

from mathutils import Vector
Vector((1266116.7, -4293231.2, 4528524.9))
Output: Vector((1266116.75, -4293231.0, 4528525.0))

Each Google 3D Tile is positioned on the Earth surface in the system of reference with the center in the Earth's center. A typical coordinate has millions of meters. The precision is lost significantly after the conversion to Blender's structure.

To decrease the precision loss an offset can be applied to the coordinates of each Google 3D Tile. The addon temporarily replaces a function in Blender's built-in glTF addon with a patched one, which does that. After the import the addon restores the original function of the glTF addon.

Nerosetsfire commented 7 months ago

amazing job! I will test this out asap

On Wed, Feb 7, 2024 at 5:50 PM vvoovv @.***> wrote:

Some technical details.

Internally Blender uses single precision 32 bits format for floating point variables, while Python uses double precision 64 bits one. The more the magnitude of a variable is, the more the precision loss is, when converting from a Python structure to a Blender one. That can be seen in the example below. Enter the first two lines below in Blender's Python console to reproduce the example.

from mathutils import Vector Vector((1266116.7, -4293231.2, 4528524.9))

Output: Vector((1266116.75, -4293231.0, 4528525.0))

Each Google 3D Tile is positioned on the Earth surface in the system of reference with the center in the Earth's center. A typical coordinate has millions of meters. The precision is lost significantly after the conversion to Blender's structure.

To decrease the precision loss an offset can be applied to the coordinates of each Google 3D Tile. The addon temporarily replaces a function in Blender's built-in glTF addon with a patched one, which does that. After the import the addon restores the original function of the glTF addon.

— Reply to this email directly, view it on GitHub https://github.com/vvoovv/blosm/issues/430#issuecomment-1933064905, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3463GHZAVPCEKXMXF2X7X3YSQAMZAVCNFSM6AAAAABAOFE77CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZTGA3DIOJQGU . You are receiving this because you were mentioned.Message ID: @.***>

Nerosetsfire commented 7 months ago

How do I get the latest version?

On Thu, Feb 8, 2024 at 5:42 PM Matthew Lipscomb @.***> wrote:

amazing job! I will test this out asap

On Wed, Feb 7, 2024 at 5:50 PM vvoovv @.***> wrote:

Some technical details.

Internally Blender uses single precision 32 bits format for floating point variables, while Python uses double precision 64 bits one. The more the magnitude of a variable is, the more the precision loss is, when converting from a Python structure to a Blender one. That can be seen in the example below. Enter the first two lines below in Blender's Python console to reproduce the example.

from mathutils import Vector Vector((1266116.7, -4293231.2, 4528524.9))

Output: Vector((1266116.75, -4293231.0, 4528525.0))

Each Google 3D Tile is positioned on the Earth surface in the system of reference with the center in the Earth's center. A typical coordinate has millions of meters. The precision is lost significantly after the conversion to Blender's structure.

To decrease the precision loss an offset can be applied to the coordinates of each Google 3D Tile. The addon temporarily replaces a function in Blender's built-in glTF addon with a patched one, which does that. After the import the addon restores the original function of the glTF addon.

— Reply to this email directly, view it on GitHub https://github.com/vvoovv/blosm/issues/430#issuecomment-1933064905, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3463GHZAVPCEKXMXF2X7X3YSQAMZAVCNFSM6AAAAABAOFE77CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZTGA3DIOJQGU . You are receiving this because you were mentioned.Message ID: @.***>

vvoovv commented 7 months ago

How do I get the latest version?

Through the download link in your purchase confirmation email.