dcsimg
A Flash Developer Resource Site

Page 5 of 5 FirstFirst 12345
Results 81 to 93 of 93

Thread: [AS2/3][Flash8+] 3d engine kit

  1. #81
    Junior Member
    Join Date
    Nov 2008
    Posts
    14
    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.

  2. #82
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    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

  3. #83
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    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.

  4. #84
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,140
    all you ever need is a 0 or a 1.

    lather yourself up with soap - soap arcade

  5. #85
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    and anything between

  6. #86
    Junior Member
    Join Date
    Jun 2009
    Posts
    4
    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!

  7. #87
    Junior Member
    Join Date
    Jun 2009
    Posts
    4
    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
    PHP Code:
    Vertex list:  [013223544576671017536024]
    Edge list:  [0514172629383110101197510468]
    Poly Triangle Vertices:  [012213234435456657670071173375604402]
    Polygon index list:  [012345]
    Connected Polygons list:  [514352405341054210231203
    Still far from what we need, but its a start i guess.

  8. #88
    formerly hooligan2001 :) .hooligan's Avatar
    Join Date
    Mar 2008
    Posts
    405
    You could always export it as a collada file.
    World Arcade | Facebook | Twitter - Follow MEEEE! or not......

  9. #89
    Junior Member
    Join Date
    Jun 2009
    Posts
    4
    Export it out of Maya, into 3DMax?
    Or export it with Collada and import it into flash?

  10. #90
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    Quote Originally Posted by sdrib View Post
    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
    PHP Code:
    Vertex list:  [013223544576671017536024]
    Edge list:  [0514172629383110101197510468]
    Poly Triangle Vertices:  [012213234435456657670071173375604402]
    Polygon index list:  [012345]
    Connected Polygons list:  [514352405341054210231203
    Still far from what we need, but its a start i guess.
    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

  11. #91
    formerly hooligan2001 :) .hooligan's Avatar
    Join Date
    Mar 2008
    Posts
    405
    Quote Originally Posted by sdrib View Post
    Export it out of Maya, into 3DMax?
    Or export it with Collada and import it into flash?
    Export from Aaya as a collada .dae file and make an importer for flash.

    You could probably check out the one in papervision to get some tips.
    World Arcade | Facebook | Twitter - Follow MEEEE! or not......

  12. #92
    Junior Member
    Join Date
    Jun 2009
    Posts
    4
    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:

    PHP Code:
    Poly Triangle Vertices:  [012213352254456657670071751153604402]
    Poly Triangle Vertices:  [130032352254456657670071173375604402
    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.

    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.

    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
    Last edited by sdrib; 06-21-2009 at 11:15 AM.

  13. #93
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    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.
    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center