A Flash Developer Resource Site

Results 1 to 20 of 20

Thread: First Person Camera Engine

  1. #1
    Life Member
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    87

    First Person Camera Engine

    I've edited the source code from a tutorial about camera positioning using matrices and vectors. (it came from ultrashock.com). What i added was a cursor sort-of mover,like a real 3d fpshooter. and a fps counter. i was hoping people could take a look and post feedback in this thread, like what specs they have and what fps they get.

    i intend to do backface and frustrum culling, base the rotation sensitivity on framerate and eventually create a 3dfps out of it.


    http://www.geocities.com/alphaeee/

    i will release my edited code asap. thanks

  2. #2
    Life Member
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    87
    doesn't it work on your computers, does mine. whats wrong? no replies?

  3. #3
    Senior Member RUSHVision's Avatar
    Join Date
    Dec 2000
    Location
    Pacific Northwest
    Posts
    5,441
    No, I'm afraid it doesn't seem to work all that well on my computer. The fps evens out around 60 then goes back and forth between 62 and 63, but my pointer disappears when I enter your movie area and the object does as well. By moving my mouse around a bit I can get the object to come back, but it's not easy.

    What stats are you most interested in?
    mrush


    > .. _ .: Join the FK ARENA!:..:RUSHVision vs. JWin:. _ .. <
    ..:: "Why aren't the lockout programs working?!?...Release the monkey!" ::..

  4. #4
    Junior Member
    Join Date
    Apr 2002
    Posts
    16

    working 3d engine

    I've got about 74 fps on my computer, but it doesn't work Object is invisible 4 me. Check my engine at http://www.beta6.com ...if u got min. 1.8 Ghz CPU, 64 mb graphic card and 512 mb of ram it's the most advanced and good working 3d engine ever done

    L2 - Beta 6 Art Group

  5. #5
    Life Member
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    87
    ok, thanks a lot for feed back.

    i did make the mouse pretty sensitive and i hid the cursor, but ill just make a settings panel to control that stuff. the reason the fps will fluctuate is becuase of intensity of calculations may differ, but thats not really a big deal, just as long as fps stays above 25.

    and i checked out ur engine lucdaartist. its great, good work. but i wonder why u say its "most advanced and good working 3d engine ever done". is it somehow different than an average 3d engine?

    i was also checking out ur other stuff, very nice.
    Last edited by 03ricr; 01-21-2004 at 04:39 AM.

  6. #6
    supervillain gerbick's Avatar
    Join Date
    Jul 2000
    Location
    undecided.
    Posts
    18,986
    I got 70fps as the norm, but it looks like it's a mouse attached to an orbiting camera and not a 3D engine to me.

    [ Hello ] | [ gerbick ] | [ Ω ]

  7. #7
    Life Member
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    87
    u know u can use adsw and q,e keys? i shoulda said that before. oh well, there's another thing.. instructions. sorry bout that. it won't look like an 'orbiting' camera or what ever u mean after u play around with these controls. really, it IS a fully fledged 3d Degree of Freedom engine.

  8. #8
    Senior Member RUSHVision's Avatar
    Join Date
    Dec 2000
    Location
    Pacific Northwest
    Posts
    5,441
    Yes, some instructions would we nice. I really think you need to do something about that mouse problem. The object disappears as soon as your mouse enters the movie area and it's a real bear to get it back.
    mrush


    > .. _ .: Join the FK ARENA!:..:RUSHVision vs. JWin:. _ .. <
    ..:: "Why aren't the lockout programs working?!?...Release the monkey!" ::..

  9. #9
    Life Member
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    87
    yeah, i placed some code for that but its not living up to expectations, ill try to improve it more.

  10. #10
    Senior Member
    Join Date
    Sep 2001
    Location
    bleh
    Posts
    276
    seems to work ok..
    you just need to damp the _xmouse and _ymouse ..
    maybe divide by 100, or 500,, i have seen most mouse
    movers around about that figure..

    good luck
    steve

  11. #11
    Life Member
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    87
    ok i finished most of the code, yay. i've done backface culling and camera based lighting (to be improved to be fixed advanced lighting) and each polygon (triangle) can have a certain face colour. so that means now everything is in beta testing.. im going to change the movies fps to max and post it to my website address. i'll re-edit this post to tell u guys when its updated.

    what's more.. when i was looking around trying to make a 3d engine it was really difficult for me to find good articles. i have taken screenshots every now and then.. i will make a documentation on the buildng of my engine along with the source code to the whole engine. but first i want to clean it up and optimize it.

    here's a small preview for anyone who wants:

    t=getTimer();
    fps(t);

    y = _ymouse; x = _xmouse;
    angle_side = angle_inc * (y - prev_y)/100;
    angle_y = angle_inc * (x - prev_x)/100;
    prev_x = x;
    prev_y = y;

    -------------------------------

    // FPS COUNTER
    fps = function(t){

    frames++;
    if(t-time>1000){
    fps=frames;
    frames=0;
    time = t;
    return (fps);
    }

    }

    //RETURN TRUE IF POLY IS VISIBLE - 3d Backface culling
    face_is_visible = function(p0,p1,p2){

    nz = (p1.x-p0.x)*(p2.y-p1.y) - (p1.y-p0.y)*(p2.x-p1.x);
    if (nz<=0){
    return false;
    } else {
    return true;
    }

    //SIMPLE LIGHT FROM CAMERA

    simple_light = function(p0,p1,p2,face_col,light_col){


    nx = (p1.y-p0.y)*(p2.z-p1.z) - (p1.z-p0.z)*(p2.y-p1.y)
    ny = (p1.z-p0.z)*(p2.x-p1.x) - (p1.x-p0.x)*(p2.z-p1.z)
    nz = (p1.x-p0.x)*(p2.y-p1.y) - (p1.y-p0.y)*(p2.x-p1.x)

    N = Math.sqrt(nx*nx+ny*ny+nz*nz);

    intensity = nz/N;

    r = (face_col[0]+light_col[0])/2
    g = (face_col[1]+light_col[1])/2
    b = (face_col[1]+light_col[2])/2

    colour= intensity*r<<16 | intensity*g<<8 | intensity*b;
    return (colour);

    }

    of course when i release my source i will zip it all. good'ol winzip

    -------------

    edit::
    -------------
    i posted it however i've encountered a bug with the a,d keys which dont strafe but do something unexpected. o well ill fix it eventually. for now i'd be gratefull if anyone who looks at this will report their fps,cpu,os and give me suggestions/comments. i dont care if u say it's **** or whatever either, just be honest. thanks guys. what ull be viewing is nothing special, just a couple of jumpled triangle faces, completely randomly entered by me.

    http://www.geocities.com/alphaeee/
    Last edited by 03ricr; 01-25-2004 at 01:44 AM.

  12. #12
    Life Member
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    87
    i've fixed some bugs and just ziped the source code and everything (including dev. pics) in a file.
    Attached Files Attached Files

  13. #13
    Senior Member
    Join Date
    Sep 2001
    Location
    bleh
    Posts
    276
    hi mate,
    i have downloaded it and i will have a look..
    i tried your site example earlier but i couldnt see nothing...
    i have flash player 7 but..
    when i get the time i will send you my stuff..
    we are about up to the same ...
    i am gonna document mine as well..
    i am doing mine in AS2
    i have a vector, matrix , mesh , point2D classes..
    probably similar to yours..
    byeee
    steve

  14. #14
    Life Member
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    87
    ok, cool, we could maybe give each other advice or something? can i see urs?

  15. #15
    Senior Member
    Join Date
    Sep 2001
    Location
    bleh
    Posts
    276
    yeah sure..
    email me and i will send it ..
    i zipped my latest folder with all my research docs ..
    i am pretty sure we are using very similar coding..
    steve

    webmaster at video-animation dot com

  16. #16
    Life Member
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    87
    hey, i actually been to ur site when i was researching for map/object loading! do u use anim8tor? that's good for modeling and exporting to 5 diff file types. that also includes a .c file which can be easily edited (it only writes in triangles) to become a flash loading file.

  17. #17
    Senior Member
    Join Date
    Sep 2001
    Location
    bleh
    Posts
    276
    hi oracle
    i sent my engine..
    i am using cinema4D .. and exporting as .obj files
    and i have written a php parser to convert it to my
    methods..

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

    some or most 3d modellers (such as .3ds ) make triangulated faces..
    but cinema4d doesnt.. so i can have faces with 4 or more points..
    truespace doesnt.. but it doesnt export .obj files

    i dont know anim8or..
    but i get irate when modellers only make triangulated faces..LOL
    :-)

    anyway,
    have fun..
    steve

  18. #18
    Life Member
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    87
    the engine supports multiple point polygon faces. i am updating my site with the new engine now. it's also got better lighting ( u can specify light and ambient colour and ambient reflection/intensity).

    I also noticed that adding multipoint support makes the engine around 2x faster. i now get 61 fps rendering 3 cubes on my p4 2.6C.
    Last edited by 03ricr; 01-27-2004 at 11:15 AM.

  19. #19
    Senior Member
    Join Date
    Sep 2001
    Location
    bleh
    Posts
    276
    hi o
    yeah it should be faster because you are rendering half the number of faces..

    steve

  20. #20
    Life Member
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    87
    new source code attached, site not updated, hmmm, soon i will post all my stuff on my site. sorry.. I SHOULD display news there.
    anyway...last post on progress reports..and source, it will be on the site from now on(in a day or two).
    Attached Files Attached Files
    Last edited by 03ricr; 01-27-2004 at 11:23 AM.

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