A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: 3d engine redesign

  1. #1
    Senior Member
    Join Date
    Sep 2001
    Location
    bleh
    Posts
    276

    3d engine redesign

    hi guys
    i have decided to refactor and start again doing it properly..
    the process will be..
    --------------------------
    1. requirements doc
    2. use cases
    3. drawing pictures and lines (concepts)
    4. class diagrams
    5. crc cards..
    6. interaction diagrams
    7 algorithms
    8, test first coding
    9. Re iterate..
    -----------------------------

    here is the very first rough as guts req doc.

    Requirements for 3d engine
    ----------------------------------------
    import .obj models
    rotation x,y,z
    translation x,y,z
    terrain generation
    camera
    omnidirectional lighting + ambient lighting
    flat shading, gouraud shading, texture mapping
    collision detection
    frustum culling
    backface culling
    Projection to 2d screen.
    render to screen

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

    please add comments and thoughts ...
    i want to avoid feature creep at this stage..
    although anything vital please kik me.. :-)

    thank you
    steve
    <- guy sebastian , my mentor

  2. #2
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    i've found this usefull from time to time;
    http://home.planet.nl/~monstrous/

  3. #3
    Senior Member
    Join Date
    Sep 2001
    Location
    bleh
    Posts
    276
    thanks blink .. i went to that site and it is awesome..

    now to my revised doc.. please tell me if i am being unrealistic..

    Requirements for 3d engine
    ----------------------------------------
    + IMPORT .obj MODELS
    allow extensibility to add normals, materials, animation etc
    allow capacity to extend to formats such as asc, md2, 3ds
    + DATA STRUCTURES must be fast
    Linked lists - see watt appendix
    Octrees
    BSP partitioning
    + ROTATION x,y,z
    + TRANSLATION x,y,z
    + TERRAIN generation
    Sinusoidal
    Fractal
    Other ? heightmap
    + CAMERA
    + Omnidirectional LIGHTING + ambient lighting, distance- inverse %
    + flat SHADING, gouraud shading, texture mapping
    + BOUNDING BOXES - AABB ?
    + COLLISION detection
    How to detect collision with terrain?
    + FRUSTUM culling
    + BACKFACE culling
    + OPTIMISE code heavily
    Precalculate
    Single loop rendering and calcs..
    + PROJECTION to 2D screen.
    + RENDER/DRAW to screen

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

  4. #4
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    probably unrealistic for flash! however i been thinking you could make it a 50/50 deal. www.screenweaver.com is a screen saver type thingy. it allows you to call .dll's from flash. you might be able to code all the 3d stuff in C and just use flash as the render. it would all depend on the speed that screenweaver call's .dll's but i think it would be worth a try.
    btw. this is another pretty good site;http://www.flipcode.com/
    Last edited by BlinkOk; 02-06-2004 at 09:40 PM.

  5. #5
    Senior Member
    Join Date
    Sep 2001
    Location
    bleh
    Posts
    276
    hi blink.. i thought i was a bit unrealistic..
    i will have to cut it down a bit..
    although.. if i precalculate a lot.. hmm..
    probably ditch other shading and stick with flat..
    and have a very simple lighting equation..
    i think the main restriction is the number of faces..
    probably the max might be about 300 faces..
    so it will be clunky...
    but anyway.. i want the design to be non platform specific
    and i might code one in java as well...
    anfy3D is pretty awesome..
    and i been to flipcode its good..

    go the fro'

  6. #6
    Senior Member
    Join Date
    Sep 2001
    Location
    bleh
    Posts
    276
    and here are my
    ----------
    use cases
    -----------
    + Import Model Data
    - Assign the Vertices to a pointsList Data Structure ,
    - assign Faces to a faceList, normals?, colours?
    - use external pHP script
    + Create Models
    - From the data, create the model object and
    - assign the data to object class variables.
    + Rotate Model x y z
    + Translate Model x y z
    + Import Terrain Data
    - Have the ability to parse terrain data from external sources
    - use Php script
    + Create Terrain
    Assign data to terrain class object variables
    + Place Terrain in World
    - set position and relation to the engine world system
    + Place Models in World
    - Position static and moveable objects in initial positions
    + Define Moveable and static Object Types
    - Moving Objects - planes, tanks, cars, spaceships
    - Static Objects - Terrain, Buildings , trees, Fortress that fires at you(eg)
    + Create Camera
    + Set Camera to follow Object
    + Change Camera settings
    - POV, follow another object
    + Light any/all Objects
    + Shade objects
    + Create Bounding Boxes - Detect Collisions
    + Perform Backface Culling
    + Occlusion Culling ??
    + Convert to 2D Coordinates
    + Draw/Render to screen
    + Z-Sort Objects
    - Flash - use swapDepths
    - Get average Z for face - Z sort routine

  7. #7
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    problem is, any loop for 300 odd iterations, even if it is doing nothing will slow the flash player. i think the primary objective is to somehow reduce the size of the table.
    i always thought (in a landscape sitution) you could reduce the table by making it kinna tile based in that the player's depth of vision is limited to those polys that are directly in front of him.

  8. #8
    Senior Member
    Join Date
    Sep 2001
    Location
    bleh
    Posts
    276
    me and milo have been testing linked lists and he has just
    written a method for using arrays by pushing and popping..
    the linked lists are 50% faster than conventional arrays..
    and milo's arrays are about the same.. we have done tests on several hundred points and even thousands... several hundred is realistic..
    thousands of course not... doh!
    i did a 700 face poly and it was a slug.. so that seems the extreme upper limit.. but i did that before the list was optimised...
    i have got some more tests to do tomorrow..
    and mx2004 is even faster i am sure..

    probably your idea is good about excluding vision.. i guess cull
    anything beyond say a couple of thousand z.. and use inverse proportional distance lighting.. to hide it..
    use frustum culling that is extreme maybe.. ???
    how did you do your 3d demo .. the columns in that room?
    i saw strilles raycasting demo and that was pretty good..
    the doom-like one..
    Where did you guys get to with your 3d stuff.?. did you think it was not feasible.. ??
    anyway... sleep beckons
    steve

  9. #9
    Senior Member
    Join Date
    Sep 2001
    Location
    bleh
    Posts
    276
    Here is the classes and responsibilities

    Vector3D
    --------
    Store Coordinates
    Able to do Vector maths , + - * /

    Matrix
    ------
    Hold Matrix data
    create identity matrix
    Create rotation/translation matrices
    Create Scale/Shear/Deformation matrices
    Allow for matrix multiplication/concatenation

    Face
    -----
    Store list of points
    store the normal, colour
    Set visibility
    Do occlusion, frustum and backface culling

    Mesh
    ----
    Store list of faces
    set centrepoint
    set radius of bounding sphere
    Set moving flag

    Terrain
    -------
    Set up grid
    set heightmap
    set texture or colour
    find nearest neighbour - interpolate/extrapolate heights
    draw it.

    Light
    ------
    Hold the vector
    set brightness
    set ambience
    find distance from models

    Camera
    -------
    Set it up
    Attach it to a model
    set position
    reset model to look at
    set a radius or viewAngle

    Engine
    ------
    Oversee the engine
    interface or plugin for developers
    create models
    set to render
    Allow input for players
    Initialise Terrain and unmoving Models
    -------------------------------------------

    Next up is working all the class definitions,
    set the member variables and methods , what arguments they will need
    and their return types..


    thanks guy

  10. #10
    Life Member
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    87
    i've been working on terrain.. from scratch with only some scans of papers on ROAM and LOD etc.. so far it looks good but if you want you're engine to be faster and better quality than a normal sorta terrain grid u should look at my ideas ferdy... hopefully i will work more on them after i get this light stuff worked out.

  11. #11
    Senior Member
    Join Date
    Sep 2001
    Location
    bleh
    Posts
    276
    hi ross
    your terrain sounds great and i will certainly use your ideas..
    i havent even thought about how to implement LOD...
    the lighting calcs can be used in the same loop to calculate
    backface culling and frustum culling using the face normal..
    and the light vector...
    i still havent had a look at your code yet..
    i been so busy ... sorry mate..
    hopefully this weekend..
    steve

  12. #12
    Life Member
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    87
    the good thing about the terrain is you can pre-calculate the light becuase the terrain and the light always stay the same.

  13. #13
    Senior Member
    Join Date
    Sep 2001
    Location
    bleh
    Posts
    276
    aha... good thingking 99
    of course..
    back to the grindstone...

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