Texture Coordinates

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  02 February 2013
Texture Coordinates

Hi! I have the following problem: I have vertex positions and I want to find the corresponding texture coordinats for the vertices. The documentation says the following:
In order to find out which texture vertex corresponds to a mesh vertex, you have to do the following:
  1. Take the index of the mesh vertex.
  2. Find out which faces reference the index of the face.
  3. Note the number of the vertex (1 st , 2 nd or 3 rd - .x, .y or .z) inside each face.
  4. For each face referencing the vertex, get the texture face with the same index.
  5. Get the index of the respective texture vertex from the face - 1 st , 2 nd or 3 rd / .x, .y or .z
  6. The vertex you got corresonds to the mesh vertex we started with.
  7. Repeat steps 3 to 6 for all faces found.

    Same applies to color vertices.
but I don't understand that. Can someone explain it to me a bit more understandable? Thanks a lot.
  02 February 2013
do you need it for mesh or poly? .. i don't want to write a code two times....
  02 February 2013
this was my editable poly function for this before i started using the sdk

fn GeoVertToMapVert obj v mapCh =
		faces = (polyop.getFacesUsingVert obj v) as array 
		faceIndices = for i in faces collect finditem (polyop.getFaceVerts obj i) v;
		makeUniqueArray (for i = 1 to faces.count collect (polyop.getMapFace obj mapCh faces[i])[faceIndices[i]]);

I'm sure there are more elegant and faster solutions out there
  02 February 2013
Originally Posted by denisT: do you need it for mesh or poly? .. i don't want to write a code two times....

well ... let's do it for editable_mesh trimesh:

fn getMapVertsUsingVert mesh vert channel:1 = if (meshop.getMapSupport mesh channel) do  
	tverts = #{}
	for f in (meshop.getfacesusingvert mesh vert) do
		vv = getface mesh f
		tv = meshop.getmapface mesh channel f
		out = off
		for k=1 to 3 while not out where out = (vv[k] == vert) do append tverts tv[k]
  02 February 2013
... and Klunk showed it for poly
  03 March 2013
ok thanks, nice
does it matter if I have a editable poly and there a take a face with the 3 vertices and look for the texture coordinates with the editable poly method or if I convert the editable poly then and look for the texture coordinates? Does the vertices have another order when it is converted?
Is there also a method to get the Texture Coordinates of a random point on a face or should I interpolate it after I have the coordinates of my vertices?
  03 March 2013
i don't know what you mean by "interpolate" but to get corresponding face map point to the geo face point you have to use Bary coordinates. there is a sample in the MXS help.
  03 March 2013
I mean that I have a face with 3 vertices and then I have a point P on that face. And dependent on that information I want to have the texture coordinates of the point P.
I know this function:
coordinates = meshop.getBaryCoords obj face_index P
but how can I get the texture coordinates for that point?
  03 March 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 05:15 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.