User Tag List

Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 30

Thread: 3D techniques in MMF2

  1. #1
    Clicker Multimedia Fusion 2
    SEELE's Avatar
    Join Date
    Jul 2007
    Location
    Terra australis incognito
    Posts
    1,916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    3D techniques in MMF2

    [color:#003300][size:17pt]3D techniques in Multimedia fusion 2 [/size][/color]


    [color:#003300]Basic 3d

    Before making a 3D game it is essential to comprehend how implementing 3D will effect what you
    already know.

    Anyone who has used MMF should have a good grasp of 2D; 'X' being left and right and 'Y' being up
    and down; here is a simple example including a 'Z' axis acting as forward and backward.

    Example: Link

    In this example we are positioning and scaling each object as such:

    [color:#660000]X = "320+(x_( "Active" )/z_( "Active" ))"
    Y = "240+(y_( "Active" )/z_( "Active" ))"
    Scale = "1.0/z_( "Active" )"[/color][/color]
    [color:#003300]
    In 2D we consider 0x,0y to be at the top left of the screen,
    in 3D '0' is always considered the center of the screen, so by adding half the screens width "320"
    to the 'X' position and half the screens height "240" to the 'Y' position we effectively make 0x,0y
    the center of the screen.

    The second part of positioning;
    [/color][color:#660000]
    X = "320+(x_( "Active" )/z_( "Active" ))"
    Y = "240+(y_( "Active" )/z_( "Active" ))"[/color]
    [color:#003300]
    Involves taking the 'X' and 'Y' dimensions and dividing them by the 'Z' dimension, remember
    that 'Z' in this example represents how far the object is from the camera, and the further an
    object is, the closer it is to the center of the screen (0)

    The first and final part of scaling;
    [/color][color:#660000]
    Scale = "1.0/z_( "Active" )"[/color]
    [color:#003300]
    simply makes the object smaller as it's distance from the camera becomes larger.


    polygons in 3d

    Positioning and scaling objects may give a sense of 3 dimensions, however not all 3D
    geometry can be displayed this way.

    Polygons are closed shapes (eg. triangle's) which are drawn at runtime, this example uses
    polygons and the above principles to draw a cube.

    Example: Link

    In this example the 'X' and 'Y' positing is slightly more complex; now we have included
    'CAMX', 'CAMY' and 'CAMZ', the camera can now me manipulated.
    This is done by simply subtracting the cameras coordinates from the objects coordinated.


    OpenGL in MMF2

    MMF2's 3d capabilities are currently being expanded on; one example of this is the
    integration of OpenGL into mmf2

    Information and download link: here

    OpenGL is a powerful and widely accepted display engine; capable of drawing polygons in
    3D.

    Polygons (or polys) are drawn by defining 'vertex's'; points in space.

    For example the vertex's:

    [/color][color:#660000][x,y,z]
    0,0,-3
    1,0,-3
    1,1,-3[/color]
    [color:#003300]
    [image]http://img246.imageshack.us/img246/3607/opengltriexample.th.jpg[/image]

    would draw a triangular poly just infront of the camera; to the top right of the screen.


    Just as we can move the camera in the previous 'cube' example so too can we move the
    camera in OpenGl; this is done by 'Translating' the matrix before drawing.

    Whenever performing an action in OpenGL it is necessary to consider the current
    matrix state as well as the effect that action will have on the Matrix.

    The previous example; using vertex's to draw a triangle, could also be written in OpenGL
    like:
    [/color][color:#660000]
    Translate 0,0,-3
    [x,y,z]
    0,0,0
    1,0,0
    1,1,0[/color]
    [color:#003300]
    Thats because translating 'Z' to -3 effectively makes '0:Z' equivalent to '-3:Z'

    OpenGL can keep track of multiple matrices by putting them onto a 'matrix stack'

    To avoid losing track or relativity of your matrix; 'push' the matrix stack before
    any redundant action then 'pop' the matrix stack after to return to where you last
    'push[ed]' it.

    Time for a working example.

    This OpenGL example generates a shaded and tiled heightmap based on several
    bitmaps and imports models into it.


    Example link
    [/color]

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,741
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: 3D techniques in MMF2

    Wow, that's really cool! Thanks for this tutorial, I'm sure it'll help a lot of people. It'd be nice if your MFA was commented, though - OpenGL is not that easy, especially not for beginners!
    The example runs rather slow - that's because of MMF. Go to the frame options and check "No display surface", you don't need it since OpenGL is drawn in a separate window. This speeds it up. Unfortunately, it's Dev-only. HWA in Direct3D works, too... but an OpenGL application that uses Direct3D to render a blank screen...? Feels pretty weird. :/

    By the way, the MFA requires you to rename OpenGL.mfx to OpenGLX.mfx?

    Oh, and you can turn off depth writing when drawing the mini-map, after you have drawn it, activate it again. That way, it'll always be at the top. I noticed that sometimes the terrain is covering it.

  3. #3
    Clicker Multimedia Fusion 2
    dragonguy's Avatar
    Join Date
    Apr 2008
    Location
    RULE BRITANNIA!
    Posts
    3,071
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 3D techniques in MMF2

    LOL a Stargate with a very impressive GHD and the terrain textures you got from Warcraft 3, it all goe's together well.

    In all- it's an ok example.

  4. #4
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,839
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: 3D techniques in MMF2

    Great article SEELE. Thank you.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  5. #5
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    Stephen's Avatar
    Join Date
    Aug 2008
    Location
    Montana
    Posts
    4,515
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: 3D techniques in MMF2

    Very helpful article, SEELE! This should help users with getting a grasp on 3D in MMF2. Good work!

    stephen1980
    _____________________________________________
    Nivram's Examples -Need extensions? Send me a PM.-


  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 3D techniques in MMF2

    Thanks for the help and thanks for fullfilling my request of this great tutorial, but the final Example is for Dev only, can you do anything to make it without RegularExpression.mfx? Also, you should rename your OpenGL.mfx file to that, because you have it as OpenGLX.mfx.

    Otherwise, thank you very much. I never thought about using that first example until now... Here's an example of it's potential for space games that I made:

    SpaceExample.mfa

    Arrow Keys to move
    Space accelerates
    Shift blasts you at light speed

  7. #7
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 3D techniques in MMF2

    These are cool but when i extract the zip mcafee detects a exe virus/worm and on running the mfa it says im missing 2 extensions.

  8. #8
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    Stephen's Avatar
    Join Date
    Aug 2008
    Location
    Montana
    Posts
    4,515
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: 3D techniques in MMF2

    One of the examples will only work if you have the Developer version of MMF2. Also, there are no viruses in any of these zips. Make sure you are not getting a false positive.

    stephen1980
    _____________________________________________
    Nivram's Examples -Need extensions? Send me a PM.-


  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Eliyahu's Avatar
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 3D techniques in MMF2

    I have McAfee and it didnt detect anything.

    One missing extension is a Dev only and the other is a misnamed OpenGL.mfx, go rename it to OpenGLX.mfx as that is what SEELE has it as.

  10. #10
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: 3D techniques in MMF2

    Yeah it is most likely a false report. I only have standard so i guess i can't run the last example, thanks for the info.

Page 1 of 3 1 2 3 LastLast

Similar Threads

  1. Zooming techniques
    By EE in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 16th June 2011, 03:26 PM
  2. Replies: 0
    Last Post: 3rd February 2010, 11:08 PM
  3. Scrolling Techniques
    By Atherton in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 1st September 2009, 12:37 PM
  4. Advanced techniques in MMF2
    By SEELE in forum Articles
    Replies: 10
    Last Post: 14th May 2009, 03:04 PM

Posting Permissions

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