A Flash Developer Resource Site

Page 1 of 5 12345 LastLast
Results 1 to 20 of 93

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

  1. #1
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756

    Lightbulb [AS2/3][Flash8+] 3d engine kit

    I make no secret about disliking most of the major well known 3d engines in Flash and that is mainly because they rather encourage to adopt their complicated framework instead of learning from the mechanics behind the scenes, about actually rendering 3d in flash. Its what pissed me off at first when I wanted to learn from them.

    Frameworks like that are imo. a reason (out of many) why there is such a big gap between amateur and professional flash delelopers and another reason why so many flash users think that everything that looks 3d on the web is done using papervision. I do aknowledge the path many of the popular engines have been weaving but the hype is also something that makes me sad because of the gab and also because of the growing ignorance towards developing things yourself or in general 3d or AS3.

    So perhaps with this post I can take away some of the magic wall that exists and motivate others to give it a try as well.

    [about]
    The core of this post is a free simplified engine with around 80 lines of code that supports:
    - seamless texture mapping
    - backface culling
    - depth sorting

    [SWF width=600 height=400]http://www.renderhjs.net/bbs/flashkit/3d_engine_kit/engine_kit.swf[/SWF]

    engine_kit.swf demo
    fla download:
    engine_kit.fla


    I tried simplifying the code so half of the code could certainly be optimized alot but the main goal was to make 3d in flash as accessable as possible. You can copy paste it modify and improve it for your own needs. The camera model doesnt provide perspective but I think that this one is easier to understand at first.

    The other part of this post is to introduce to the tools and knowledge that is required to build and run a 3d engine. I tried to give this post some structure so that you can skip parts you already know or don't need.

    [Index]
    1.) Flash 3d resources
    2.) 3d modeling software and links
    3.) exporting your models
    4.) inspecting a example object and its texture
    5.) the source code
    6.) explaining parts of the code


    1.) Flash 3d resources
    There are some good resources on the net regarding general 3d engines in flash but you often end with a wireframe engine or something that can only be feeded with commands instead of 3d files out of 3d applications. Some imo. good resources for 3d and flash:
    http://www.kirupa.com/developer/acti...pt/3dindex.htm
    http://www.video-animation.com/flash3d_001.shtml
    http://www.flashandmath.com/advanced/index.html
    but for the most part they dont go further rather than displaying sprites or wireframes - so you often end up with something that does not look that fancy.


    2.) 3d modeling software and links
    The other part of 3d games/ engines is about creating the content so the 3d models and the textures. You usually need a 3d application for that to define the triangles of the 3d model and to define also where the texture is placed on the 3d model - called UV mapping. But first a list of common 3d applications with who you model and uv-map your models (I wrote some tags in the brackets that are related to the software)

    - blender (big buck bunny, elephant dream, opensource, dutch guys behind it )
    - truespace (microsoft purchase, amiga background, never succeded on the market)
    - milkshape (shareware, vertex by vertex construction, if not the biggest support for 3d formats)
    - silo (highly specialized modeler, retopolgy features, brush tools)
    - 3dsmax or gmax (very old series from back of the DOS days, one of the no.1 used tools in the game industry)
    - maya (the classic in animation, used in most holywood and computer animations (pixar,..))
    - lightwave (cheap but yet professional complete package, Diablo 1 & 2 sprites rendered with lightwave)
    - XSI (aka softimage, used in lots of anime productions using camera mapping & compositing, unique animations technologies)
    - modo (founded by former lightwave engineers , used by id software for their upcomming idTech5 titles)

    If you are not into 3d applications you might ask which one is expensive and what's the best one for x,y,z. First off booth Blender and truespace are booth free (the first one even opensource) and pretty much capeable of what the others offer- well in most of what you propably need.
    Out of the 2 beeing blender and truespace I would however rather recomend starting with blender as it has more resources on the net and is growing impressivly each few months. I would also say that blender is the more professional appearing package out of those 2.

    But what about the others?

    Maya has a good reputation at animation but it sucks at polygon modeling - the oppisite is 3dsmax it sucks at big scene manegements (e.g proxies) and does not have all the comfort maya offers in animation. But on the other hand max is way beyond maya when it comes to polygon modeling and has more strength regarding non linear workflow mainly because of the modifier concept.
    Lightwave is supposed to be great in modeling as well so does XSI (a really great package so I've heard) but XSI for example has a niche booth in europe and the US and is more used in Japan. And lightwave is more known for special effecst or industries with less budget - though no doubt its a great a solid package.

    Modo and silo are rather newcomers and specialized booth at the beginning at modeling trying to bring topNotch solutions for modeling. Modo now even has painting and rendering abilities with impressive quality and a fresh wind of technology. Silo is my personal favourite when it comes to modeling - its fast, smal and so easy to adopt (and yet cheap) after a while it really feels natural modeling in it- it has however some flaws yet like scale issues when importing other models and scene manegenemt. Also with Silo you cant render directly and material setups are very basic.
    So in summary:

    free & good start:
    - blender
    - truespace
    good at modeling:
    - 3dsmax
    - silo
    - xsi
    - modo
    good at animation
    - maya
    - xsi
    good at rendering
    - 3dsmax (mentalRay)
    - maya (mentalRay)
    - XSI (mentalRay)
    - blender
    - lightwave

    3.) exporting your models
    I wont go into detail regarding how to create your 3d models here- there are plenty of online tutorials for that or to come here perhaps. Just search for low poly modeling and uv-mapping or uv unwrapping which should cover the 3d part. After that you basicly create your texture in Phtoshop/ gimp or any other bitmap editor your like.
    But the one thing I will offer a help with is a maxscript that exports your 3dmodel with texture placement information as actionscript arrays. A maxscript is a script just like actionscript that can be run in realtime in 3dsmax. The advantage of this is that you can even modify the script yourself to your own needs and pershaps learn from that. For a general guide regarding how to use maxscript and links regarding the free gMax (games max, and a free but outdated version od 3dsmax) have a look at:
    http://board.flashkit.com/board/showthread.php?t=757034

    In blender and Maya you can use phyton to export meshes and other informations but sadly I am not yet into that so search on the net for that if you dont have 3dsmax or the free gMax. I found a few links that generate actionscript for the major engines from blender - maybe there are some usefull resources
    http://www.rozengain.com/blog/2008/0...n3d-and-sandy/
    http://www.rustpunk.co.za/blog/index.php

    Other ways could be to convert existing 3d formats that are accessable in flash. Rather easier ones would be propably:
    - OBJ (Alias Wavefront Object, a ASCI format)
    - ASE (3dsmax ASCI export format, used alot in Unreal Engine 1 & 2)
    - DAE (collada a xml sctructured format, the official PS3 format, used in most cases for Papervision projects)
    all of them can be openend in any simple texteditor- and analyzed like that. Just create a simple quad plane (2 triangles) with a UV map and export it. Try to understand which value is stored how and where and parse it in Actionscript. The con on this approach is that the parsing time can be really slow esspecially with larger objects.

    From personal experience a optimized binary file is the quickest way to load and parse external files that is if you use AS3 where you can load and handle binary files- but that's another chapter. I had once a thread about it as well:
    http://board.flashkit.com/board/showthread.php?t=759766

    the script I created for this tutorial in 3dsmax (should work in gMax as well):

    (again use this guide if you dont know how to get it running)

    flashkit_export_mesh.ms - script download

    either copy paste this script or run it directly, after that select any object and hit the button. After that select the Actionscript copy it and paste it into your Code panel in flash.

    of course maxscript has a slightly different syntax but for someone who knows actionscript it should be not to difficult exploring and modifying the script. In case you need some info on the methods, a online 3dsmax 9 script reference is available under:
    http://www.kxcad.net/autodesk/Autode...t_Reference_9/


    4.) examination model
    here is a example model that I created for this tutorial

    important is the tris or triangles count you should keep in mind when modeling something for flash to be shown in realtime. The more you have the slower it could run or the more you will have to come up with additional tricks to make it run faster. So what data does it all require to store and thereby render such a 3d model?

    from my ASE thread:


    if we summarize it we have thus:
    - a texture, in case of flash can be any jpeg, png, gif or other bitmapData compatible bitmap
    - a vertex Array holding the x,y and z positions of the vertex points of the model
    - a face array: each element holds 3 index values of the vertex array. In other words e.g face 0 consists of vertex nr 0,1,4 which are the corners of the face
    - a texture vertex array. Just like the vertex array but on a 2d dimension this one holds how the faces of the model are mapped on the texture
    - a texture face array. Together with the texture Vertex array we know which triangle of the 3d model shares which triangle of the UV data


    this is a screenshot from 3dsmax's UVW editor it shows the UV map of the taxi model. Under tools you can render out a templete which then can be used in photoshop as guide for the texture creation.

    just to make things complete this is how things looked in photoshop:


    on a general node: the vertex array and face array are basicly a group they define the general shape of the model. The texture vertex array and the texture face array are another group they define the UV-map. The only connection they have are through the face array and texture face array order.
    This means that the first item of the face array is also the first item of the texture face array. This way you know later on which texture slice to use on which texture face in the viewport.
    this is btw. how I defined things later on in actionscript (simple plane example):
    PHP Code:
    var vtx:Array = new Array();//the vertex positions {x,y,z}'s
    vtx = [{x:-31,y:-31,z:0},{x:31,y:-31,z:0},{x:-31,y:31,z:0},{x:31,y:31,z:0}];

    var 
    fcs:Array = new Array();//the triangle faces and their vertex id's
    fcs = [[0,1,3],[3,2,0]];

    var 
    tVtx:Array = new Array();//the texture vertex positions {x,y}'s
    tVtx = [{x:0.12288,y:0.897702},{x:0.878457,y:0.967255},{x:0.198297,y:0.0784317},{x:0.953874,y:0.147985}];

    var 
    tFcs:Array = new Array();//the texture faces and their texture vertex id's
    tFcs = [[0,1,3],[3,2,0]];

    var 
    bitmap:BitmapData BitmapData.loadBitmap("texture"); 
    it might be confusing at first but if you have expierence with modeling or 3d models in general it makes sense why you need those 4 arrays. Give it a try and you might get more familar with the whole thing.

  2. #2
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    5.) the source code
    I'll first show the code complete so you can get a overview. The following code can be easily converted to AS3 compatible code- just change the onEnterFrame to a event and use a sprite with .graphics instead of the MovieClip and its drawingAPI.
    Some general notes:
    - requires Flash8 (because of the beginBitmapFill() method)
    - this example has a image in the Library with the linkage "texture" its the texture that is used on the 3d model
    - I also placed a textfield on the stage with the instance name "txt_ouput" its used to display the amount of faces that are rendered.

    the general parts are:
    a.) intialize arrays and texture
    b.) render function that plots the triangles on the screen
    c.) get2d function that converts 3d coordinates to screen 2d coordinates
    d.) getUVmatrix function that returns a transformation matrix the way its needed to fit the texture into the to be drawn face

    so here is the complete code:
    PHP Code:
    import flash.display.BitmapData;
    import flash.geom.Matrix;

    var 
    vtx:Array = new Array();//the vertex positions {x,y,z}'s
    vtx = [{x:-31,y:-31,z:0},{x:31,y:-31,z:0},{x:-31,y:31,z:0},{x:31,y:31,z:0}];

    var 
    fcs:Array = new Array();//the triangle faces and their vertex id's
    fcs = [[0,1,3],[3,2,0]];

    var 
    tVtx:Array = new Array();//the texture vertex positions {x,y}'s
    tVtx = [{x:0.12288,y:0.897702},{x:0.878457,y:0.967255},{x:0.198297,y:0.0784317},{x:0.953874,y:0.147985}];

    var 
    tFcs:Array = new Array();//the texture faces and their texture vertex id's
    tFcs = [[0,1,3],[3,2,0]];

    var 
    bitmap:BitmapData BitmapData.loadBitmap("texture");

    this.createEmptyMovieClip("mc",1);
    mc._x Stage.width/2mc._y Stage.height/2;

    onEnterFrame render;

    function 
    render(){
        var 
    i:Number 0; var j:Number 0;
        var 
    fcs_render:Array = new Array();//order of the faces to be rendered
        
        
    for (i=0;i<fcs.length;i++){//loop through the faces
        
            
    var tri:Array = new Array();//triangle
            
    var avg_x 0;var avg_y 0;var avg_z 0;
            
            for (
    j=0;j<3;j++){//loop through the vertex points of the particular face
                
    var vt:Object vtxfcs[i][j%3] ];//vertex in 3d space
                
    var pt:Object get2d(vt.xvt.yvt.z);//point on screen
                
    tri.push(pt);//add screen vertex position to triangle array
                
                
    avg_x+=vt.x;
                
    avg_y+=vt.y;
                
    avg_z+=vt.z;
            }
            if (  (
    tri[1].x-tri[0].x) * (tri[2].y-tri[0].y) < (tri[2].x-tri[0].x) * (tri[1].y-tri[0].y) ) {//Backface culling
                
    var zDepth:Number get2d(avg_xavg_yavg_z).dis;//
                
                
    var UVtris:Array = new Array();
                for (
    j=0;j<3;j++){
                    
    UVtris[j] = tVtxtFcs[i][j] ];
                }
                
                
    fcs_render.push({tri:triuv:UVtrisd:zDepth});
            }
        }
        
        
    fcs_render.sortOn("d", Array.NUMERIC);//sort faces based on the average Triangle center's depth towards the camera
        
        
    mc.clear();
        
    mc.lineStyle(0,0x696e77,50);
        for (
    i=0;i<fcs_render.length;i++){//loop through the faces
            
    var mtx:Matrix getUVmatrixfcs_render[i].uv fcs_render[i].tri ,bitmap);
            
    mc.beginBitmapFill(bitmap,mtx,true);
            
            for (
    j=0;j<3;j++){
                var 
    pt:Object fcs_render[i].tri[j];
                if (
    j==0){
                    
    mc.moveTo(pt.x,pt.y);
                }else{
                    
    mc.lineTo(pt.x,pt.y);
                }
            }
            
    mc.endFill();
        }
        
    txt_ouput.text fcs_render.length+"/"+fcs.length+" fcs";
    }

    function 
    get2d(x,y,z){//3d coordinates to 2d screen coordinates conversion

        
    var rz =  (_xmouse-Stage.width/2) * Math.PI/180;//rotation Z (turntable axis)
        
    var rx 45 Math.PI/180;//rotation X (up down angle)
        
    var txtytz// temporary x, y and z variables
        // rotation around z axis
        
    tx Math.cos(rz)*Math.sin(rz)*x;
        
    ty Math.sin(rz)*Math.cos(rz)*x;
        
    tx;
        
    ty;
        
    // rotation around x axis
        
    ty Math.cos(rx)*Math.sin(rx)*-z;
        
    tz Math.sin(rx)*Math.cos(rx)*-z;
        
    ty;
        
    tz;
        
        return {
    x:x,y:z,dis:y};
    }

    function 
    getUVmatrix(uv:Array, pt:Array, tex:BitmapData) {
        var 
    a:Matrix = new Matrix();//
        
    var b:Matrix = new Matrix();

        
    a.tx uv[0].xtex.width;
        
    a.ty uv[0].ytex.height;
        
    a.= ( uv[1].uv[0].) ;
        
    a.= ( uv[1].uv[0].) ;
        
    a.= ( uv[2].uv[0].) ;
        
    a.= ( uv[2].uv[0].) ;
        
        
    b.tx pt[0].x;
        
    b.ty pt[0].y;
        
    b.= ( pt[1].pt[0].) / tex.width;
        
    b.= ( pt[1].pt[0].) / tex.width;
        
    b.= ( pt[2].pt[0].) / tex.height;
        
    b.= ( pt[2].pt[0].) / tex.height;
        
        
    a.invert();
        
    a.concat(b);
        return 
    a;


    6.) explaining parts of the code
    you could try understanding the code yourself I also provided many comments explainting additional details and what what does. But I will try to explain a little bit further what part does what.

    the first part beeing:
    PHP Code:
    import flash.display.BitmapData;
    import flash.geom.Matrix;
    var 
    vtx:Array = new Array();//the vertex positions {x,y,z}'s
    vtx = [{x:-31,y:-31,z:0},{x:31,y:-31,z:0},{x:-31,y:31,z:0},{x:31,y:31,z:0}];
    var 
    fcs:Array = new Array();//the triangle faces and their vertex id's
    fcs = [[0,1,3],[3,2,0]];
    var 
    tVtx:Array = new Array();//the texture vertex positions {x,y}'s
    tVtx = [{x:0.12288,y:0.897702},{x:0.878457,y:0.967255},{x:0.198297,y:0.0784317},{x:0.953874,y:0.147985}];
    var 
    tFcs:Array = new Array();//the texture faces and their texture vertex id's
    tFcs = [[0,1,3],[3,2,0]];
    var 
    bitmap:BitmapData BitmapData.loadBitmap("texture");
    this.createEmptyMovieClip("mc",1);
    mc._x Stage.width/2mc._y Stage.height/2;
    onEnterFrame render
    sets up all the data that is required, the bitmap (the texture) is defined, a movieCLip to render into is created and centered on the stage.
    BitmapData and Matrix classes are loaded because they are needed for the texture transformation and bitmapData handling. Also the function rendering is placed on the onEnterFrame event.

    next is the core function- the rendering function it consists of 2 parts, in the first part beeing:
    PHP Code:
    function render(){
        var 
    i:Number 0; var j:Number 0;
        var 
    fcs_render:Array = new Array();//order of the faces to be rendered
        
    for (i=0;i<fcs.length;i++){//loop through the faces
            
    var tri:Array = new Array();//triangle
            
    var avg_x 0;var avg_y 0;var avg_z 0;
            for (
    j=0;j<3;j++){//loop through the vertex points of the particular face
                
    var vt:Object vtxfcs[i][j%3] ];//vertex in 3d space
                
    var pt:Object get2d(vt.xvt.yvt.z);//point on screen
                
    tri.push(pt);//add screen vertex position to triangle array
                
    avg_x+=vt.x;
                
    avg_y+=vt.y;
                
    avg_z+=vt.z;
            }
            if (  (
    tri[1].x-tri[0].x) * (tri[2].y-tri[0].y) < (tri[2].x-tri[0].x) * (tri[1].y-tri[0].y) ) {//Backface culling
                
    var zDepth:Number get2d(avg_xavg_yavg_z).dis;//
                
    var UVtris:Array = new Array();
                for (
    j=0;j<3;j++){
                    
    UVtris[j] = tVtxtFcs[i][j] ];
                }
                
    fcs_render.push({tri:triuv:UVtrisd:zDepth});
            }
        }
        
    fcs_render.sortOn("d", Array.NUMERIC);//sort faces based on the average Triangle center's depth towards the camera 
    in general this first part loops through all faces and sorts out in which order and which faces should be rendered.
    At first it loops though the faces array and for each face loop through its vertex points. In a temporary array 'tri:Array' the screen (2d) coordinates of the vertex points of that particular face are stored- this is essential because we need to know after that if the face is flipped or not (this is called backface culling).
    Detecting if a face is flipped or not depends on the clockwise order the vertex points are stored for each face. This does already the 3d package for your (in my case 3dsmax). If they are not in clockwise order the face is flipped and not visible to your eye.
    What else? three variables avg_x, avg_y, avg_z are used to calculate the Average points (so called centroids) for each face. We need those to determine the depth of a face later on. After the backface culling check
    PHP Code:
    if (  (tri[1].x-tri[0].x) * (tri[2].y-tri[0].y) < (tri[2].x-tri[0].x) * (tri[1].y-tri[0].y) ) {//Backface culling 
    the depth of the face towards the camera is determined with :
    PHP Code:
    var zDepth:Number get2d(avg_xavg_yavg_z).dis;// 
    I will get to that later but the get2d function returns beside the x and y coordinate also the distance towards the camera.
    the loop:
    PHP Code:
    for (j=0;j<3;j++){
        
    UVtris[j] = tVtxtFcs[i][j] ];

    stores actually the 2d coordinates in a array of the UV- map instead of just a index of the corrosponding texture UV vertex id. Think of it like this:
    PHP Code:
    pseudo code:
    UVtris[i] = {x:0.1225,y:0.4556}; 
    this way its easier to handle it later on.
    With
    PHP Code:
    fcs_render.push({tri:triuv:UVtrisd:zDepth}); 
    the current face with additional information is stored in the 'fcs_render:Array' the array that is rendered in the end.
    After the whole loop stuff, the array that holds the to be rendered faces is sorted based on the face centroid's depth towards the camera also known as the 'depth sorting'

    next up: the 2nd part of the rendering function
    PHP Code:
    mc.clear();
        
    mc.lineStyle(0,0x696e77,50);
        for (
    i=0;i<fcs_render.length;i++){//loop through the faces
            
    var mtx:Matrix getUVmatrixfcs_render[i].uv fcs_render[i].tri ,bitmap);
            
    mc.beginBitmapFill(bitmap,mtx,true);
            for (
    j=0;j<3;j++){
                var 
    pt:Object fcs_render[i].tri[j];
                if (
    j==0){
                    
    mc.moveTo(pt.x,pt.y);
                }else{
                    
    mc.lineTo(pt.x,pt.y);
                }
            }
            
    mc.endFill();
        }
        
    txt_ouput.text fcs_render.length+"/"+fcs.length+" fcs";

    so we have the to be rendered faces sorted and now want to render them into the movieClip called 'mc'.
    For that the movieClip's previous rendering needs to be cleared with 'clear();' after that I defined a wireFrame color but you can remove that one if you dont like it.
    It then loops through the 'fcs_render:Array' and draws triangle by triangle.

    PHP Code:
    var mtx:Matrix getUVmatrixfcs_render[i].uv fcs_render[i].tri ,bitmap); 
    is the transform matrix that is needed for the texture transformation so that it is rotated/scaled, skewed and placed correctly in the screen triangle.
    After that a beginBitmapFill() with the bitmap texture and the previous matrix is set up. This means that after this line any moveTo, lineTo,.. commands get filled with the texture 'bitmap' and the transformation of the mtx:Matrix.
    After that it loops though the 3 points of the to be rendered face- reads out the before stored 2d screen coordinates and plots them with moveTo and lineTo commands. At the end we need a endFill(); otherwise you would get garbage - so close each triangle you draw.


    the function get2d(x,y,z):
    is the function that makes out all the 3d,- it converts x,y,z coordinates to screen x,y coordinates. I perosnally prefer it this way having a own class or function that handles the view mechanics like how things are drawn to the screen.
    PHP Code:
    function get2d(x,y,z){//3d coordinates to 2d screen coordinates conversion
        
    var rz =  (_xmouse-Stage.width/2) * Math.PI/180;//rotation Z (turntable axis)
        
    var rx 45 Math.PI/180;//rotation X (up down angle)
        
    var txtytz// temporary x, y and z variables
        // rotation around z axis
        
    tx Math.cos(rz)*Math.sin(rz)*x;
        
    ty Math.sin(rz)*Math.cos(rz)*x;
        
    tx;
        
    ty;
        
    // rotation around x axis
        
    ty Math.cos(rx)*Math.sin(rx)*-z;
        
    tz Math.sin(rx)*Math.cos(rx)*-z;
        
    ty;
        
    tz;
        return {
    x:x,y:z,dis:y};

    it simply rotates the input XYZ coordinates around the center {0,0,0} one time around the z-axis and after that around the x-axis depending on the rz and rx values. The last y value is the one that makes out the distance towards the camera or on other words its normal is faced towards the camera. Read some kirupa or other tutorials for a perspective or more advanced perspective mechanic.

    the function getUVmatrix(uv:Array, pt:Array, tex:BitmapData)
    is the function that gives you the transformation Matrix you need in order to skew, rotate and translate the texture the way it should from UV-map to translated screen triangles.
    PHP Code:
    function getUVmatrix(uv:Array, pt:Array, tex:BitmapData) {
        var 
    a:Matrix = new Matrix();//
        
    var b:Matrix = new Matrix();
        
    a.tx uv[0].xtex.width;
        
    a.ty uv[0].ytex.height;
        
    a.= ( uv[1].uv[0].) ;
        
    a.= ( uv[1].uv[0].) ;
        
    a.= ( uv[2].uv[0].) ;
        
    a.= ( uv[2].uv[0].) ;
        
    b.tx pt[0].x;
        
    b.ty pt[0].y;
        
    b.= ( pt[1].pt[0].) / tex.width;
        
    b.= ( pt[1].pt[0].) / tex.width;
        
    b.= ( pt[2].pt[0].) / tex.height;
        
    b.= ( pt[2].pt[0].) / tex.height;
        
    a.invert();
        
    a.concat(b);
        return 
    a;

    basicly operates with 2 matrix objects beeing 'a' for the UV transformations and 'b' for the screen transformations. It took myself a while to set this up right. The way I understand it so far myself is that it first sets up the matrix objects the way the coordinates of the screen and UV transform. The first point e.g uv[0] or pt[0] is always the center the other thwo's beeing 1 and 2 of the arrays are used to get the rotation and scale information.
    Once those matrix objects are in place the first one (uv- matrix) gets inverted meaning it gets set to a base position (not rotated, scaled,...) see also:
    http://livedocs.adobe.com/flash/9.0/...=00001854.html
    after that the transformations of the screen coordinates are concatenated (added) resulting into the wanted transformation needed for the screen triangle.

    end of code explaination, if you dont get everything or I did not explain or write it so well- just give the source files a go or the code.
    I will try to provide some example models in the next few replies so stay tuned for more content

  3. #3
    do your smiles love u? slicer4ever's Avatar
    Join Date
    Dec 2005
    Location
    in a random occurance
    Posts
    475
    wow...what an amazing post render

  4. #4
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,140
    bookmarked

    I shall be looking further into this, thanks for sharing render. Amazing stuff as always.
    lather yourself up with soap - soap arcade

  5. #5
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,379
    When I finally gather all the pieces of my brain that just blew off after looking at this post, I'm going to write something more meaningful here. Tagged for later reading...
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  6. #6
    formerly hooligan2001 :) .hooligan's Avatar
    Join Date
    Mar 2008
    Posts
    405
    Wow I'm speechless, I agree with the other guys. I'm going to have to read this a few times over before I can say anything constructive. Nice post render.

  7. #7
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    thx guys,
    I know its a big and perhaps bloated post. At first I wanted to post just some snippets like camera engine models, uv mapping codes and lots of other stuff but I feared that without additional context it might be hard to grasp for most people.
    I think its important to have easy examples that work without xtra classes or files also for me. I might even look at it myself as well if I dont have my regular files with me sometime


    btw. here is another model (just finished) that you can play with:

    it has less triangles as the taxi while still offering more details from above. On its bottom its missing alot of details but I designed this model to be used mainly from above. Alot of the details is done through the texture and with the use of transparency and anti aliasing in the texture.

    the texture for this model can be downloaded here (just right click and save as pNG):

    the 3d data for the harrier is:
    PHP Code:
    //actionscript mesh export
    var vtx:Array = new Array();//the vertex positions {x,y,z}'s
    vtx = [{x:52,y:16,z:-4},{x:0,y:-19,z:-2},{x:35,y:32,z:-2},{x:35,y:-20,z:-2},{x:110,y:-25,z:-10},{x:105,y:-4,z:-10},{x:23,y:27,z:-7},{x:23,y:55,z:-12},{x:32,y:18,z:-26},{x:32,y:55,z:-26},{x:20,y:60,z:-26},{x:4,y:126,z:-15},{x:6,y:136,z:-26},{x:89,y:22,z:-15},{x:89,y:-34,z:-15},{x:98,y:-32,z:-26},{x:98,y:12,z:-26},{x:79,y:12,z:-26},{x:79,y:-32,z:-26},{x:0,y:-47,z:-7},{x:15,y:-49,z:-13},{x:22,y:-53,z:-26},{x:6,y:-136,z:-18},{x:0,y:-85,z:-10},{x:2,y:-113,z:-10},{x:63,y:-125,z:-25},{x:61,y:-112,z:-25},{x:9,y:90,z:-15},{x:15,y:106,z:-26},{x:0,y:34,z:-4},{x:12,y:60,z:-4},{x:8,y:74,z:-1},{x:18,y:-9,z:-14},{x:27,y:-10,z:-30},{x:0,y:60,z:4},{x:0,y:140,z:-26},{x:-35,y:-20,z:-2},{x:-35,y:32,z:-2},{x:0,y:38,z:-2},{x:-52,y:16,z:-4},{x:-110,y:-25,z:-10},{x:-105,y:-4,z:-10},{x:-23,y:55,z:-12},{x:-23,y:27,z:-7},{x:-32,y:18,z:-26},{x:-32,y:55,z:-26},{x:-20,y:60,z:-26},{x:-12,y:60,z:-4},{x:-15,y:106,z:-26},{x:-9,y:90,z:-15},{x:-4,y:126,z:-15},{x:-6,y:136,z:-26},{x:0,y:128,z:-15},{x:-89,y:22,z:-15},{x:-89,y:-34,z:-15},{x:-98,y:-32,z:-26},{x:-98,y:12,z:-26},{x:-79,y:12,z:-26},{x:-79,y:-32,z:-26},{x:-15,y:-49,z:-13},{x:0,y:-140,z:-15},{x:-6,y:-136,z:-18},{x:-2,y:-113,z:-10},{x:-63,y:-125,z:-25},{x:-61,y:-112,z:-25},{x:-22,y:-53,z:-26},{x:0,y:99,z:-12},{x:-8,y:74,z:-1},{x:0,y:87,z:0},{x:0,y:-9,z:-7},{x:-18,y:-9,z:-14},{x:-27,y:-10,z:-30},{x:0,y:-123,z:30},{x:0,y:-131,z:30},{x:9,y:90,z:-15},{x:0,y:99,z:-12},{x:0,y:34,z:-4},{x:12,y:60,z:-4},{x:-9,y:90,z:-15},{x:-12,y:60,z:-4}];

    var 
    fcs:Array = new Array();//the triangle faces and their vertex id's
    fcs = [[3,2,38],[38,1,3],[0,3,4],[4,5,0],[7,6,8],[8,9,7],[7,9,10],[10,30,7],[10,28,27],[27,30,10],[12,35,52],[52,11,12],[13,14,15],[15,16,13],[14,13,17],[17,18,14],[20,19,60],[60,22,20],[23,24,25],[25,26,23],[11,52,66],[66,27,11],[28,12,11],[11,27,28],[27,66,68],[68,31,27],[30,29,6],[6,7,30],[69,19,20],[20,32,69],[20,21,33],[33,32,20],[24,23,72],[72,73,24],[30,31,34],[34,29,30],[36,1,38],[38,37,36],[39,41,40],[40,36,39],[42,45,44],[44,43,42],[42,47,46],[46,45,42],[46,47,49],[49,48,46],[51,50,52],[52,35,51],[53,56,55],[55,54,53],[54,58,57],[57,53,54],[59,61,60],[60,19,59],[23,64,63],[63,62,23],[50,49,66],[66,52,50],[48,49,50],[50,51,48],[49,67,68],[68,66,49],[47,42,43],[43,29,47],[69,70,59],[59,19,69],[59,70,71],[71,65,59],[62,73,72],[72,23,62],[47,29,34],[34,67,47],[3,0,2],[21,20,22],[30,27,31],[34,31,68],[36,37,39],[65,61,59],[47,67,49],[34,68,67],[78,79,77],[77,74,78],[77,79,76],[78,74,75]];

    var 
    tVtx:Array = new Array();//the texture vertex positions {x,y}'s
    tVtx = [{x:0.543232,y:0.971973},{x:0.928999,y:0.971975},{x:0.938606,y:0.730914},{x:0.58145,y:0.730301},{x:0.973394,y:0.232302},{x:0.830266,y:0.262219},{x:0.689343,y:0.618487},{x:0.03224,y:0.0179053},{x:0.0427658,y:0.265735},{x:0.155986,y:0.25897},{x:0.1771,y:0.07012},{x:0.0937724,y:0.344807},{x:0.240765,y:0.297882},{x:0.250644,y:0.516723},{x:0.191134,y:0.643475},{x:0.337008,y:0.762054},{x:0.31295,y:0.747924},{x:0.273677,y:0.838889},{x:0.337009,y:0.868649},{x:0.969354,y:0.199225},{x:0.688933,y:0.199213},{x:0.627362,y:0.110146},{x:0.984541,y:0.110145},{x:0.688933,y:0.0228288},{x:0.969354,y:0.0228159},{x:0.367614,y:0.890776},{x:0.416228,y:0.871678},{x:0.479322,y:0.284941},{x:0.367631,y:0.270632},{x:0.0676327,y:0.54325},{x:0.0224356,y:0.607067},{x:0.112433,y:0.982561},{x:0.213288,y:0.856084},{x:0.337007,y:0.566789},{x:0.337006,y:0.461164},{x:0.279638,y:0.386058},{x:0.337006,y:0.120418},{x:0.501807,y:0.0170947},{x:0.36763,y:0.0138662},{x:0.621655,y:0.0363869},{x:0.573364,y:0.323514},{x:0.44281,y:0.983876},{x:0.466339,y:0.938112},{x:0.337006,y:0.29354},{x:0.543232,y:0.971973},{x:0.58145,y:0.730301},{x:0.938606,y:0.730914},{x:0.928999,y:0.971975},{x:0.973394,y:0.232302},{x:0.689343,y:0.618487},{x:0.830266,y:0.262219},{x:0.03224,y:0.0179053},{x:0.1771,y:0.07012},{x:0.155988,y:0.25897},{x:0.0427658,y:0.265735},{x:0.0937724,y:0.344807},{x:0.240767,y:0.297882},{x:0.250644,y:0.516723},{x:0.191134,y:0.643475},{x:0.337008,y:0.762054},{x:0.337009,y:0.868649},{x:0.273677,y:0.838889},{x:0.312947,y:0.747926},{x:0.969354,y:0.199225},{x:0.984541,y:0.110145},{x:0.627362,y:0.110146},{x:0.688933,y:0.199213},{x:0.688933,y:0.0228288},{x:0.969354,y:0.0228159},{x:0.367614,y:0.890776},{x:0.367631,y:0.270632},{x:0.479331,y:0.284942},{x:0.416228,y:0.871678},{x:0.0676327,y:0.54325},{x:0.213288,y:0.856084},{x:0.112433,y:0.982561},{x:0.0224356,y:0.607067},{x:0.337007,y:0.566789},{x:0.337006,y:0.461164},{x:0.279638,y:0.386058},{x:0.337006,y:0.120418},{x:0.36763,y:0.0138662},{x:0.501807,y:0.0170947},{x:0.621655,y:0.0363869},{x:0.573364,y:0.323514},{x:0.44281,y:0.983876},{x:0.466339,y:0.938112},{x:0.337006,y:0.29354},{x:0.609371,y:0.525416},{x:0.657645,y:0.571343},{x:0.65328,y:0.234636},{x:0.589112,y:0.371206},{x:0.704713,y:0.52418},{x:0.720967,y:0.369496}];

    var 
    tFcs:Array = new Array();//the texture faces and their texture vertex id's
    tFcs = [[2,3,0],[0,1,2],[6,2,4],[4,5,6],[9,10,7],[7,8,9],[9,8,11],[11,12,9],[11,14,13],[13,12,11],[17,18,15],[15,16,17],[21,22,19],[19,20,21],[22,21,23],[23,24,22],[27,28,25],[25,26,27],[31,32,29],[29,30,31],[16,15,33],[33,13,16],[14,17,16],[16,13,14],[13,33,34],[34,35,13],[12,36,10],[10,9,12],[38,28,27],[27,37,38],[27,40,39],[39,37,27],[32,31,41],[41,42,32],[12,35,43],[43,36,12],[46,47,44],[44,45,46],[49,50,48],[48,46,49],[53,54,51],[51,52,53],[53,56,55],[55,54,53],[55,56,57],[57,58,55],[61,62,59],[59,60,61],[65,66,63],[63,64,65],[64,68,67],[67,65,64],[71,72,69],[69,70,71],[75,76,73],[73,74,75],[62,57,77],[77,59,62],[58,57,62],[62,61,58],[57,79,78],[78,77,57],[56,53,52],[52,80,56],[81,82,71],[71,70,81],[71,82,83],[83,84,71],[74,86,85],[85,75,74],[56,80,87],[87,79,56],[2,6,3],[40,27,26],[12,13,35],[43,35,34],[46,45,49],[84,72,71],[56,79,57],[87,78,79],[92,93,91],[91,88,92],[91,93,90],[92,88,89]]; 
    more primitives to come

  8. #8
    Member
    Join Date
    Dec 2007
    Posts
    58
    this is epic
    thank you so much
    I am working in flash 8, and probably will be here for quite a while longer.
    I am working on a few small projects, leading up to making a turn-based strategy game. I dont need much, in fact I may just use prerendered screen, but I have been considering a 3d map with sprites
    I never have wanted to make a 3d engine,I would rather focus on stories and characters, this I will step through and study, so I have a better idea of how they work
    thank you for the knowledge, I am enlightened

  9. #9
    Custom User Title Incrue's Avatar
    Join Date
    Feb 2004
    Posts
    974
    Good.I supose you will rewrite some parts when f10 cames out with native ways to do backface culling, shaders, things like that?

  10. #10
    Senior Member
    Join Date
    May 2003
    Location
    Austria
    Posts
    146
    Great post! Especially the section "3d modeling software and links" is very useful for me. Hope to get started with Blender soon in order to create my own
    models.

    I am currently working on a simple 3d engine as well, because I have always been interested in the whole 3d stuff.

    I am quite interested in your texture mapping / depth sorting system. It seems every Flash 3d engine uses the beginBitmapFill approach to texturize the polygons. Have you encountered any problems with the z - sortting?

    I am asking, because there might be some situations (two overlapping polygons) where this approach could lead to false results.

  11. #11
    Ich lerne jede Tag etwas Neues Evaman's Avatar
    Join Date
    Nov 2006
    Location
    Die Welt
    Posts
    236
    Bookmarked as well.

    When I clear and feel satisfied with my finishing work I would like to get back into 3D and AS3 related stuff.

    render, erstaunliches Angebot

  12. #12
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,928
    Really good work.

    I've always avoided posting to your previous 3D engine threads as I felt without an end result ( A game or an actual engine ) they were slightly self indulgent and were better suited to a blog.

    This on the other hand, is great

    Squize.

  13. #13
    Senior Member Sietjp's Avatar
    Join Date
    Jan 2005
    Location
    Paris, France
    Posts
    711
    Wow, this is exactly the kind of engine a game dev needs to be able to adapt it to his/her needs. Thanks a lot render!

  14. #14
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    thanks again
    Quote Originally Posted by andreaskrenmair
    .. am quite interested in your texture mapping / depth sorting system. It seems every Flash 3d engine uses the beginBitmapFill approach to texturize the polygons. Have you encountered any problems with the z - sortting?

    I am asking, because there might be some situations (two overlapping polygons) where this approach could lead to false results.
    it is not accurate in fact it is sloppy but its a fast approach. There is this classic dilemma

    in which case you cant tell by the centroid (the center of each face) which shape or which part of the shape is in front of you (each face is a little bit angled so they can be placed together).
    in order to solve this you would have to devide the faces and sort those sub parts. A rather complicated matter and propably a little bit CPU consuming. If I am not mistaken, Away3d (flash engien) got this very well solved even complicated clipping stuff like when 2 faces intersect into each other but that requires alot of math.

    Quote Originally Posted by incrue
    Good.I supose you will rewrite some parts when f10 cames out with native ways to do backface culling, shaders, things like that?
    I could add a AS3 version which should be alot faster (perhaps 6 - 10 times faster) but with basicly the same code.
    I am not sure if I will get that deep into Flash10 as soon as possible because recently I quite hate Adobe for pissing on us europeans with their prices and restrictions.


    I should mention that with the UV mapping there can be much more done than just 3d. Just as a hint:
    http://www.soldat.pl/screens.html
    uses flat 2d polygons with textures and vertex blending to render the worlds. Things like these and other approaches are things I would be interested to see comming.
    The big advantage you have with this texture mapping is that you can better reuse texture space and re-apply it on other surfaces. Graphics for a whole levels could be stored in a sprite or texture sheet and the shapes would pick their part they need out of that image. This would save a lot of bandwith and update or maintain time.

  15. #15
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    here are a few primitive shapes with unique texture space. This means that no triangle shares the pixel space another triangle does, each face can be texturized thus unique.

    a OBJ export download is available here (for reference):
    http://www.renderhjs.net/bbs/flashki...primitives.obj

    the arrays for those are:
    turos knot
    PHP Code:
    var vtx:Array = new Array();//the vertex positions {x,y,z}'s
    vtx = [{x:303,y:-98,z:49},{x:303,y:-98,z:51},{x:305,y:-98,z:49},{x:295,y:-119,z:49},{x:295,y:-119,z:51},{x:296,y:-120,z:49},{x:274,y:-127,z:49},{x:274,y:-127,z:51},{x:274,y:-129,z:49},{x:253,y:-119,z:49},{x:254,y:-119,z:51},{x:253,y:-120,z:49},{x:246,y:-98,z:49},{x:246,y:-98,z:51},{x:244,y:-98,z:49},{x:254,y:-78,z:49},{x:254,y:-78,z:51},{x:253,y:-76,z:49},{x:274,y:-69,z:49},{x:274,y:-69,z:51},{x:274,y:-67,z:49},{x:295,y:-78,z:49},{x:295,y:-78,z:51},{x:296,y:-76,z:49},{x:313,y:-98,z:33},{x:316,y:-98,z:18},{x:302,y:-125,z:33},{x:304,y:-128,z:18},{x:274,y:-136,z:33},{x:274,y:-140,z:18},{x:247,y:-125,z:33},{x:245,y:-128,z:18},{x:236,y:-98,z:33},{x:233,y:-98,z:18},{x:247,y:-71,z:33},{x:245,y:-69,z:18},{x:274,y:-60,z:33},{x:274,y:-57,z:18},{x:302,y:-71,z:33},{x:304,y:-69,z:18},{x:311,y:-98,z:7},{x:305,y:-98,z:3},{x:300,y:-124,z:7},{x:296,y:-120,z:3},{x:274,y:-134,z:7},{x:274,y:-129,z:3},{x:249,y:-124,z:7},{x:253,y:-120,z:3},{x:238,y:-98,z:7},{x:244,y:-98,z:3},{x:249,y:-73,z:7},{x:253,y:-76,z:3},{x:274,y:-62,z:7},{x:274,y:-67,z:3},{x:300,y:-73,z:7},{x:296,y:-76,z:3},{x:301,y:-98,z:0},{x:274,y:-98,z:0},{x:293,y:-117,z:0},{x:274,y:-125,z:0},{x:256,y:-117,z:0},{x:248,y:-98,z:0},{x:256,y:-79,z:0},{x:274,y:-72,z:0},{x:293,y:-79,z:0},{x:241,y:-98,z:41},{x:225,y:-98,z:41},{x:219,y:-98,z:37},{x:242,y:-103,z:44},{x:222,y:-103,z:43},{x:216,y:-103,z:37},{x:244,y:-98,z:46},{x:220,y:-98,z:45},{x:213,y:-98,z:37},{x:242,y:-94,z:44},{x:222,y:-94,z:43},{x:216,y:-94,z:37},{x:222,y:-98,z:27},{x:233,y:-98,z:18},{x:220,y:-103,z:25},{x:234,y:-103,z:15},{x:218,y:-98,z:23},{x:235,y:-98,z:12},{x:220,y:-94,z:25},{x:234,y:-94,z:15},{x:310,y:-98,z:29},{x:324,y:-98,z:37},{x:330,y:-98,z:49},{x:310,y:-108,z:20},{x:327,y:-105,z:33},{x:336,y:-102,z:49},{x:310,y:-98,z:12},{x:330,y:-98,z:29},{x:343,y:-98,z:49},{x:310,y:-88,z:20},{x:327,y:-91,z:33},{x:336,y:-94,z:49},{x:333,y:-98,z:50},{x:332,y:-98,z:49},{x:339,y:-101,z:50},{x:336,y:-101,z:49},{x:345,y:-98,z:51},{x:341,y:-98,z:49},{x:339,y:-95,z:50},{x:336,y:-96,z:49},{x:274,y:-98,z:65},{x:281,y:-98,z:61},{x:279,y:-98,z:55},{x:279,y:-103,z:61},{x:277,y:-101,z:55},{x:274,y:-105,z:61},{x:274,y:-102,z:55},{x:270,y:-103,z:61},{x:272,y:-101,z:55},{x:268,y:-98,z:61},{x:270,y:-98,z:55},{x:270,y:-94,z:61},{x:272,y:-95,z:55},{x:274,y:-92,z:61},{x:274,y:-94,z:55},{x:279,y:-94,z:61},{x:277,y:-95,z:55},{x:292,y:-98,z:52},{x:301,y:-98,z:49},{x:287,y:-110,z:52},{x:294,y:-117,z:49},{x:274,y:-115,z:52},{x:274,y:-125,z:49},{x:262,y:-110,z:52},{x:255,y:-117,z:49},{x:257,y:-98,z:52},{x:248,y:-98,z:49},{x:262,y:-86,z:52},{x:255,y:-79,z:49},{x:274,y:-81,z:52},{x:274,y:-71,z:49},{x:287,y:-86,z:52},{x:294,y:-79,z:49}];

    var 
    fcs:Array = new Array();//the triangle faces and their vertex id's
    fcs = [[4,1,0],[0,3,4],[5,2,1],[1,4,5],[7,4,3],[3,6,7],[8,5,4],[4,7,8],[10,7,6],[6,9,10],[11,8,7],[7,10,11],[13,10,9],[9,12,13],[14,11,10],[10,13,14],[16,13,12],[12,15,16],[17,14,13],[13,16,17],[19,16,15],[15,18,19],[20,17,16],[16,19,20],[22,19,18],[18,21,22],[23,20,19],[19,22,23],[1,22,21],[21,0,1],[2,23,22],[22,1,2],[26,24,2],[2,5,26],[27,25,24],[24,26,27],[28,26,5],[5,8,28],[29,27,26],[26,28,29],[30,28,8],[8,11,30],[31,29,28],[28,30,31],[32,30,11],[11,14,32],[33,31,30],[30,32,33],[34,32,14],[14,17,34],[35,33,32],[32,34,35],[36,34,17],[17,20,36],[37,35,34],[34,36,37],[38,36,20],[20,23,38],[39,37,36],[36,38,39],[24,38,23],[23,2,24],[25,39,38],[38,24,25],[42,40,25],[25,27,42],[43,41,40],[40,42,43],[44,42,27],[27,29,44],[45,43,42],[42,44,45],[46,44,29],[29,31,46],[47,45,44],[44,46,47],[48,46,31],[31,33,48],[49,47,46],[46,48,49],[50,48,33],[33,35,50],[51,49,48],[48,50,51],[52,50,35],[35,37,52],[53,51,50],[50,52,53],[54,52,37],[37,39,54],[55,53,52],[52,54,55],[40,54,39],[39,25,40],[41,55,54],[54,40,41],[58,56,41],[41,43,58],[59,58,43],[43,45,59],[60,59,45],[45,47,60],[61,60,47],[47,49,61],[62,61,49],[49,51,62],[63,62,51],[51,53,63],[64,63,53],[53,55,64],[56,64,55],[55,41,56],[69,66,65],[65,68,69],[70,67,66],[66,69,70],[72,69,68],[68,71,72],[73,70,69],[69,72,73],[75,72,71],[71,74,75],[76,73,72],[72,75,76],[66,75,74],[74,65,66],[67,76,75],[75,66,67],[79,77,67],[67,70,79],[80,78,77],[77,79,80],[81,79,70],[70,73,81],[82,80,79],[79,81,82],[83,81,73],[73,76,83],[84,82,81],[81,83,84],[77,83,76],[76,67,77],[78,84,83],[83,77,78],[89,86,85],[85,88,89],[90,87,86],[86,89,90],[92,89,88],[88,91,92],[93,90,89],[89,92,93],[95,92,91],[91,94,95],[96,93,92],[92,95,96],[86,95,94],[94,85,86],[87,96,95],[95,86,87],[99,97,87],[87,90,99],[100,98,97],[97,99,100],[101,99,90],[90,93,101],[102,100,99],[99,101,102],[103,101,93],[93,96,103],[104,102,101],[101,103,104],[97,103,96],[96,87,97],[98,104,103],[103,97,98],[109,107,106],[106,108,109],[111,109,108],[108,110,111],[113,111,110],[110,112,113],[115,113,112],[112,114,115],[117,115,114],[114,116,117],[119,117,116],[116,118,119],[121,119,118],[118,120,121],[107,121,120],[120,106,107],[124,122,107],[107,109,124],[125,123,122],[122,124,125],[126,124,109],[109,111,126],[127,125,124],[124,126,127],[128,126,111],[111,113,128],[129,127,126],[126,128,129],[130,128,113],[113,115,130],[131,129,128],[128,130,131],[132,130,115],[115,117,132],[133,131,130],[130,132,133],[134,132,117],[117,119,134],[135,133,132],[132,134,135],[136,134,119],[119,121,136],[137,135,134],[134,136,137],[122,136,121],[121,107,122],[123,137,136],[136,122,123],[56,58,57],[58,59,57],[59,60,57],[60,61,57],[61,62,57],[62,63,57],[63,64,57],[64,56,57],[108,106,105],[110,108,105],[112,110,105],[114,112,105],[116,114,105],[118,116,105],[120,118,105],[106,120,105]];

    var 
    tVtx:Array = new Array();//the texture vertex positions {x,y}'s
    tVtx = [{x:0.198497,y:0.0550303},{x:0.110519,y:0.016835},{x:0.105427,y:0.0241761},{x:0.194323,y:0.0630956},{x:0.0929924,y:0.0324214},{x:0.186461,y:0.0739301},{x:0.883826,y:0.0174792},{x:0.795803,y:0.0554336},{x:0.799868,y:0.0635062},{x:0.888867,y:0.0248423},{x:0.807593,y:0.074351},{x:0.901222,y:0.0331247},{x:0.69728,y:0.0779688},{x:0.701382,y:0.0864276},{x:0.706079,y:0.0983266},{x:0.598652,y:0.0907579},{x:0.599847,y:0.0996388},{x:0.601922,y:0.112245},{x:0.496815,y:0.0951132},{x:0.496826,y:0.104155},{x:0.496846,y:0.117027},{x:0.394932,y:0.090584},{x:0.393798,y:0.099529},{x:0.391807,y:0.11217},{x:0.294733,y:0.0775015},{x:0.292272,y:0.0861731},{x:0.287776,y:0.0982271},{x:0.044208,y:0.0981691},{x:0.157177,y:0.142753},{x:0.0150022,y:0.168018},{x:0.139783,y:0.20326},{x:0.836657,y:0.143242},{x:0.949774,y:0.098994},{x:0.853911,y:0.203788},{x:0.978789,y:0.16889},{x:0.723046,y:0.171016},{x:0.734831,y:0.233378},{x:0.609959,y:0.186891},{x:0.616038,y:0.251064},{x:0.49683,y:0.192308},{x:0.496798,y:0.256913},{x:0.383721,y:0.186822},{x:0.377562,y:0.25098},{x:0.270679,y:0.170844},{x:0.258786,y:0.233157},{x:0.017185,y:0.227219},{x:0.134034,y:0.251402},{x:0.0241552,y:0.260003},{x:0.131195,y:0.280345},{x:0.859558,y:0.251944},{x:0.976465,y:0.228068},{x:0.862334,y:0.280893},{x:0.969417,y:0.26083},{x:0.741446,y:0.28063},{x:0.745403,y:0.308331},{x:0.619975,y:0.298964},{x:0.622321,y:0.32674},{x:0.496768,y:0.304974},{x:0.496751,y:0.332831},{x:0.373558,y:0.298863},{x:0.371176,y:0.326628},{x:0.252093,y:0.280372},{x:0.248091,y:0.308055},{x:0.797004,y:0.533022},{x:0.744977,y:0.405735},{x:0.72512,y:0.425594},{x:0.769008,y:0.533022},{x:0.617692,y:0.353709},{x:0.617692,y:0.381705},{x:0.490406,y:0.405735},{x:0.510264,y:0.425594},{x:0.438379,y:0.533022},{x:0.466376,y:0.533022},{x:0.490406,y:0.660308},{x:0.510264,y:0.640449},{x:0.617692,y:0.712335},{x:0.617692,y:0.684338},{x:0.744977,y:0.660308},{x:0.72512,y:0.640449},{x:0.152245,y:0.316155},{x:0.12162,y:0.306152},{x:0.119108,y:0.420695},{x:0.149555,y:0.416932},{x:0.116808,y:0.473127},{x:0.146519,y:0.469381},{x:0.0883007,y:0.296631},{x:0.089026,y:0.424564},{x:0.0893182,y:0.476378},{x:0.0550923,y:0.306527},{x:0.0589002,y:0.421034},{x:0.0617929,y:0.473435},{x:0.0245827,y:0.316876},{x:0.0284134,y:0.417614},{x:0.0320396,y:0.470021},{x:0.11976,y:0.542442},{x:0.149934,y:0.536899},{x:0.122448,y:0.642709},{x:0.1515,y:0.623917},{x:0.0897086,y:0.546895},{x:0.0903332,y:0.660696},{x:0.0596091,y:0.542776},{x:0.0580235,y:0.643066},{x:0.0293744,y:0.537568},{x:0.0287671,y:0.624596},{x:0.312725,y:0.420848},{x:0.244952,y:0.39187},{x:0.260439,y:0.514099},{x:0.312343,y:0.516514},{x:0.279567,y:0.620157},{x:0.312012,y:0.598929},{x:0.170417,y:0.378913},{x:0.21215,y:0.524258},{x:0.251403,y:0.650214},{x:0.455365,y:0.380054},{x:0.380729,y:0.392415},{x:0.364265,y:0.514515},{x:0.412472,y:0.525062},{x:0.344285,y:0.620416},{x:0.372206,y:0.650699},{x:0.276608,y:0.637315},{x:0.311949,y:0.614229},{x:0.293771,y:0.635391},{x:0.311933,y:0.618284},{x:0.251465,y:0.668094},{x:0.278267,y:0.65806},{x:0.347106,y:0.637595},{x:0.372,y:0.668576},{x:0.329958,y:0.635534},{x:0.345279,y:0.658327},{x:0.170752,y:0.810199},{x:0.157308,y:0.83642},{x:0.191924,y:0.847676},{x:0.200178,y:0.831549},{x:0.336308,y:0.836754},{x:0.323045,y:0.810414},{x:0.29349,y:0.831586},{x:0.301609,y:0.847749},{x:0.302348,y:0.789366},{x:0.280822,y:0.818718},{x:0.276055,y:0.775956},{x:0.264737,y:0.810506},{x:0.246929,y:0.771219},{x:0.246905,y:0.807619},{x:0.217808,y:0.775927},{x:0.229058,y:0.810499},{x:0.191509,y:0.789269},{x:0.212933,y:0.818697},{x:0.848907,y:0.828307},{x:0.842599,y:0.84376},{x:0.896274,y:0.897436},{x:0.924525,y:0.828307},{x:0.937814,y:0.938975},{x:0.983055,y:0.828307},{x:0.827146,y:0.850068},{x:0.827146,y:0.925686},{x:0.827146,y:0.984216},{x:0.811692,y:0.843761},{x:0.758016,y:0.897436},{x:0.716477,y:0.938976},{x:0.805385,y:0.828307},{x:0.729767,y:0.828307},{x:0.671236,y:0.828307},{x:0.811692,y:0.812854},{x:0.758016,y:0.759179},{x:0.716477,y:0.717639},{x:0.827146,y:0.806547},{x:0.827146,y:0.730928},{x:0.827146,y:0.672399},{x:0.842599,y:0.812854},{x:0.896274,y:0.759179},{x:0.937814,y:0.717639},{x:0.617692,y:0.533022},{x:0.130694,y:0.824137},{x:0.142897,y:0.794245},{x:0.100802,y:0.794245},{x:0.100802,y:0.83634},{x:0.0709107,y:0.824137},{x:0.0587079,y:0.794245},{x:0.0709107,y:0.764354},{x:0.100802,y:0.752151},{x:0.130694,y:0.764354}];

    var 
    tFcs:Array = new Array();//the texture faces and their texture vertex id's
    tFcs = [[2,3,0],[0,1,2],[4,5,3],[3,2,4],[8,9,6],[6,7,8],[10,11,9],[9,8,10],[13,8,7],[7,12,13],[14,10,8],[8,13,14],[16,13,12],[12,15,16],[17,14,13],[13,16,17],[19,16,15],[15,18,19],[20,17,16],[16,19,20],[22,19,18],[18,21,22],[23,20,19],[19,22,23],[25,22,21],[21,24,25],[26,23,22],[22,25,26],[3,25,24],[24,0,3],[5,26,25],[25,3,5],[27,28,5],[5,4,27],[29,30,28],[28,27,29],[31,32,11],[11,10,31],[33,34,32],[32,31,33],[35,31,10],[10,14,35],[36,33,31],[31,35,36],[37,35,14],[14,17,37],[38,36,35],[35,37,38],[39,37,17],[17,20,39],[40,38,37],[37,39,40],[41,39,20],[20,23,41],[42,40,39],[39,41,42],[43,41,23],[23,26,43],[44,42,41],[41,43,44],[28,43,26],[26,5,28],[30,44,43],[43,28,30],[45,46,30],[30,29,45],[47,48,46],[46,45,47],[49,50,34],[34,33,49],[51,52,50],[50,49,51],[53,49,33],[33,36,53],[54,51,49],[49,53,54],[55,53,36],[36,38,55],[56,54,53],[53,55,56],[57,55,38],[38,40,57],[58,56,55],[55,57,58],[59,57,40],[40,42,59],[60,58,57],[57,59,60],[61,59,42],[42,44,61],[62,60,59],[59,61,62],[46,61,44],[44,30,46],[48,62,61],[61,46,48],[65,66,63],[63,64,65],[68,65,64],[64,67,68],[70,68,67],[67,69,70],[72,70,69],[69,71,72],[74,72,71],[71,73,74],[76,74,73],[73,75,76],[78,76,75],[75,77,78],[66,78,77],[77,63,66],[81,82,79],[79,80,81],[83,84,82],[82,81,83],[86,81,80],[80,85,86],[87,83,81],[81,86,87],[89,86,85],[85,88,89],[90,87,86],[86,89,90],[92,89,88],[88,91,92],[93,90,89],[89,92,93],[94,95,84],[84,83,94],[96,97,95],[95,94,96],[98,94,83],[83,87,98],[99,96,94],[94,98,99],[100,98,87],[87,90,100],[101,99,98],[98,100,101],[102,100,90],[90,93,102],[103,101,100],[100,102,103],[106,107,104],[104,105,106],[108,109,107],[107,106,108],[111,106,105],[105,110,111],[112,108,106],[106,111,112],[115,116,113],[113,114,115],[117,118,116],[116,115,117],[107,115,114],[114,104,107],[109,117,115],[115,107,109],[119,120,109],[109,108,119],[121,122,120],[120,119,121],[123,119,108],[108,112,123],[124,121,119],[119,123,124],[125,126,118],[118,117,125],[127,128,126],[126,125,127],[120,125,117],[117,109,120],[122,127,125],[125,120,122],[131,132,129],[129,130,131],[135,136,133],[133,134,135],[138,135,134],[134,137,138],[140,138,137],[137,139,140],[142,140,139],[139,141,142],[144,142,141],[141,143,144],[146,144,143],[143,145,146],[132,146,145],[145,129,132],[149,150,147],[147,148,149],[151,152,150],[150,149,151],[154,149,148],[148,153,154],[155,151,149],[149,154,155],[157,154,153],[153,156,157],[158,155,154],[154,157,158],[160,157,156],[156,159,160],[161,158,157],[157,160,161],[163,160,159],[159,162,163],[164,161,160],[160,163,164],[166,163,162],[162,165,166],[167,164,163],[163,166,167],[169,166,165],[165,168,169],[170,167,166],[166,169,170],[150,169,168],[168,147,150],[152,170,169],[169,150,152],[66,65,171],[65,68,171],[68,70,171],[70,72,171],[72,74,171],[74,76,171],[76,78,171],[78,66,171],[172,173,174],[175,172,174],[176,175,174],[177,176,174],[178,177,174],[179,178,174],[180,179,174],[173,180,174]]; 

  16. #16
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    ring
    PHP Code:
    var vtx:Array = new Array();//the vertex positions {x,y,z}'s
    vtx = [{x:106,y:-47,z:0},{x:106,y:-51,z:6},{x:106,y:-59,z:6},{x:106,y:-63,z:0},{x:106,y:-59,z:-6},{x:106,y:-51,z:-6},{x:135,y:-59,z:0},{x:132,y:-62,z:6},{x:126,y:-68,z:6},{x:123,y:-70,z:0},{x:126,y:-68,z:-6},{x:132,y:-62,z:-6},{x:146,y:-87,z:0},{x:142,y:-87,z:6},{x:134,y:-87,z:6},{x:130,y:-87,z:0},{x:134,y:-87,z:-6},{x:142,y:-87,z:-6},{x:135,y:-116,z:0},{x:132,y:-113,z:6},{x:126,y:-107,z:6},{x:123,y:-104,z:0},{x:126,y:-107,z:-6},{x:132,y:-113,z:-6},{x:106,y:-127,z:0},{x:106,y:-123,z:6},{x:106,y:-115,z:6},{x:106,y:-111,z:0},{x:106,y:-115,z:-6},{x:106,y:-123,z:-6},{x:78,y:-116,z:0},{x:81,y:-113,z:6},{x:86,y:-107,z:6},{x:89,y:-104,z:0},{x:86,y:-107,z:-6},{x:81,y:-113,z:-6},{x:66,y:-87,z:0},{x:70,y:-87,z:6},{x:78,y:-87,z:6},{x:82,y:-87,z:0},{x:78,y:-87,z:-6},{x:70,y:-87,z:-6},{x:78,y:-59,z:0},{x:81,y:-62,z:6},{x:86,y:-68,z:6},{x:89,y:-70,z:0},{x:86,y:-68,z:-6},{x:81,y:-62,z:-6}];

    var 
    fcs:Array = new Array();//the triangle faces and their vertex id's
    fcs = [[0,1,7],[7,6,0],[1,2,8],[8,7,1],[2,3,9],[9,8,2],[3,4,10],[10,9,3],[4,5,11],[11,10,4],[5,0,6],[6,11,5],[6,7,13],[13,12,6],[7,8,14],[14,13,7],[8,9,15],[15,14,8],[9,10,16],[16,15,9],[10,11,17],[17,16,10],[11,6,12],[12,17,11],[12,13,19],[19,18,12],[13,14,20],[20,19,13],[14,15,21],[21,20,14],[15,16,22],[22,21,15],[16,17,23],[23,22,16],[17,12,18],[18,23,17],[18,19,25],[25,24,18],[19,20,26],[26,25,19],[20,21,27],[27,26,20],[21,22,28],[28,27,21],[22,23,29],[29,28,22],[23,18,24],[24,29,23],[24,25,31],[31,30,24],[25,26,32],[32,31,25],[26,27,33],[33,32,26],[27,28,34],[34,33,27],[28,29,35],[35,34,28],[29,24,30],[30,35,29],[30,31,37],[37,36,30],[31,32,38],[38,37,31],[32,33,39],[39,38,32],[33,34,40],[40,39,33],[34,35,41],[41,40,34],[35,30,36],[36,41,35],[36,37,43],[43,42,36],[37,38,44],[44,43,37],[38,39,45],[45,44,38],[39,40,46],[46,45,39],[40,41,47],[47,46,40],[41,36,42],[42,47,41],[42,43,1],[1,0,42],[43,44,2],[2,1,43],[44,45,3],[3,2,44],[45,46,4],[4,3,45],[46,47,5],[5,4,46],[47,42,0],[0,5,47]];

    var 
    tVtx:Array = new Array();//the texture vertex positions {x,y}'s
    tVtx = [{x:1.00185,y:0.616094},{x:1.00185,y:0.576781},{x:1.00185,y:0.537468},{x:1.00185,y:0.498154},{x:1.00185,y:0.458841},{x:1.00185,y:0.419528},{x:1.00185,y:0.380214},{x:0.877307,y:0.616094},{x:0.877307,y:0.576781},{x:0.877307,y:0.537468},{x:0.877307,y:0.498154},{x:0.877307,y:0.458841},{x:0.877307,y:0.419528},{x:0.877307,y:0.380214},{x:0.752769,y:0.616094},{x:0.752769,y:0.576781},{x:0.752769,y:0.537468},{x:0.752769,y:0.498154},{x:0.752769,y:0.458841},{x:0.752769,y:0.419528},{x:0.752769,y:0.380214},{x:0.62823,y:0.616094},{x:0.62823,y:0.576781},{x:0.62823,y:0.537468},{x:0.62823,y:0.498154},{x:0.62823,y:0.458841},{x:0.62823,y:0.419528},{x:0.62823,y:0.380214},{x:0.503691,y:0.616094},{x:0.503691,y:0.576781},{x:0.503691,y:0.537468},{x:0.503691,y:0.498154},{x:0.503691,y:0.458841},{x:0.503691,y:0.419528},{x:0.503691,y:0.380214},{x:0.379153,y:0.616094},{x:0.379153,y:0.576781},{x:0.379153,y:0.537468},{x:0.379153,y:0.498154},{x:0.379153,y:0.458841},{x:0.379153,y:0.419528},{x:0.379153,y:0.380214},{x:0.254615,y:0.616095},{x:0.254615,y:0.576781},{x:0.254615,y:0.537468},{x:0.254615,y:0.498154},{x:0.254615,y:0.458841},{x:0.254615,y:0.419528},{x:0.254615,y:0.380214},{x:0.130076,y:0.616095},{x:0.130076,y:0.576781},{x:0.130076,y:0.537468},{x:0.130076,y:0.498154},{x:0.130076,y:0.458841},{x:0.130076,y:0.419528},{x:0.130076,y:0.380214},{x:0.00553724,y:0.616095},{x:0.00553724,y:0.576781},{x:0.00553724,y:0.537468},{x:0.00553724,y:0.498154},{x:0.00553724,y:0.458841},{x:0.00553724,y:0.419528},{x:0.00553724,y:0.380214}];

    var 
    tFcs:Array = new Array();//the texture faces and their texture vertex id's
    tFcs = [[0,1,8],[8,7,0],[1,2,9],[9,8,1],[2,3,10],[10,9,2],[3,4,11],[11,10,3],[4,5,12],[12,11,4],[5,6,13],[13,12,5],[7,8,15],[15,14,7],[8,9,16],[16,15,8],[9,10,17],[17,16,9],[10,11,18],[18,17,10],[11,12,19],[19,18,11],[12,13,20],[20,19,12],[14,15,22],[22,21,14],[15,16,23],[23,22,15],[16,17,24],[24,23,16],[17,18,25],[25,24,17],[18,19,26],[26,25,18],[19,20,27],[27,26,19],[21,22,29],[29,28,21],[22,23,30],[30,29,22],[23,24,31],[31,30,23],[24,25,32],[32,31,24],[25,26,33],[33,32,25],[26,27,34],[34,33,26],[28,29,36],[36,35,28],[29,30,37],[37,36,29],[30,31,38],[38,37,30],[31,32,39],[39,38,31],[32,33,40],[40,39,32],[33,34,41],[41,40,33],[35,36,43],[43,42,35],[36,37,44],[44,43,36],[37,38,45],[45,44,37],[38,39,46],[46,45,38],[39,40,47],[47,46,39],[40,41,48],[48,47,40],[42,43,50],[50,49,42],[43,44,51],[51,50,43],[44,45,52],[52,51,44],[45,46,53],[53,52,45],[46,47,54],[54,53,46],[47,48,55],[55,54,47],[49,50,57],[57,56,49],[50,51,58],[58,57,50],[51,52,59],[59,58,51],[52,53,60],[60,59,52],[53,54,61],[61,60,53],[54,55,62],[62,61,54]]; 
    Cylinder
    PHP Code:
    var vtx:Array = new Array();//the vertex positions {x,y,z}'s
    vtx = [{x:111,y:79,z:0},{x:101,y:102,z:0},{x:79,y:111,z:0},{x:56,y:102,z:0},{x:47,y:79,z:0},{x:56,y:57,z:0},{x:79,y:47,z:0},{x:101,y:57,z:0},{x:111,y:79,z:64},{x:101,y:102,z:64},{x:79,y:111,z:64},{x:56,y:102,z:64},{x:47,y:79,z:64},{x:56,y:57,z:64},{x:79,y:47,z:64},{x:101,y:57,z:64}];

    var 
    fcs:Array = new Array();//the triangle faces and their vertex id's
    fcs = [[0,1,9],[9,8,0],[1,2,10],[10,9,1],[2,3,11],[11,10,2],[3,4,12],[12,11,3],[4,5,13],[13,12,4],[5,6,14],[14,13,5],[6,7,15],[15,14,6],[7,0,8],[8,15,7],[6,5,4],[4,3,2],[2,1,0],[4,2,0],[6,4,0],[7,6,0],[9,10,11],[11,12,13],[13,14,15],[11,13,15],[9,11,15],[8,9,15]];

    var 
    tVtx:Array = new Array();//the texture vertex positions {x,y}'s
    tVtx = [{x:0.75,y:1.0},{x:0.875,y:1.0},{x:0.0,y:1.0},{x:0.125,y:1.0},{x:0.25,y:1.0},{x:0.375,y:1.0},{x:0.5,y:1.0},{x:0.625,y:1.0},{x:0.75,y:0.596085},{x:0.875,y:0.596085},{x:0.0,y:0.596085},{x:0.125,y:0.596085},{x:0.25,y:0.596085},{x:0.375,y:0.596085},{x:0.5,y:0.596085},{x:0.625,y:0.596085},{x:1.0,y:1.0},{x:1.0,y:0.596085},{x:0.918065,y:0.120283},{x:0.989688,y:0.293195},{x:0.918065,y:0.466107},{x:0.745153,y:0.53773},{x:0.572241,y:0.466107},{x:0.500618,y:0.293195},{x:0.572241,y:0.120283},{x:0.745153,y:0.04866},{x:0.244535,y:0.04866},{x:0.0716226,y:0.120283},{x:0.0,y:0.293195},{x:0.0716226,y:0.466107},{x:0.244535,y:0.53773},{x:0.417447,y:0.466107},{x:0.48907,y:0.293195},{x:0.417447,y:0.120283}];

    var 
    tFcs:Array = new Array();//the texture faces and their texture vertex id's
    tFcs = [[0,1,9],[9,8,0],[1,16,17],[17,9,1],[2,3,11],[11,10,2],[3,4,12],[12,11,3],[4,5,13],[13,12,4],[5,6,14],[14,13,5],[6,7,15],[15,14,6],[7,0,8],[8,15,7],[19,20,21],[21,22,23],[23,24,25],[21,23,25],[19,21,25],[18,19,25],[27,28,29],[29,30,31],[31,32,33],[29,31,33],[27,29,33],[26,27,33]]; 

  17. #17
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    teapot
    PHP Code:
    var vtx:Array = new Array();//the vertex positions {x,y,z}'s
    vtx = [{x:303,y:-98,z:49},{x:303,y:-98,z:51},{x:305,y:-98,z:49},{x:295,y:-119,z:49},{x:295,y:-119,z:51},{x:296,y:-120,z:49},{x:274,y:-127,z:49},{x:274,y:-127,z:51},{x:274,y:-129,z:49},{x:253,y:-119,z:49},{x:254,y:-119,z:51},{x:253,y:-120,z:49},{x:246,y:-98,z:49},{x:246,y:-98,z:51},{x:244,y:-98,z:49},{x:254,y:-78,z:49},{x:254,y:-78,z:51},{x:253,y:-76,z:49},{x:274,y:-69,z:49},{x:274,y:-69,z:51},{x:274,y:-67,z:49},{x:295,y:-78,z:49},{x:295,y:-78,z:51},{x:296,y:-76,z:49},{x:313,y:-98,z:33},{x:316,y:-98,z:18},{x:302,y:-125,z:33},{x:304,y:-128,z:18},{x:274,y:-136,z:33},{x:274,y:-140,z:18},{x:247,y:-125,z:33},{x:245,y:-128,z:18},{x:236,y:-98,z:33},{x:233,y:-98,z:18},{x:247,y:-71,z:33},{x:245,y:-69,z:18},{x:274,y:-60,z:33},{x:274,y:-57,z:18},{x:302,y:-71,z:33},{x:304,y:-69,z:18},{x:311,y:-98,z:7},{x:305,y:-98,z:3},{x:300,y:-124,z:7},{x:296,y:-120,z:3},{x:274,y:-134,z:7},{x:274,y:-129,z:3},{x:249,y:-124,z:7},{x:253,y:-120,z:3},{x:238,y:-98,z:7},{x:244,y:-98,z:3},{x:249,y:-73,z:7},{x:253,y:-76,z:3},{x:274,y:-62,z:7},{x:274,y:-67,z:3},{x:300,y:-73,z:7},{x:296,y:-76,z:3},{x:301,y:-98,z:0},{x:274,y:-98,z:0},{x:293,y:-117,z:0},{x:274,y:-125,z:0},{x:256,y:-117,z:0},{x:248,y:-98,z:0},{x:256,y:-79,z:0},{x:274,y:-72,z:0},{x:293,y:-79,z:0},{x:241,y:-98,z:41},{x:225,y:-98,z:41},{x:219,y:-98,z:37},{x:242,y:-103,z:44},{x:222,y:-103,z:43},{x:216,y:-103,z:37},{x:244,y:-98,z:46},{x:220,y:-98,z:45},{x:213,y:-98,z:37},{x:242,y:-94,z:44},{x:222,y:-94,z:43},{x:216,y:-94,z:37},{x:222,y:-98,z:27},{x:233,y:-98,z:18},{x:220,y:-103,z:25},{x:234,y:-103,z:15},{x:218,y:-98,z:23},{x:235,y:-98,z:12},{x:220,y:-94,z:25},{x:234,y:-94,z:15},{x:310,y:-98,z:29},{x:324,y:-98,z:37},{x:330,y:-98,z:49},{x:310,y:-108,z:20},{x:327,y:-105,z:33},{x:336,y:-102,z:49},{x:310,y:-98,z:12},{x:330,y:-98,z:29},{x:343,y:-98,z:49},{x:310,y:-88,z:20},{x:327,y:-91,z:33},{x:336,y:-94,z:49},{x:333,y:-98,z:50},{x:332,y:-98,z:49},{x:339,y:-101,z:50},{x:336,y:-101,z:49},{x:345,y:-98,z:51},{x:341,y:-98,z:49},{x:339,y:-95,z:50},{x:336,y:-96,z:49},{x:274,y:-98,z:65},{x:281,y:-98,z:61},{x:279,y:-98,z:55},{x:279,y:-103,z:61},{x:277,y:-101,z:55},{x:274,y:-105,z:61},{x:274,y:-102,z:55},{x:270,y:-103,z:61},{x:272,y:-101,z:55},{x:268,y:-98,z:61},{x:270,y:-98,z:55},{x:270,y:-94,z:61},{x:272,y:-95,z:55},{x:274,y:-92,z:61},{x:274,y:-94,z:55},{x:279,y:-94,z:61},{x:277,y:-95,z:55},{x:292,y:-98,z:52},{x:301,y:-98,z:49},{x:287,y:-110,z:52},{x:294,y:-117,z:49},{x:274,y:-115,z:52},{x:274,y:-125,z:49},{x:262,y:-110,z:52},{x:255,y:-117,z:49},{x:257,y:-98,z:52},{x:248,y:-98,z:49},{x:262,y:-86,z:52},{x:255,y:-79,z:49},{x:274,y:-81,z:52},{x:274,y:-71,z:49},{x:287,y:-86,z:52},{x:294,y:-79,z:49}];

    var 
    fcs:Array = new Array();//the triangle faces and their vertex id's
    fcs = [[4,1,0],[0,3,4],[5,2,1],[1,4,5],[7,4,3],[3,6,7],[8,5,4],[4,7,8],[10,7,6],[6,9,10],[11,8,7],[7,10,11],[13,10,9],[9,12,13],[14,11,10],[10,13,14],[16,13,12],[12,15,16],[17,14,13],[13,16,17],[19,16,15],[15,18,19],[20,17,16],[16,19,20],[22,19,18],[18,21,22],[23,20,19],[19,22,23],[1,22,21],[21,0,1],[2,23,22],[22,1,2],[26,24,2],[2,5,26],[27,25,24],[24,26,27],[28,26,5],[5,8,28],[29,27,26],[26,28,29],[30,28,8],[8,11,30],[31,29,28],[28,30,31],[32,30,11],[11,14,32],[33,31,30],[30,32,33],[34,32,14],[14,17,34],[35,33,32],[32,34,35],[36,34,17],[17,20,36],[37,35,34],[34,36,37],[38,36,20],[20,23,38],[39,37,36],[36,38,39],[24,38,23],[23,2,24],[25,39,38],[38,24,25],[42,40,25],[25,27,42],[43,41,40],[40,42,43],[44,42,27],[27,29,44],[45,43,42],[42,44,45],[46,44,29],[29,31,46],[47,45,44],[44,46,47],[48,46,31],[31,33,48],[49,47,46],[46,48,49],[50,48,33],[33,35,50],[51,49,48],[48,50,51],[52,50,35],[35,37,52],[53,51,50],[50,52,53],[54,52,37],[37,39,54],[55,53,52],[52,54,55],[40,54,39],[39,25,40],[41,55,54],[54,40,41],[58,56,41],[41,43,58],[59,58,43],[43,45,59],[60,59,45],[45,47,60],[61,60,47],[47,49,61],[62,61,49],[49,51,62],[63,62,51],[51,53,63],[64,63,53],[53,55,64],[56,64,55],[55,41,56],[69,66,65],[65,68,69],[70,67,66],[66,69,70],[72,69,68],[68,71,72],[73,70,69],[69,72,73],[75,72,71],[71,74,75],[76,73,72],[72,75,76],[66,75,74],[74,65,66],[67,76,75],[75,66,67],[79,77,67],[67,70,79],[80,78,77],[77,79,80],[81,79,70],[70,73,81],[82,80,79],[79,81,82],[83,81,73],[73,76,83],[84,82,81],[81,83,84],[77,83,76],[76,67,77],[78,84,83],[83,77,78],[89,86,85],[85,88,89],[90,87,86],[86,89,90],[92,89,88],[88,91,92],[93,90,89],[89,92,93],[95,92,91],[91,94,95],[96,93,92],[92,95,96],[86,95,94],[94,85,86],[87,96,95],[95,86,87],[99,97,87],[87,90,99],[100,98,97],[97,99,100],[101,99,90],[90,93,101],[102,100,99],[99,101,102],[103,101,93],[93,96,103],[104,102,101],[101,103,104],[97,103,96],[96,87,97],[98,104,103],[103,97,98],[109,107,106],[106,108,109],[111,109,108],[108,110,111],[113,111,110],[110,112,113],[115,113,112],[112,114,115],[117,115,114],[114,116,117],[119,117,116],[116,118,119],[121,119,118],[118,120,121],[107,121,120],[120,106,107],[124,122,107],[107,109,124],[125,123,122],[122,124,125],[126,124,109],[109,111,126],[127,125,124],[124,126,127],[128,126,111],[111,113,128],[129,127,126],[126,128,129],[130,128,113],[113,115,130],[131,129,128],[128,130,131],[132,130,115],[115,117,132],[133,131,130],[130,132,133],[134,132,117],[117,119,134],[135,133,132],[132,134,135],[136,134,119],[119,121,136],[137,135,134],[134,136,137],[122,136,121],[121,107,122],[123,137,136],[136,122,123],[56,58,57],[58,59,57],[59,60,57],[60,61,57],[61,62,57],[62,63,57],[63,64,57],[64,56,57],[108,106,105],[110,108,105],[112,110,105],[114,112,105],[116,114,105],[118,116,105],[120,118,105],[106,120,105]];

    var 
    tVtx:Array = new Array();//the texture vertex positions {x,y}'s
    tVtx = [{x:0.198497,y:0.0550303},{x:0.110519,y:0.016835},{x:0.105427,y:0.0241761},{x:0.194323,y:0.0630956},{x:0.0929924,y:0.0324214},{x:0.186461,y:0.0739301},{x:0.883826,y:0.0174792},{x:0.795803,y:0.0554336},{x:0.799868,y:0.0635062},{x:0.888867,y:0.0248423},{x:0.807593,y:0.074351},{x:0.901222,y:0.0331247},{x:0.69728,y:0.0779688},{x:0.701382,y:0.0864276},{x:0.706079,y:0.0983266},{x:0.598652,y:0.0907579},{x:0.599847,y:0.0996388},{x:0.601922,y:0.112245},{x:0.496815,y:0.0951132},{x:0.496826,y:0.104155},{x:0.496846,y:0.117027},{x:0.394932,y:0.090584},{x:0.393798,y:0.099529},{x:0.391807,y:0.11217},{x:0.294733,y:0.0775015},{x:0.292272,y:0.0861731},{x:0.287776,y:0.0982271},{x:0.044208,y:0.0981691},{x:0.157177,y:0.142753},{x:0.0150022,y:0.168018},{x:0.139783,y:0.20326},{x:0.836657,y:0.143242},{x:0.949774,y:0.098994},{x:0.853911,y:0.203788},{x:0.978789,y:0.16889},{x:0.723046,y:0.171016},{x:0.734831,y:0.233378},{x:0.609959,y:0.186891},{x:0.616038,y:0.251064},{x:0.49683,y:0.192308},{x:0.496798,y:0.256913},{x:0.383721,y:0.186822},{x:0.377562,y:0.25098},{x:0.270679,y:0.170844},{x:0.258786,y:0.233157},{x:0.017185,y:0.227219},{x:0.134034,y:0.251402},{x:0.0241552,y:0.260003},{x:0.131195,y:0.280345},{x:0.859558,y:0.251944},{x:0.976465,y:0.228068},{x:0.862334,y:0.280893},{x:0.969417,y:0.26083},{x:0.741446,y:0.28063},{x:0.745403,y:0.308331},{x:0.619975,y:0.298964},{x:0.622321,y:0.32674},{x:0.496768,y:0.304974},{x:0.496751,y:0.332831},{x:0.373558,y:0.298863},{x:0.371176,y:0.326628},{x:0.252093,y:0.280372},{x:0.248091,y:0.308055},{x:0.797004,y:0.533022},{x:0.744977,y:0.405735},{x:0.72512,y:0.425594},{x:0.769008,y:0.533022},{x:0.617692,y:0.353709},{x:0.617692,y:0.381705},{x:0.490406,y:0.405735},{x:0.510264,y:0.425594},{x:0.438379,y:0.533022},{x:0.466376,y:0.533022},{x:0.490406,y:0.660308},{x:0.510264,y:0.640449},{x:0.617692,y:0.712335},{x:0.617692,y:0.684338},{x:0.744977,y:0.660308},{x:0.72512,y:0.640449},{x:0.152245,y:0.316155},{x:0.12162,y:0.306152},{x:0.119108,y:0.420695},{x:0.149555,y:0.416932},{x:0.116808,y:0.473127},{x:0.146519,y:0.469381},{x:0.0883007,y:0.296631},{x:0.089026,y:0.424564},{x:0.0893182,y:0.476378},{x:0.0550923,y:0.306527},{x:0.0589002,y:0.421034},{x:0.0617929,y:0.473435},{x:0.0245827,y:0.316876},{x:0.0284134,y:0.417614},{x:0.0320396,y:0.470021},{x:0.11976,y:0.542442},{x:0.149934,y:0.536899},{x:0.122448,y:0.642709},{x:0.1515,y:0.623917},{x:0.0897086,y:0.546895},{x:0.0903332,y:0.660696},{x:0.0596091,y:0.542776},{x:0.0580235,y:0.643066},{x:0.0293744,y:0.537568},{x:0.0287671,y:0.624596},{x:0.312725,y:0.420848},{x:0.244952,y:0.39187},{x:0.260439,y:0.514099},{x:0.312343,y:0.516514},{x:0.279567,y:0.620157},{x:0.312012,y:0.598929},{x:0.170417,y:0.378913},{x:0.21215,y:0.524258},{x:0.251403,y:0.650214},{x:0.455365,y:0.380054},{x:0.380729,y:0.392415},{x:0.364265,y:0.514515},{x:0.412472,y:0.525062},{x:0.344285,y:0.620416},{x:0.372206,y:0.650699},{x:0.276608,y:0.637315},{x:0.311949,y:0.614229},{x:0.293771,y:0.635391},{x:0.311933,y:0.618284},{x:0.251465,y:0.668094},{x:0.278267,y:0.65806},{x:0.347106,y:0.637595},{x:0.372,y:0.668576},{x:0.329958,y:0.635534},{x:0.345279,y:0.658327},{x:0.170752,y:0.810199},{x:0.157308,y:0.83642},{x:0.191924,y:0.847676},{x:0.200178,y:0.831549},{x:0.336308,y:0.836754},{x:0.323045,y:0.810414},{x:0.29349,y:0.831586},{x:0.301609,y:0.847749},{x:0.302348,y:0.789366},{x:0.280822,y:0.818718},{x:0.276055,y:0.775956},{x:0.264737,y:0.810506},{x:0.246929,y:0.771219},{x:0.246905,y:0.807619},{x:0.217808,y:0.775927},{x:0.229058,y:0.810499},{x:0.191509,y:0.789269},{x:0.212933,y:0.818697},{x:0.848907,y:0.828307},{x:0.842599,y:0.84376},{x:0.896274,y:0.897436},{x:0.924525,y:0.828307},{x:0.937814,y:0.938975},{x:0.983055,y:0.828307},{x:0.827146,y:0.850068},{x:0.827146,y:0.925686},{x:0.827146,y:0.984216},{x:0.811692,y:0.843761},{x:0.758016,y:0.897436},{x:0.716477,y:0.938976},{x:0.805385,y:0.828307},{x:0.729767,y:0.828307},{x:0.671236,y:0.828307},{x:0.811692,y:0.812854},{x:0.758016,y:0.759179},{x:0.716477,y:0.717639},{x:0.827146,y:0.806547},{x:0.827146,y:0.730928},{x:0.827146,y:0.672399},{x:0.842599,y:0.812854},{x:0.896274,y:0.759179},{x:0.937814,y:0.717639},{x:0.617692,y:0.533022},{x:0.130694,y:0.824137},{x:0.142897,y:0.794245},{x:0.100802,y:0.794245},{x:0.100802,y:0.83634},{x:0.0709107,y:0.824137},{x:0.0587079,y:0.794245},{x:0.0709107,y:0.764354},{x:0.100802,y:0.752151},{x:0.130694,y:0.764354}];

    var 
    tFcs:Array = new Array();//the texture faces and their texture vertex id's
    tFcs = [[2,3,0],[0,1,2],[4,5,3],[3,2,4],[8,9,6],[6,7,8],[10,11,9],[9,8,10],[13,8,7],[7,12,13],[14,10,8],[8,13,14],[16,13,12],[12,15,16],[17,14,13],[13,16,17],[19,16,15],[15,18,19],[20,17,16],[16,19,20],[22,19,18],[18,21,22],[23,20,19],[19,22,23],[25,22,21],[21,24,25],[26,23,22],[22,25,26],[3,25,24],[24,0,3],[5,26,25],[25,3,5],[27,28,5],[5,4,27],[29,30,28],[28,27,29],[31,32,11],[11,10,31],[33,34,32],[32,31,33],[35,31,10],[10,14,35],[36,33,31],[31,35,36],[37,35,14],[14,17,37],[38,36,35],[35,37,38],[39,37,17],[17,20,39],[40,38,37],[37,39,40],[41,39,20],[20,23,41],[42,40,39],[39,41,42],[43,41,23],[23,26,43],[44,42,41],[41,43,44],[28,43,26],[26,5,28],[30,44,43],[43,28,30],[45,46,30],[30,29,45],[47,48,46],[46,45,47],[49,50,34],[34,33,49],[51,52,50],[50,49,51],[53,49,33],[33,36,53],[54,51,49],[49,53,54],[55,53,36],[36,38,55],[56,54,53],[53,55,56],[57,55,38],[38,40,57],[58,56,55],[55,57,58],[59,57,40],[40,42,59],[60,58,57],[57,59,60],[61,59,42],[42,44,61],[62,60,59],[59,61,62],[46,61,44],[44,30,46],[48,62,61],[61,46,48],[65,66,63],[63,64,65],[68,65,64],[64,67,68],[70,68,67],[67,69,70],[72,70,69],[69,71,72],[74,72,71],[71,73,74],[76,74,73],[73,75,76],[78,76,75],[75,77,78],[66,78,77],[77,63,66],[81,82,79],[79,80,81],[83,84,82],[82,81,83],[86,81,80],[80,85,86],[87,83,81],[81,86,87],[89,86,85],[85,88,89],[90,87,86],[86,89,90],[92,89,88],[88,91,92],[93,90,89],[89,92,93],[94,95,84],[84,83,94],[96,97,95],[95,94,96],[98,94,83],[83,87,98],[99,96,94],[94,98,99],[100,98,87],[87,90,100],[101,99,98],[98,100,101],[102,100,90],[90,93,102],[103,101,100],[100,102,103],[106,107,104],[104,105,106],[108,109,107],[107,106,108],[111,106,105],[105,110,111],[112,108,106],[106,111,112],[115,116,113],[113,114,115],[117,118,116],[116,115,117],[107,115,114],[114,104,107],[109,117,115],[115,107,109],[119,120,109],[109,108,119],[121,122,120],[120,119,121],[123,119,108],[108,112,123],[124,121,119],[119,123,124],[125,126,118],[118,117,125],[127,128,126],[126,125,127],[120,125,117],[117,109,120],[122,127,125],[125,120,122],[131,132,129],[129,130,131],[135,136,133],[133,134,135],[138,135,134],[134,137,138],[140,138,137],[137,139,140],[142,140,139],[139,141,142],[144,142,141],[141,143,144],[146,144,143],[143,145,146],[132,146,145],[145,129,132],[149,150,147],[147,148,149],[151,152,150],[150,149,151],[154,149,148],[148,153,154],[155,151,149],[149,154,155],[157,154,153],[153,156,157],[158,155,154],[154,157,158],[160,157,156],[156,159,160],[161,158,157],[157,160,161],[163,160,159],[159,162,163],[164,161,160],[160,163,164],[166,163,162],[162,165,166],[167,164,163],[163,166,167],[169,166,165],[165,168,169],[170,167,166],[166,169,170],[150,169,168],[168,147,150],[152,170,169],[169,150,152],[66,65,171],[65,68,171],[68,70,171],[70,72,171],[72,74,171],[74,76,171],[76,78,171],[78,66,171],[172,173,174],[175,172,174],[176,175,174],[177,176,174],[178,177,174],[179,178,174],[180,179,174],[173,180,174]]; 
    box
    PHP Code:
    //actionscript mesh export
    var vtx:Array = new Array();//the vertex positions {x,y,z}'s
    vtx = [{x:-65,y:35,z:0},{x:-1,y:35,z:0},{x:-65,y:99,z:0},{x:-1,y:99,z:0},{x:-65,y:35,z:64},{x:-1,y:35,z:64},{x:-65,y:99,z:64},{x:-1,y:99,z:64}];

    var 
    fcs:Array = new Array();//the triangle faces and their vertex id's
    fcs = [[0,2,3],[3,1,0],[4,5,7],[7,6,4],[0,1,5],[5,4,0],[1,3,7],[7,5,1],[3,2,6],[6,7,3],[2,0,4],[4,6,2]];

    var 
    tVtx:Array = new Array();//the texture vertex positions {x,y}'s
    tVtx = [{x:0.339291,y:0.339291},{x:0.660709,y:0.339291},{x:0.339291,y:0.660709},{x:0.660709,y:0.660709},{x:0.01,y:0.331418},{x:0.331418,y:0.331418},{x:0.01,y:0.00999999},{x:0.331418,y:0.00999999},{x:0.339291,y:0.99},{x:0.660709,y:0.99},{x:0.339291,y:0.668582},{x:0.660709,y:0.668582},{x:0.668582,y:0.99},{x:0.99,y:0.99},{x:0.668582,y:0.668582},{x:0.99,y:0.668582},{x:0.331418,y:0.660709},{x:0.01,y:0.660709},{x:0.331418,y:0.339291},{x:0.01,y:0.339291},{x:0.331418,y:0.99},{x:0.01,y:0.99},{x:0.331418,y:0.668582},{x:0.01,y:0.668582}];

    var 
    tFcs:Array = new Array();//the texture faces and their texture vertex id's
    tFcs = [[0,2,3],[3,1,0],[4,5,7],[7,6,4],[8,9,11],[11,10,8],[12,13,15],[15,14,12],[17,16,18],[18,19,17],[21,20,22],[22,23,21]]; 

  18. #18
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    and finally

    pyramid
    PHP Code:
    //actionscript mesh export
    var vtx:Array = new Array();//the vertex positions {x,y,z}'s
    vtx = [{x:232,y:83,z:64},{x:200,y:51,z:0},{x:264,y:51,z:0},{x:264,y:115,z:0},{x:200,y:115,z:0}];

    var 
    fcs:Array = new Array();//the triangle faces and their vertex id's
    fcs = [[0,1,2],[0,2,3],[0,3,4],[0,4,1],[4,3,2],[2,1,4]];

    var 
    tVtx:Array = new Array();//the texture vertex positions {x,y}'s
    tVtx = [{x:0.743453,y:0.254728},{x:0.984852,y:0.01334},{x:0.50203,y:0.0133368},{x:0.0147988,y:0.0171982},{x:0.492629,y:0.0171982},{x:0.492629,y:0.495028},{x:0.0147988,y:0.495028},{x:0.984876,y:0.496119},{x:0.502054,y:0.496116}];

    var 
    tFcs:Array = new Array();//the texture faces and their texture vertex id's
    tFcs = [[0,1,2],[0,2,8],[0,8,7],[0,7,1],[6,5,4],[4,3,6]]; 

  19. #19
    President PhobiK's Avatar
    Join Date
    Jan 2005
    Location
    Guatemala
    Posts
    918
    great enginge render! Thanks for sharing your knowledge with all of us
    This is MC. His _parents sent him to stop() by the super market to buy some _root beer if he wanted to gotoAndPlay() with his friends at the park later.

    This is my Blog!... The gaming Process
    Please check out my site: Giddel Creations

  20. #20
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Impressive work, there. Saved to disk!
    http://www.birchlabs.co.uk/
    You know you want to.

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