renderhjs, one question.
Why in your formula for calculating matrix for UV:
a.a=(uv[1].-uv[0].x)
Why not
a.a=(uv[1].-uv[0].x)/w ?
Please point me what's wrong.
Printable View
renderhjs, one question.
Why in your formula for calculating matrix for UV:
a.a=(uv[1].-uv[0].x)
Why not
a.a=(uv[1].-uv[0].x)/w ?
Please point me what's wrong.
because the UV data that I stored in the arrays (the uv:Array) is already in floating values- which means that each x or y- coordinate is stored in range between 0 and 1, where as screen coordinates (the ones used for the other matrix) are pixel based so from 0 to Stage.width.
is that clear?
here is a picture that I found on the net- showing a example with values
http://www.planetxot.com/download/uvmapping.gif
edit:
the reason why UV values are usually represented in floating values and not for example pixel values (like the one fitting in a particular texture image) is that they want to keep it flexible with any size of image.
That way the same model and UV set can be used for another texture that might have a different size- think of skinning in games where people easily can swap or exchange textures.
Esspecially in 3d applications like 3dsmax material stuff is seperated strongly from modeling - so depending on your material and the textures (e.g bump map has a different image, so does difuse, specular, normal map, ect.). Things like that make it only logical why those values are stored like that.
all you ever need is a 0 or a 1.
;)
and anything between ;)
I don't know how active this thread still is but m very impressed, great tutorial!
I have a question, currently i am using Maya for modeling and animating. It seems that 3DMax has a better work flow and output to work with in flash.
So i wondered if I should learn 3DMax as well or stay with Maya and find ways to export my models. Also it seems i am going to have to move on to AS3 which i decided already before i found this tutorial.
Thank you! :)
Hmmmm
Pyhton seems to do the trick....
I found this article in case anyone is interested:
http://www.rtrowbridge.com/blog/2008...ing-mesh-data/
which gives
Still far from what we need, but its a start i guess.PHP Code:Vertex list: [0, 1, 3, 2, 2, 3, 5, 4, 4, 5, 7, 6, 6, 7, 1, 0, 1, 7, 5, 3, 6, 0, 2, 4]
Edge list: [0, 5, 1, 4, 1, 7, 2, 6, 2, 9, 3, 8, 3, 11, 0, 10, 11, 9, 7, 5, 10, 4, 6, 8]
Poly Triangle Vertices: [0, 1, 2, 2, 1, 3, 2, 3, 4, 4, 3, 5, 4, 5, 6, 6, 5, 7, 6, 7, 0, 0, 7, 1, 1, 7, 3, 3, 7, 5, 6, 0, 4, 4, 0, 2]
Polygon index list: [0, 1, 2, 3, 4, 5]
Connected Polygons list: [5, 1, 4, 3, 5, 2, 4, 0, 5, 3, 4, 1, 0, 5, 4, 2, 1, 0, 2, 3, 1, 2, 0, 3]
You could always export it as a collada file.
Export it out of Maya, into 3DMax?
Or export it with Collada and import it into flash?
no I think this is the way to go at first,- you can code a OBJ, FBX or DAE importer later anyway but its easier to learn and develop with those simple arrays. Because all the other formats need
A.) complex parsing: you have to split values, range areas and loop convert string values to number values which is often...
B.) ...slow compared to arrays that already exist on run time in Flash
what looks odd though is that the vertex list holds just a linear array (a 1d array and not a 3d array). So I dont know how it tells you what the X,Y,Z coordinates are of each vertex.
Same for the others that need either 2d or 3d values. What you could do however in order to understand the output is to create a super simple geometry like a rectanle plane with easy to recognize coordinates. Then run the script again and try to figure out which value went where.
and I wouldnt say that max is better in terms of x or y its just that I know max already for such a long time ;)
Hmmm yes i think its a good idea to go via Python first and construct your own format. I can always use the existing ones later. I really wan to understand every step which i am taking of this.
Im now trying to understand the code used and slowly getting closer to understand Python. Its the first time i come in contact with it.
I modified some vertices (on a basic polycube) in order to track down where the changes occurred but got some really weird results. If i move one vertex on 1 axis for example the y-axis. And i move it up or down, it changes 6 numbers of the Poly Triangle Vertices list with:
Which is logic, but it does NOT matter how much you change it, whether you move your point 1 time higher(or lower) or 3 or a million times. It stays the same.PHP Code:Poly Triangle Vertices: [0, 1, 2, 2, 1, 3, 3, 5, 2, 2, 5, 4, 4, 5, 6, 6, 5, 7, 6, 7, 0, 0, 7, 1, 7, 5, 1, 1, 5, 3, 6, 0, 4, 4, 0, 2]
Poly Triangle Vertices: [1, 3, 0, 0, 3, 2, 3, 5, 2, 2, 5, 4, 4, 5, 6, 6, 5, 7, 6, 7, 0, 0, 7, 1, 1, 7, 3, 3, 7, 5, 6, 0, 4, 4, 0, 2]
Anyway i keep working and studying on it. And keep going on with Maya since i know my way there. Learning/understanding Python will be enough atm i think. :D
Thank you for your help so far guys, its greatly appreciated.
EDIT:
i think the array's are not related to coordinates, but the id's/indeces of given points/edges etc
yes somehow you are missing the coordinates of the verts as array.Quote:
i think the array's are not related to coordinates, but the id's/indeces of given points/edges etc
Btw. you might want to read it out as mesh instead of poly because that way it will export as triangles and not for example as quads or n-gons. Most perspective projections need triangles. Only with orthographic projections you can render n-gons or quads without texture distortions using affine texture mapping (what this tutorial uses)