Jump to content
  • Advertisement
Sign in to follow this  
pierceblaylock

Pinching SkyDome UV Coordinates

This topic is 3868 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

Not really sure how to explain this, but here goes. I have a skydome that is stretched vertically, so near the base of the dome, the vertices are quite tight, but as it gets higher they get further apart. I've done this on purpose. Now my problem is that I'm trying to generate uniform uv coordinates across the inside of this stretched dome. I've been at it all day and have pretty much given up. My math is just to weak to figure it out. Here is what I have working so far (not even sure if this is on the right track).
vertex.u = vertex.x / ( vertex.y * vertex.y ) * 4;
vertex.v = vertex.z / ( vertex.y * vertex.y ) * 4;
I do this for each vertex, which basically tiles my texture 4 times across the dome. This is pretty much just straight plane mapping, so I know it warps the texture a little on the dome, but that doesn't matter as you don't notice it with the textures I use. This all looks great if the dome is uniformly spherical, but as soon as I stretch the dome vertically, I get problems. The problem is that the texture loses resolution in the center of the dome where it is stretched the most. This is caused by the fact that when stretching, most of the vertices bunch up near the base, while only a few are spread across the center of the dome. I need it to be this way for some other things I'm doing with it. What is obviously happening is that the uv coordinates are losing their uniformity after stretching. So what I need to do is modify my above uv coordinate code so that it makes the uv coordinates tighter near the center of the dome and gradually roll out to the base of the dome. That way, before stretching, the texture should look bunched up in the center of the dome. I hope all that makes sense. I've scoured the web/forum looking at everything to do with sin/cos, domes, spheres, texture mapping, etc... and just can't seem to get it working. If anyone can help me out, I'd very much appreciate it.

Share this post


Link to post
Share on other sites
Advertisement
You might try drawing an icosahedron instead - the vertices are evenly spaced, so the textures might look a little better. Also, the icosahedron can be subdivided as many times as you like.
It might take a little fiddling, but check out this page (you will need to search for 'icosahedron').

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!