View Full Version : Texturing a model with arbitrary geometry
deadheadunderscore
10-15-2005, 11:38 AM
Hi, new to the forum, so please bear with me if this has already been asked....
I have a model made of triangles and i want to apply a texture to it
how do i calculate texture coordinates for the intermediate vertices???
given that i take some vertex to have texture coordinate 0,0 how can
i complete the texturing ???
TIA,
Joy
Textures are referenced through u,v coordinates. Witch means the top-left of a texture is (0,0) where as the bottom-right is (1,1). So finding the appropriate coordinates depends totally on what the texture contains.
E.g. you want to have a blue triangle. Your texture could have a blue part in the upper area but just as well it could have the blue part towards the bottom.
It’s impossible to apply an algorithm to an arbitrary texture and still maintain a sensefull result.
A triangle within a mesh could reference any part within your texture. Unless you intend to write a texturing tool yourself you should be able to export the coordinates from your modelling tool much like you export the triangle coordinates.
In case you intend to write a texturing tool yourself you have to project the texture to the mesh. This could be done in different ways. Spherical, cubical, cylindrical and so on... Or you could distribute/map all your triangles to the texture so that no triangle overlaps another triangle. Afterwards you would fill the texture with the desired colours. But then you would also have to write a painting tool witch paints to the texture.
theAntiELVIS
10-16-2005, 05:41 AM
Traditionally the way this is done is to use an "unwrapper" - a program that "flattens" the mesh so a 2D rectangular texture can be superimposed on it. Then you just set the u/v texture coords to match the vertices.
Lith-unwrap is a good one - Google around fora downloadable copy.
If you want to automate texture coords you have to do a projection - cylindrical, spherical, etc. But this is time-consuming for a real-time application, and you don't get a perfect texturing.
-tAE-
deadheadunderscore
10-17-2005, 11:00 AM
Hi,
Sorry for the late reply, could not login sooner.
first of all, Thanks a lot :)
my need is for a simple one color texture to be put. this is not
for a graphics application, rather for showing some results for
subdivision algorithms. so, is there a simple way to do this ???
If all you need is one colour you could give the same texture coordinates to all your triangles.
u,v coordinates:
A -> (0,0)
B -> (1,1)
C -> (0,1)
Or you could use vertex colours instead of a texture.
deadheadunderscore
10-19-2005, 12:58 PM
Yeah, will use vertex colours prolly...... but wont give a nice finish, ill
go with the first option.
Thanks a lot.
Faelenor
10-21-2005, 07:17 PM
The two solutions will give the same results, and the vertex colors are a lot easier to use because you don't have to create a dummy texture.
deadheadunderscore
10-25-2005, 06:35 AM
oh ok.... Thanks for the clarification.
you just made life much easier for me :)
vBulletin, Copyright ©2000-2010, Jelsoft Enterprises Ltd.