0

I've got a set of texture data that (I believe) is in u-v form. It ranges from -115~ to ~115 (and these are not integers)

I'm trying to take this texture data and map it onto a model (which comes in X,Y,Z form) in MATLAB. However, about 1 hour ago was the first time I'd ever heard of u-v mapping, and that's how I was given the data.

In this case, I have a list of vertices of an aircraft in x,y,z and that plots just fine (using plot3). I have three sets of data: vertices (n x 3), texture (n x 2), and "normal" (n x 3). But how can I use this texture data, along with the corresponding texture .png file, to overlay the texture on top of the model?

This is in MATLAB 2017b.

synchh
  • 31
  • 3
  • 1
    U-V mapping is a technique where you have, for each x,y,z of your 3D model, also a U-V location, so you know which color to paint (because u,v are the texture coordinates of that color). If you have this map, simply paint the color of the sample with the corresponding color of the texture. The ranges of the values in the texture themselves have nothing to do with the mapping itself. Now, if the question you are asking is "how do I build a U-V map" that is not a "solvable" problem. This comes from the artistic side of building the model. Check for texture mapping in general for more info. – Ander Biguri Dec 17 '19 at 15:13
  • Thanks for the quick response. So, to clarify, I do believe I've got the U-V map. It's just an n x 2 matrix. But when you say "u,v are the texture coordinates of that color", what do you mean by that? I guess what I'm asking is if x(1) = 5, y(1) = 100, z(1) = 25, and u(1) = 0.5, v(1) = 0.05, then how do I relate those u and v to my texture image, C? – synchh Dec 17 '19 at 16:59
  • 1
    I mean that a texture is a MxNx3 (if its color) matrix. When you know which u and v you want, you just access the texture as `tex(u,v,:)` to know which color you want to use. Wikipedia is incredibly descriptive in UC mapping and texture mapping. Have a read. This is what you are trying to achieve: https://en.wikipedia.org/wiki/Texture_mapping#/media/File:Texture_mapping_demonstration_animation.gif – Ander Biguri Dec 17 '19 at 17:16
  • That was helpful. I think I generally understand how it works. I have a bit of confusion concerning the fact that my u and v are sometimes outside of the range [0,1]. I think that's okay, because I think it just means that a 1.1, for example, is a 0.1 and a -1.1 would be the equivalent of a 0.9? And the other problem is that my texture is a 1024x1024x3, but my u and v, when multiplied by 1024, isn't giving me a whole number. – synchh Dec 17 '19 at 19:20
  • @AnderBiguri Is there another way around? Say I have a 3D mesh(quadrangulation) and I'd like to unwrap it to a uv domain. – June Wang Nov 11 '20 at 06:37

0 Answers0