PDA

View Full Version : Texture Vertex vs Map Vertex ?


suvakas
01-21-2007, 10:34 AM
Hello all !

I have a small general type of question. I tryed to get the answer from help files, but i'm still a bit confused.
What is the difference between Texture vertex (getTvert) and Map vertex (getMapVert) ?
For example there are 3 times more Map vertexes in regular Box model than Texture vertexes. Maby someone has a bit of time to explain it briefly.

Thank you in advance,
suvakas

ypuech
01-21-2007, 10:44 AM
Hi suvakas,

getTVert mesh index : Return UVW coordinates at index in mesh

getMapVert mesh mapChannel index : Return specific mapChannelvertex coordinates at index in mesh

So, getTVert is used to get texture vertex coordinates and getMapVert to get specific map channel vertex coordinates.

For example map channel 0 is vertex color and 1 default texture map channel.

Bobo
01-21-2007, 03:39 PM
Hello all !

I have a small general type of question. I tryed to get the answer from help files, but i'm still a bit confused.
What is the difference between Texture vertex (getTvert) and Map vertex (getMapVert) ?
For example there are 3 times more Map vertexes in regular Box model than Texture vertexes. Maby someone has a bit of time to explain it briefly.

Thank you in advance,
suvakas

This is not correct.

A regular box with default texture coordinates in channel one has 12 map vertices and 8 mesh vertices. The getNumTVerts(), meshop.getNumMapVerts() and polyop.getNumMapVerts() all return the same value. This is because the top/bottom, front/back and left/right sides reuse the same texture coordinates and thus use half of the texture vertices of UVW Map Box mapping.

b = box() --create a box
b.mapcoords = true --enable texture coordinates in channel 1
convertToMesh b --collapse
getNumVerts b --get number of mesh vertices (8)
getNumTVerts b --get number of tvertices (12)
meshop.getNumMapVerts b 1 --get number of map vertices (12)
convertTo b Editable_Poly --convert to EPoly
polyOp.getNumMapVerts b 1 --get number of map vertices (12)

addModifier b (UVWMap maptype:4 ) --add UVW coords with Box mapping
convertToMesh b --collapse
getNumTVerts b --get number of tvertices (3*8 = 24)
meshop.getNumMapVerts b 1 --get number of map vertices (3*8 = 24)

RESULTS:
$Box:Box01 @ [0.000000,0.000000,0.000000]
true
$Editable_Mesh:Box01 @ [0.000000,0.000000,0.000000]
8
12
12
$Editable_Poly:Box01 @ [0.000000,0.000000,0.000000]
12
OK
$Editable_Mesh:Box01 @ [0.000000,0.000000,0.000000]
24
24
OK


If you add an UVW Map modifier to a box, each mesh vertex will need a separate texture vertex for each side of the box it belongs to (there are 3 sides per vertex), which explains why the number of map (texture!) vertices would be 3 times the number of MESH vertices. But the number of map and texture vertices is the same, because it is the same data.

There is NO technical difference between the map vertices of channel 1 and the tvertices. The difference is mainly historical.

When Max 1.0 shipped, it had only one texture map channel. MAXScript was under development at this point already and the method to get that single texture channel was getTVert(). When Max 2.0 shipped, it added a second channel (which was called channel 0), and MAXScript which was now integral part of Max added a method getVertColor() to access that channel.

Then in Max 3.0, the number of channels was increased to 100 (99+Vertex Colors). Initially, there was a script extension to access these channels in 3, it was incorporated in Max 4 as part of the meshop. structure. Since we had now 100 channels, the getMapVert() method was a universal function to access both Vertex Colors, Texture Vertices and the other 98 channels from 2 to 99. Thus, there were suddenly two ways to access the channel 1 and channel 0 values - using the original Max 2 methods and using the new generalized meshop methods.

But the values you are getting (as seen in the example above), are the same.

Hope this helps.

suvakas
01-22-2007, 09:22 AM
Thank you for this exellent explanation. I understand the idea now.
I re-did my tests and yep - there are same amount of Tverts and Mverts on 1st map channel of a model. I guess when i did my initial test then I had map channel > 1 for Mverts. Thats why i got wrong results.

Thanks again!
suvakas

CGTalk Moderation
01-22-2007, 09:22 AM
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.