Jump to content
  • Advertisement
Sign in to follow this  
Disfunctional

Repeating textures on a sphere

This topic is 3205 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I've a small problem with calculating a spherical uv map. I use the following equation to get the u and the v values: Now my problem is when I use bilinear interpolation to render the image and my image is smaller than the surface of the sphere, this equation will simply "enlarge" my image. This is absolutely not what I want, I want it to "create" "tiles" so the surface of my sphere is filled with replicas of my image. If you think there is a problem with my bilinear interpolation: on triangles my "tiling" DOES work (combined with bilinear interpolation). So any ideas how I can fix this? Thanks for your time and effort!

Share this post


Link to post
Share on other sites
Advertisement
You can simply scale up u and v by multiplying both of them by a scaling factor. Make sure your rendering pipeline is configured in a mode where wrapping will repeat the texture (e.g., in OpenGL set GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T to GL_REPEAT).

Share this post


Link to post
Share on other sites
Same deal though. Just take the (u,v) coordinates you calculate as above, multiply u and v by the u and v frequencies with which you want to tile (meaning: how may times the texture repeats in each direction). A mod operation is needed later on when you calculate indexes into your texture to wrap the result.

I.e. (simplified),

u = as above
v = as above

u2 = uFrequency*u
v2 = vFrequency*u

textureValue = texture[u2%textureUsize][v2%textureVsize];

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!