Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Sphere with lines of longitude and latitude

Discussion in 'General Graphics' started by Adrianoooz, Feb 8, 2019.

  1. Adrianoooz

    Adrianoooz

    Joined:
    Jan 15, 2019
    Posts:
    12
    Hello,

    I want to place the main object in the middle of sphere and then project it on given geographic coordinates. I've been searching for hours (i probably search in a wrong way) on how to add circle of latitudes and meridians inside the sphere, so the object could be correctly projected.

    So, my question is: How can i add circle of latitudes and meridians to the sphere? Are there any assets including it or can i do it by myself?

    It should look something like this:

    Thanks alot!
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
    Are you looking for how to draw lines like that on a sphere, and / or how to get a sphere to have those UVs? What exactly do you mean by projecting an object onto geographic coordinates?

    For the lines, the simple approach to this is to make a sphere in your 3d modelling program of choice (Blender, Maya, 3ds Max, etc.) with spherical UVs, and map a texture to it with regular horizontal and vertical lines. That'll get you something like the sphere above. Alternatively you could use one of the multitude of wireframe rendering techniques to render the mesh's edges. Or you could use a shader based technique, either using the mesh's UVs, or calculate a lat/log position from the position on the sphere using trig.

    For projecting an object onto the surface, you probably don't need, or even want UVs like this. You're better off using a planar projection onto the sphere, either using Unity's own projector, or passing in your own orientation matrix to a similar material. If you use something like traditional long & lat / spherical UVs you get a lot of pinching at the top. You can see this just in the sphere above by looking at how they're nearly perfect squares on the side of the sphere, but much thinner and pinched near the poles, eventually turning into thin triangles.
     
    Adrianoooz likes this.
  3. Adrianoooz

    Adrianoooz

    Joined:
    Jan 15, 2019
    Posts:
    12
    Thanks alot, that is what i needed!