# Texture Coordinates

 02 February 2013 #1 cgneuling Veteran portfolio Elisabeth Wien, Austria   Join Date: Nov 2011 Posts: 69 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: Take the index of the mesh vertex. Find out which faces reference the index of the face. Note the number of the vertex (1 st , 2 nd or 3 rd - .x, .y or .z) inside each face. For each face referencing the vertex, get the texture face with the same index. Get the index of the respective texture vertex from the face - 1 st , 2 nd or 3 rd / .x, .y or .z The vertex you got corresonds to the mesh vertex we started with. 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. share quote
 02 February 2013 #2 denisT MAX Doctor   portfolio Denis Trofimov CA, USA   Join Date: Jul 2009 Posts: 9,948 do you need it for mesh or poly? .. i don't want to write a code two times.... share quote
 02 February 2013 #3 Klunk Lord of the posts   portfolio Klunk United Kingdom   Join Date: Sep 2005 Posts: 701 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 share quote
 02 February 2013 #4 denisT MAX Doctor   portfolio Denis Trofimov CA, USA   Join Date: Jul 2009 Posts: 9,948 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] ) tverts ) `````` share quote
 02 February 2013 #5 denisT MAX Doctor   portfolio Denis Trofimov CA, USA   Join Date: Jul 2009 Posts: 9,948 ... and Klunk showed it for poly share quote
 03 March 2013 #6 cgneuling Veteran portfolio Elisabeth Wien, Austria   Join Date: Nov 2011 Posts: 69 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? share quote
 03 March 2013 #7 denisT MAX Doctor   portfolio Denis Trofimov CA, USA   Join Date: Jul 2009 Posts: 9,948 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. share quote
 03 March 2013 #8 cgneuling Veteran portfolio Elisabeth Wien, Austria   Join Date: Nov 2011 Posts: 69 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? share quote
 03 March 2013 #9 CGTalk Moderation Expert   Join Date: Sep 2003 Posts: 1,066,473 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. share quote

 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 CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.