Unwrap a TriMesh

hi there,



i am loading external model data, which does not provide any texture coordinates.

what i want to do is to add some basic texturing to the model based on the materials of the objects, which means i could apply a repeating texture (no need for complicated positioning of several textures).



so basically i'd like to generate some reasonable texture coordinates to do so. by googling i found out, this can be done by unwrapping the mesh to a planar suface on which i could apply some texture image to (planar, cylindrical, spherical).



unfortunately i could not find any hint on algorithms to do this, so i'm asking here if someone has some way of computing the unwrapped planar surface of a TriMesh.



i know that this can be complicated, so i'd appreciate a hint to some basic solution.

(this must be solved inside java for me, external tools won't be of any help)



please help …

If you don't care about continuity along faces, you can take each triangle, and directly map any triangle from your texture. You can adjust size so it matches the triangle real size.



If you do care about continuity, then the most common strategies are unwrapping and projecting. You already know how unwrapping works. Projecting is easier, and basically consists in that you imagine an already mapped cylinder, box or sphere around the object, and project that inside to the model vertexes… it's like "shrinking" the sphere or box down until it touches the object's vertexes.



I am afraid you'll need to code this yourself. Projecting is far easier than unwrapping.



I also recommend you to wait for other opinions, I am not very studied on this stuff.

jjmontes said:

If you don't care about continuity along faces, you can take each triangle, and directly map any triangle from your texture. You can adjust size so it matches the triangle real size.

If you do care about continuity, then the most common strategies are unwrapping and projecting. You already know how unwrapping works. Projecting is easier, and basically consists in that you imagine an already mapped cylinder, box or sphere around the object, and project that inside to the model vertexes... it's like "shrinking" the sphere or box down until it touches the object's vertexes.

I am afraid you'll need to code this yourself. Projecting is far easier than unwrapping.

I also recommend you to wait for other opinions, I am not very studied on this stuff.


thanks for your answer, actually i do care about continuity, so unwrapping would be my choice in favour of projecting the texture.

as you say, i do know how unwrapping works .... but only in theory. what i need, is a working algorithm to do this in java code with a TriMesh. maybe some of you have done this before ... anybody?

In my experience, fully automated unwrapping on unknown geometry tends to produce terrible results.

Usually it's just a starting point for manual work.



I'd love to see a working algorithm if there is one, though.

so ooOOppSS :slight_smile:

seems that i've read over the last sentence.