Texture on 3d globe map - ugly seam

Godot Version

v4.5.1.stable.official [f62fdbde1]

Question

we are trying to (partially) ‘port’ unity project to godot (sebastian lague) :

we want 3d earth globe, with selectable countries (& optionally cities)

current issue :
earth_texture.jpg (or any other texture i tested) has ugly seam, going north - south
seam looks like if same texture would be (separately) squeezed onto seam, but rotated 90 degrees

(note : currently map is upside down, this i can solve, for the sake of 1st debugging the ugly seam, i left it as is (flipped))

images :
ImageBam - ugly seam zoom out

ImageBam - ugly seam russia (n)

ImageBam - ugly seam antarctica (s)

ImageBam - ugly seam original

ImageBam - original earth texture we are using

code is currently in parts :
1 globe_map.tscn
2 cube_sphere.gd - creates globe mesh & applies textures etc :

3 geo_maths.gs - helper functions for globe & latitude longitude etc :

4 world.gdshader - shader for texture map :

aim is to have low-poly, cartoon-looking ui, for user to select country, & also to access settings & app exit (not implemented yet)

what i am asking is : how do we properly wrap texture on (cube)sphere, so the seam does not look ugly ?

thx for your help

godspeed

Some reading for you :slight_smile:

1 Like

Basic anwer: you can’t map a 2d quad (the texture) on a 3d sphere without seams.
For centuries, cartographers have wrestled and invented various projections to get around the problem, and that’s how you get Groenland bigger than Africa…

With shaders, one can imagine faking it by calculating UVs according to POV so that the seams is on the “dark” side of the onlooker and thus never visible. It basically means applying the texture so that’s its centered on a normal from its center to the Eye/camera location

1 Like

That’s not really a seam. It’s bad UVs on your generated sphere geometry. You need an extra column of vertices for that last meridian, that overlap with the first meridian but have different UVs. You’re apparently using the same vertices (or the same UVs as for the first meridian).

The alternative is to not use UVs at all and just project the texture in a shader.

1 Like