Skip to main content
deleted 3 characters in body
Source Link
concept3d
  • 12.7k
  • 4
  • 45
  • 57

Texture Coordinates -in a very technical terms-, are part of a parametric space that is a mapping between surface positions usually in model space and those texture coordinate. Those surface position are mapped to the parametric space using some sort of function. In other words each texture coordinate is a result of mapping a surface position to a parametric space (2D in case of 2D images).

The point that I wanted to explain is that texture coordinates are used to determine how each texture pixel(also called texel) can be mapped to a surface position.

Now back to your problem, given the above definition you need to assign each vertex its 2D texture coordinates in order to correctly map your 2D image to the 3D sphere. OpenGL uses per vertex attributes and can't simply use the given four texture coordinates values and imply the rest of the texture coordinates for each vertex. You either need to generate your texture coordinates using some sort of function or use a modelling package where an artist usually assigns each vertex its texture coordinate.

There are many ways you can generate texture coordinates a sphere but since you are generating a UV sphere but, what best fits you is called the naiive appraoch in this page to summerize the approach:

  • Directly map latitude-longitude onto sphere
  • use single rectangular texture with a proportion of 2x1
  • texture coordinates: u goes from 0 to 1 around the equator, v goes from 0 to 1 from pole to pole
  • pro: simple, most data sources are already in this format
  • con: wastes the majority of the texture resolution at the poles, where it is usually least needed

Texture Coordinates -in a very technical terms-, are part of a parametric space that is a mapping between surface positions usually in model space and those texture coordinate. Those surface position are mapped to the parametric space using some sort of function. In other words each texture coordinate is a result of mapping a surface position to a parametric space (2D in case of 2D images).

The point that I wanted to explain is that texture coordinates are used to determine how each texture pixel(also called texel) can be mapped to a surface position.

Now back to your problem, given the above definition you need to assign each vertex its 2D texture coordinates in order to correctly map your 2D image to the 3D sphere. OpenGL uses per vertex attributes and can't simply use the given four texture coordinates values and imply the rest of the texture coordinates for each vertex. You either need to generate your texture coordinates using some sort of function or use a modelling package where an artist usually assigns each vertex its texture coordinate.

There are many ways you can generate texture coordinates a sphere but since you are generating a UV sphere but what best fits you is called the naiive appraoch in this page to summerize the approach:

  • Directly map latitude-longitude onto sphere
  • use single rectangular texture with a proportion of 2x1
  • texture coordinates: u goes from 0 to 1 around the equator, v goes from 0 to 1 from pole to pole
  • pro: simple, most data sources are already in this format
  • con: wastes the majority of the texture resolution at the poles, where it is usually least needed

Texture Coordinates -in a very technical terms-, are part of a parametric space that is a mapping between surface positions usually in model space and those texture coordinate. Those surface position are mapped to the parametric space using some sort of function. In other words each texture coordinate is a result of mapping a surface position to a parametric space (2D in case of 2D images).

The point that I wanted to explain is that texture coordinates are used to determine how each texture pixel(also called texel) can be mapped to a surface position.

Now back to your problem, given the above definition you need to assign each vertex its 2D texture coordinates in order to correctly map your 2D image to the 3D sphere. OpenGL uses per vertex attributes and can't simply use the given four texture coordinates values and imply the rest of the texture coordinates for each vertex. You either need to generate your texture coordinates using some sort of function or use a modelling package where an artist usually assigns each vertex its texture coordinate.

There are many ways you can generate texture coordinates a sphere but since you are generating a UV sphere, what best fits you is called the naiive appraoch in this page to summerize the approach:

  • Directly map latitude-longitude onto sphere
  • use single rectangular texture with a proportion of 2x1
  • texture coordinates: u goes from 0 to 1 around the equator, v goes from 0 to 1 from pole to pole
  • pro: simple, most data sources are already in this format
  • con: wastes the majority of the texture resolution at the poles, where it is usually least needed
Source Link
concept3d
  • 12.7k
  • 4
  • 45
  • 57

Texture Coordinates -in a very technical terms-, are part of a parametric space that is a mapping between surface positions usually in model space and those texture coordinate. Those surface position are mapped to the parametric space using some sort of function. In other words each texture coordinate is a result of mapping a surface position to a parametric space (2D in case of 2D images).

The point that I wanted to explain is that texture coordinates are used to determine how each texture pixel(also called texel) can be mapped to a surface position.

Now back to your problem, given the above definition you need to assign each vertex its 2D texture coordinates in order to correctly map your 2D image to the 3D sphere. OpenGL uses per vertex attributes and can't simply use the given four texture coordinates values and imply the rest of the texture coordinates for each vertex. You either need to generate your texture coordinates using some sort of function or use a modelling package where an artist usually assigns each vertex its texture coordinate.

There are many ways you can generate texture coordinates a sphere but since you are generating a UV sphere but what best fits you is called the naiive appraoch in this page to summerize the approach:

  • Directly map latitude-longitude onto sphere
  • use single rectangular texture with a proportion of 2x1
  • texture coordinates: u goes from 0 to 1 around the equator, v goes from 0 to 1 from pole to pole
  • pro: simple, most data sources are already in this format
  • con: wastes the majority of the texture resolution at the poles, where it is usually least needed