Results 1 to 10 of 10

Thread: OpenGL Texture Mapping [Equirectangular 2 Azimuthal Equidistant]

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,201
    Blog Entries
    8

    Default

    With a quick look its hard for me or anyone to be too precise about a solution but from a glance here I would say that n your first post you have atan( ... ) where the ... is some func of x/y but usually you use atan with some func of y/x. Whether that's right or not in this case tho I don't know.

    From the second post you can use GL_REPEAT with OpenGL or you can mod the texture coord yourself. I think in your case changing the coord would be better. To do this for getting into the principle range from a -ve value you normally add on a repeat value and then call fmod( x ) where x is the repeating amount.

    But looking at the image I dont think that is your issue. What it looks like to me is the gourand shader for opengl where it will linearly ramp the texture coord from one vertex to another. If you have texture coords that run from say 0 to 1 around the globe and your last face has vertexes with texture coord of 0.95 on the left and 0 on the right then that last face is going to shade the whole texture map around. What you need is probably a duplicated set of vertices on the seam with a texture coord of 1.0 so it maps back to the 0. I.e. you now have 0.95 on the left and 1.0 on the right.

    If you set the normals to be radial then it should blend perfectly. If you use a texture map with the extra border pixel duplicated then it will antialias correctly as well.

    Well thats my my best guess from looking at it.
    Last edited by Redrobes; 07-26-2012 at 05:07 AM.

  2. #2

    Default

    Quote Originally Posted by Redrobes View Post
    But looking at the image I dont think that is your issue. What it looks like to me is the gourand shader for opengl where it will linearly ramp the texture coord from one vertex to another. If you have texture coords that run from say 0 to 1 around the globe and your last face has vertexes with texture coord of 0.95 on the left and 0 on the right then that last face is going to shade the whole texture map around. What you need is probably a duplicated set of vertices on the seam with a texture coord of 1.0 so it maps back to the 0. I.e. you now have 0.95 on the left and 1.0 on the right.
    Thanks for that Redrobes, I looked ito the problem and it is exactly that. Here are some pictures I made with MATLAB. I have put a screenshot my program from the same aspect next to it. The blue quadrilaterals are where the texture coordinates where seperated by more than some threshold (i.e. they have wrapped around).
    [img] http://dl.dropbox.com/u/49415695/1.PNG [/img]
    [img] http://dl.dropbox.com/u/49415695/2.PNG [/img]
    [img] http://dl.dropbox.com/u/49415695/3.PNG [/img]

    I made an attempt at correcting by adding 1 to the smaller of the coordinates but this didn't seem to correct the problem, but I still need to try a few things.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	1.PNG 
Views:	563 
Size:	346.7 KB 
ID:	46965  
    Last edited by felixrulz; 07-27-2012 at 03:50 AM. Reason: tried to delete atachment

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •