Jump to content
  • Advertisement
Sign in to follow this  
pseudomarvin

Texture coordinates in the seam of a mesh

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

I am creating a simple block mesh programatically. Assuming that I want to stretch an entire texture(coordinates range from 0 to 1) around this block, am I on the right track here? (It is being drawn in a counterclockwise direction, that is for the front face: 0,1,5,  1, 6,5, and for the left face: 3,4,8,  4,9,8).

 

8b4H7mY.png

 

1.) Do I have to duplicate the vertices at the seam of the mesh if I want to stretch the entire width of the texture around the block? I think so.

 

2.) In case that I have to, what are the differences between the data of the duplicated vertices (in the pair 0 and 4 for example)?

     Position is the same of course. Assuming that normals for the vertex are an average of the normals of the faces, their normal should also be the same. So they would differ in the U texcoord(U0 = 0, U4 = 1) and in case of precalculating the tangents for bump mapping, in the tangent[1].

 

Is there anything else that needs to be taken care of that I haven't thought of? Or a smarter way of doing this?

 

Thanks.

 

[1] http://www.terathon.com/code/tangent.html:

In the case that neighboring triangles have discontinuous texture mapping, vertices along the border are generally already duplicated since they have different mapping coordinates anyway. We do not average tangents from such triangles because the result would not accurately represent the orientation of the bump map for either triangle.

Share this post


Link to post
Share on other sites
Advertisement

If you want it to look boxy, you can't average and share the normals, if you do it will be shaded like a very low resoluton sphere, but maybe that is what you want.

For a boxy-looking box, you need to have 3 vertexes for each corner, with each having a normal corresponding to the face it belongs to.

 

Apart from that, you seem to be on the right track.

Edited by Olof Hedman

Share this post


Link to post
Share on other sites

All good then :)

 

Btw, not sure what you meant with that note about tangents, but if the bumpmap is tileable, even though the texture coord is discontinuous, I think you should handle the tangent like for all other vertices and average them with its neighbors.

And set texture wrap mode to repeat.

 

Then it should blend over nicely to its neighbor.

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!