Jump to content
  • Advertisement
Sign in to follow this  

directX : Problem in Sphere Texture Mapping

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

Hi, I'm new developer. I have a problem relate to sphere texture mapping. The code i wrote the code to create texture as function below: protected Texture CreateOverlayTexture(string image) { string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); Texture t = TextureLoader.FromFile(device, @path + "\\" + image); return t; } The code for create sphere vertex function is : private void CreateSphereVertex() { sphereMesh = Mesh.Sphere(device, 1.0f, 130, 500); VertexFormats format = VertexFormats.PositionNormal | VertexFormats.Texture1; Mesh tempSphere = sphereMesh.Clone(sphereMesh.Options.Value, format, device); sphereMesh.Dispose(); sphereMesh = tempSphere; CustomVertex.PositionNormalTextured[] verts = (CustomVertex.PositionNormalTextured[])sphereMesh.VertexBuffer.Lock (0, typeof(CustomVertex.PositionNormalTextured), LockFlags.None, sphereMesh.NumberVertices); for (int i = 0; i < verts.Length; i++) { verts.Y * verts.Y + verts.Z * verts.Z)); float v = (float)(Math.Acos(verts.Y) / Math.PI); float u = (float)((Math.Atan2(verts.Z, -1 * verts.X) / Math.PI + 2.5f) * 0.5f); verts.Tu = u; verts.Tv = v; } sphereMesh.VertexBuffer.Unlock(); } However, the sphere display a split line. You can view the result from this link :http://cid-26aa6206f749ee6e.skydrive.live.com/self.aspx/.Public/texturemap.png May i know how to solve this problem to delete that split line? Thank you very much :p

Share this post


Link to post
Share on other sites
Advertisement
Its probably a singularity caused by the trig math (the equation probably explodes towards +-infinity somewhere)

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!