A Flash Developer Resource Site

Results 1 to 17 of 17

Thread: [Beta] 3D engine

  1. #1

    [Beta] 3D engine

    I've been lurking here for a while now and thought I would finally contribute a little.

    This is a 3D engine I created for part of a recent school project. It has simple shading and can read OBJ files with help from PHP. point and line Hit detection is also in there but not shown in this demo.

    check it out


    www.aaronspjut.com/3d_engine/index.html

  2. #2
    Start a Revolution al hack's Avatar
    Join Date
    Jan 2004
    Location
    Mexico
    Posts
    290
    hmm, the engine look nice.

  3. #3
    -= phil =- d3s_inc's Avatar
    Join Date
    Oct 2002
    Posts
    610
    reminds me of my 3d attempts...

    eh.. looks good =), gets a bit skippy at high speeds, but pretty good!

  4. #4
    doItLikeThis
    Join Date
    Jan 2004
    Location
    :noitacoL
    Posts
    1,080
    Hoobahh.......very cool man!!! Don't mind me though, Iam a junior member.
    -Aditya

  5. #5
    thanks!

    This is what it was used for:
    www.aaronspjut.com/projects/beatpoint/index.html

    We called it a "multi media instrument". Its basically a experimental thing-a-mujig that makes sounds and looks neat. Sorry if its hard to figure out. The question mark will show instructions.

    you can click on the cube in the middle to rotate it.

  6. #6
    Junior Member
    Join Date
    May 2002
    Posts
    0
    Nice start!

    *.obj is a 3D format I assume. Can you explain the PHP thing? Does it read the file and send bitmaps to Flash at runtime?

    Thanks alot,
    jtnw

  7. #7
    yep OBJ is a 3D file formate.

    There are no bitmaps involved anywhere. Its all drawn with flash's drawing API.

    It really sounds a lot cooler than it is. OBJ files are just a list of the points and a list of the faces. A cube looks like this:



    v 0 0 0
    v 200 0 0
    v 200 200 0
    v 0 200 0
    v 0 0 200
    v 200 0 200
    v 200 200 200
    v 0 200 200
    f 1 2 3 4
    f 8 5 1 4
    f 8 7 6 5
    f 2 6 7 3
    f 1 5 6 2
    f 8 4 3 7

    The php just parses that and spits out a string that flash can understand when accessed with loadVariables(). like this:

    note: this doesn't match the above OBJ file but its still a cube

    "v,-50,-50,-50:v,50,-50,-50:v,50,50,-50:v,-50,50,-50:v,-50,-50,50:v,50,-50,50:v,50,50,50:v,-50,50,50:f,1,2,3,4:f,8,5,1,4:f,8,7,6,5:f,2,6,7,3:f ,1,5,6,2:f,8,4,3,7"

    It made for a great presentation at the end of the class. I got to say that my flash engine could read files exported by all the top Modeling software including Maya and Max. Although I wouldn't recommend trying to render a 10,000 poly model with flash

  8. #8
    Junior Member
    Join Date
    May 2002
    Posts
    0
    Wow, that is simple... nice.

    I actually was looking for a way to import 3D objects that were low poly count, this seems to be perfect.

    Thanks again,
    jtnw

  9. #9
    Ihoss
    Guest
    hmmm, im working on something simelar. Mine is a vector only 3d engine that i got to run at around 30 fps. I will use it for a tank game and i hope to develop it further into a 3d flying game. I'll put together a neat version of it when i get home (im messing around with colision detection now).

  10. #10
    Here is a good doc on the OBJ file formate

    http://astronomy.swin.edu.au/~pbourke/geomformats/obj/

    and here is just about every other formate

    http://astronomy.swin.edu.au/~pbourke/geomformats/

  11. #11
    Senior Member
    Join Date
    Sep 2001
    Location
    bleh
    Posts
    276
    Here is my php script for loading .obj files//

    http://video-animation.com/flash3d_002.shtml

    steve

  12. #12
    Ihoss
    Guest
    You guys seem to know a lot about 3D in flash, so maybe you know how to make relative rotation. By this i mean rotation aorund all axis relative to the cam. For example in a flying game you want to pitch the plane up around the z axis, or roll it around the x axis. Now what about if the plane has turned 90 degrees, then the planes x axis is the worlds z axis, so if you rotate it around the x axis, it will actually pitch. Is there a way of fixing or doing this?

  13. #13
    free-webmaster-resource.com deamothul's Avatar
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    1,475
    Originally posted by ferdymania
    Here is my php script for loading .obj files//

    http://video-animation.com/flash3d_002.shtml

    steve
    hehe hiya steve, before reading your post i was gona post yours

  14. #14
    ********* mentuat's Avatar
    Join Date
    Mar 2002
    Location
    out of office
    Posts
    717
    the music/beat thing is great! nice one

  15. #15
    You guys seem to know a lot about 3D in flash, so maybe you know how to make relative rotation. By this i mean rotation aorund all axis relative to the cam. For example in a flying game you want to pitch the plane up around the z axis, or roll it around the x axis. Now what about if the plane has turned 90 degrees, then the planes x axis is the worlds z axis, so if you rotate it around the x axis, it will actually pitch. Is there a way of fixing or doing this?
    I like to think of it as rotating the entire world in front of a stationary camera. So base all objects in the scene from one main scene origin. Then rotate, translate, manipulate, the scene origin to get the view you want. A camera would be a saved position of the scene origin.

  16. #16
    Ihoss
    Guest
    The way i do it is that i store the cams position in the world, then find the difference between an object and the cam. What about for other objects. if i rotate something 45' around the x axis then 90' around the y axis, then it will not look the way it should (see my plane example).

  17. #17
    I think your getting into Gimble lock territory a problem of Euler angles. Quaternions are one method of avoiding this. Although I haven't implemented this yet so all I can do is provide the links.

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