Ask the ZMan: Applying Textures, Part 3

Sign in to queue

The Discussion

  • User profile image
    codemonkeyj​as

    Hi,

    I put a fix in for the spherical mapping:

    device.RenderState.Wrap0 = WrapCoordinates.Zero;

    This will fix the seam.  However, if you try a different texture like a grid, you'll notice that the poles are still not mapping correctly.  Do you have a fix for this?

  • User profile image
    mrlinx

    have the same problem as codemonkeyjas...

    But I'm using opengl with fragment shader (per-pixel) so I shouldn't have interpolation problems. any info?

  • User profile image
    The Zman

    Using the default sphere that gets generated by DirectX you can never map the poles perfectly for 2 reasons.

    1. The poles actually map to the entire edge of the texture - you cant do that

    2. The poles all share a single vertex and therefore have to share the same u,b coordinates which means everything is stretching to the same single point.

    The only way to solve this is to generate your own spherical (or other) mesh and map the points yourself. This was beyond the scope of this article.  This article covers other ways of mapping textures to spheres http://vterrain.org/Textures/spherical.html

  • User profile image
    sparticus

    Fixed it!

    Now i'm having the same problem as codemonkeyjas on the poles.

  • User profile image
    sparticus

    I'm brand new to graphics programming and this article has been extremely helpful.

    I'm trying to dynamically draw the texture being mapped on the sphere and the glitch (mentioned at the end of the article) is there when I call TextureLoader.FromFile() but when I call TextureLoader.FromStream() it only paints half the sphere.

    I'm having trouble finding good tutorials online so any references/advice would be much appreciated!

Add Your 2 Cents