Notifications
Clear all

[Closed] Map Vertecies and UV vertecies relationships?

Ok a bit of a question not anwered by max help(that i could find)

say i have face 1 with geom verts #(1,2,6,7)

i then get the map verts i get #(6, 1, 2, 7)

CAN i ASSUME for all faces that if i sort from each array from hightest to lowest they will always match up? As i noticed that when getting geom verts they were already sorted, but when i got the map verts they were no sorted…

Thanks

4 Replies

In no way. It is just a coincidence because of the structure of your object.
Furthermore :

  • To 1 vertice can correspond several mapvertices.
  • To 1 mapvertice can correspond several vertices.
    (for example imagine that you break a vertex… you have 4 vertices and only 1 mapvertice)

This utility shows to you the relation between vertices and mapvertices:

fn getArrayOfMapVerts2VertsPOLY theObj theMapChannel =
	(
	numMapVerts = polyOp.getNumMapVerts theObj theMapChannel
	mapVerts2Verts = for mv=1 to numMapVerts collect #()
	numMapFaces = polyOp.getNumMapFaces theObj theMapChannel
	for f = 1 to numMapFaces do (
    	theMapFace = polyOp.getMapFace theObj theMapChannel f
		polyFace = polyOp.getFaceVerts theObj f
		for mv=1 to theMapFace.count do (
			mapVert = theMapFace[mv]
			if findItem mapVerts2Verts[mapVert] polyFace[mv] == 0 do append mapVerts2Verts[mapVert] polyFace[mv]
			)
		)
	mapVerts2Verts
	)

fn getArrayOfMapVerts2VertsMESH theObj theMapChannel =
	(
	numMapVerts = meshOp.getNumMapVerts theObj theMapChannel
	mapVerts2Verts = for mv=1 to numMapVerts collect #()
	numMapFaces = meshOp.getNumMapFaces theObj theMapChannel
	for f = 1 to numMapFaces do (
    	theMapFace = meshOp.getMapFace theObj theMapChannel f
		theMapFace = #(theMapFace.x as integer,theMapFace.y as integer,theMapFace.z as integer)
		meshFace = getFace theObj f
		meshFace = #(meshFace.x as integer,meshFace.y as integer,meshFace.z as integer)
		for mv=1 to theMapFace.count do (
			mapVert = theMapFace[mv]
			if findItem mapVerts2Verts[mapVert] meshFace[mv] == 0 do append mapVerts2Verts[mapVert] meshFace[mv]
			)
		)
	mapVerts2Verts
	)

fn getArrayOfMapVerts2Verts theObj theMapChannel =
	(
	array=false
	case classOf theObj of
		(
		Editable_mesh: array=getArrayOfMapVerts2VertsMESH theObj theMapChannel
		Editable_Poly: array=getArrayOfMapVerts2VertsPOLY theObj theMapChannel
		)
	array
	)

fn getArrayOfVerts2MapVerts mapVerts2Verts =
	(
	verts2MapVerts=#()
	for mv=1 to mapVerts2Verts.count do
		(
		currentVerts=mapVerts2Verts[mv]
		if currentVerts!=undefined do
			(
			for v=1 to currentVerts.count do
				(
			if verts2MapVerts[currentVerts[v]] == undefined
				then verts2MapVerts[currentVerts[v]]=#(mv)
				else append verts2MapVerts[currentVerts[v]] mv
				)
			)
		)
	verts2MapVerts
	)

clearListener()
if selection.count!=0 then
	(
	obj=selection[1]
	channel=1
	mapVerts2Verts=getArrayOfMapVerts2Verts obj channel -- create the array mapVerts ==> verts
	if mapVerts2Verts!=false do (
		verts2MapVerts=getArrayOfVerts2MapVerts mapVerts2Verts -- create the array verts ==> mapVerts
		format"%
" obj.name
		format "
array : mapVerts2Verts
======================
"
		for i=1 to mapVerts2Verts.count do format "mapVert % => verts %
" i mapVerts2Verts[i]
		format "
array : verts2MapVerts
======================
"
		for i=1 to verts2MapVerts.count do format "vert % => mapVerts %
" i verts2MapVerts[i]
		)
	)

Hi pretty pixel, yes i get what your saying, the question is asking is…

Does the order in which they are output as matter.

For example say i have a quad with the following vertecies
geomvertecies = #(1,3,4,6)

say i get the following map vertecies in order
uvverts = #(8,5,7,3)

Does
geomvert 1 = uvvert 8 (order dependant)

OR

does geomvert relate to geomvert1 = uvvert 3 (the 2 lowest numbers sorted)

Thanks

oh sorry.
They are dependent on the order.

The order of mapVertices in a face is the same than the oder of the vertices in this same face.

theMapFace = polyOp.getMapFace theObj theMapChannel f
polyFace = polyOp.getFaceVerts theObj f

theMapFace[x] ==> polyFace[x]

You will find a good explanation of that in the reference:
Understanding Texture Coordinates and Vertex Colors

ok cool thanks