Project Texture to Mesh

Given a jpg texture, is it possible to map the texture to the mesh’s faces directly? Or is it possible to map it to the vertex colors?

I would like to get rid of the necessary link to an external texture and combine it directly into the mesh.

Any ideas?

Thanks!

That is not possible yet as far as I know.

If you are worried about misplacing your texture/image file in relation to your blend file, you can always pack data which will permanently keep the two files together.

To Pack Data:
File > Pack Data

My objective is to reconstruct the object with the texture. But, I am only exporting the vertices & faces & vertex colors.

What information can I take from Blender to give me information about which (x,y) of the jpg texture to map to the xyz of the object? I am looking into UV mapping but all of my searches come up with the APPLICATION…not algorithms, etc.

Thanks

I do believe once you have UV mapped an object, that there are exporters that will allow you to export the UV map along with the object.

Is that closer to what you need?

Some where, but I cant remember where, this is documented… the info is kept in arrays…

You could take blender apart and find the code there, I suppose

Maybe you can find it here?

What do you want to do exactly? You want to store the vertices of object only in texture? Images aren’t suitable for this. Do you have any programming experience?

I’m really confused from your posts. For the first one, you got the answer. Textures cannot be merged to mesh, mesh doesn’t know about textures. Storing the same information from texture in vertex colours would be impractical in majority of cases, because you would need dense mesh, with as many vertices as is the resolution of the texture.

The UV mapping assigns each vertex of a face the UV coordinate. This might be what you are looking for. But from the exported UV map you don’t know about the mesh.

I’m really confused from what you want to do, so explain a bit more.

@dreamsgate
That seems to be what I need.

@Slink
If that info is kept in arrays, that is what I need

@Myn.pheos
I do have programming experience. But, I am not familiar at all with image processing. I am reconstructing the 3D model by exporting information about the vertices, vertex colors, & faces of the model. Using just those, I am able to reconstruct the model. If the object is painted with vertex paint, the reconstructed model will have the same colors.

Now, for textures, my objective is the same as above. I need to reconstruct the model with color information. I am trying to map the textures to the vertex colors (so that no further coding would be needed). But, I get your point (dense mesh) and that is out of the question.

So, I looked into UV mapping. But, I am not too sure of how it works. It seems like each vertex would have a corresponding UV coordinate for the texture to be mapped to. Along with that, the XY of the texture maps to the UV coordinate. So, if I know the XY of the texture & the UV to map to, I can redraw the texture by myself.

Does this seem doable? I can’t determine whether or not Blender has all this information. But, if I can export the UV and XY coordinates, hopefully I’d be able to reconstruct the model with color/texture.

Thanks

Most implementations of UV mapping (including Blender’s) are only 2-dimensional, so you can’t reconstruct a unique 3d mesh from those coordinates. Think of peeling an orange and flattening the peel. There’s no a priori reason that this 2d map of the orange’s surface should be reconstructed as a sphere; you could make it anything you want. Likewise, I’m pretty sure Blender doesn’t store the necessary transforms to go back to a 3D model from a 2d image. The coordinates must be mapped explicitly to an existing mesh.

@CD38
What do you mean by doesn’t store the necessary transforms? Are you talking about projecting the texture as a flat, cube, tube, or sphere?

I am not trying to use the UV mapping to reconstruct the model, but to project the texture onto a newly constructed model (for external use). Currently, I am using information about the vertices & face orientation to redraw the lines of the model (so ultimately redrawing all of the polygons).

But, I do not know anything how UV mapping works. Only that it is a technique used to draw a 2d texture onto a 3d object. Can someone point me to an article or explain how UV mapping works in Blender? How does Blender know which part of the texture to map? What else is needed to map a texture besides the UV coordinates?

Thanks again

Can anyone please give me some more input?

So all you are trying to export the model with textures. Aren’t any of the existing exporters useful to you?

The thing you don’t seem to understand is that you need the original texture in its entirety to be able to “project” it back on the mesh. Vertex color is a different thing… the software interpolates face color from vertex colors. If you save only the texture color at vertices you cannot determine colour at all points inside the polygon without using the original texture itself… that’s where uv-mapping algorithms come in.

Please describe in detail where and how you are “reconstructing” the model? Are you using OpenGL with a programming language for games or whatever OR are you trying to “export” a textured mesh to a different application.

–Usage–
I am not using OpenGL or anything. The only information that I have is vertex locations and face information. From those, I can “redraw” the model. NMFace(?) indicates which vertices make up the face. So, by using an algorithm, I can redraw the face.

–Question–
I know by now that I cannot use vertex colors to redraw the texture. I am trying to understand how UV mapping & the external texture related. I can’t determine what information I need, and what information Blender has, for my program to redraw the texture.

(From above)
But, I do not know anything how UV mapping works. Only that it is a technique used to draw a 2d texture onto a 3d object. Can someone point me to an article or explain how UV mapping works in Blender? How does Blender know which part of the texture to map? What else is needed to map a texture besides the UV coordinates?

Thank you!

Can someone please help me with this?