- Home /
UVs on face of cube for repeated textures
Ok so I have a cube(or rather square prism as it doesn't have 1 set of opposing sides) and I'm trying to get a texture to repeat on each face. I have the 8 vertices, the 8 triangles(or 28 indices), and the 8 uv's.
The uv's are as such (0,0), (1,0), (2,0), (3,0), (0,1), (1,1), (2,1), (3,1).
This gives me the desired result of a repeated texture for the first 3 faces but for the last face where the last vertices join with the first vertices my texture is tripled up and squeezed on the face.
How do do I get the last face to only apply the texture once like all the others?
Answer by hvilela · Oct 20, 2012 at 05:11 PM
As long each vertex can only hold one UV you have to duplicate each vertex that shoud have diferent values for the faces that share it, so each face will have his own vertex and vertex data.
So your saying I have to have 10 vertices to double up on the vertices where the end meets the start? That doesn't seem very resourceful.
I figured there would be an option in a shader or something to set that would allow repeated textures. With my little experience in 3d modelling I'm sure I've made repeated textures around a cube before and I find it hard to believe that underneath, it was creating more vertices on my cube.
With just 8 vertices you won't be able to do this, unless you accept to flip the images in some faces or create your own shader. For example, the cube primitive that comes with Unity has 24 vertices, meaning that each cube face has his own vertices and that each visible vertex is actually 3.
Ah I see, that's cleared up a lot. Thanks for the help.
Your answer
Follow this Question
Related Questions
Easy way to convert a bunch of vertices to triangles or uv's? 1 Answer
UV problem on procedural mesh generation 1 Answer
Check if a mesh has UV map at runtime 1 Answer
Procedural Mesh UVing 2 Answers
Gradient background 3 Answers