1. Hey! Guest! The 32nd GMC Jam will take place between Feb 22nd, 12:00 UTC (Friday noon) and Feb 25th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

SMF - 3D collisions, animation, materials and level editor - Now works in HTML5!

Discussion in 'Work in Progress' started by TheSnidr, Feb 14, 2017.

  1. The-any-Key

    The-any-Key Member

    Joined:
    Feb 2, 2017
    Posts:
    1,465
    Hi.
    The FBX parser is done.
    Sent via PM.

    Exported FBX from blender with a dummy texture and animation:
    3DScene.gif
    The JSON will look like this:
    https://drive.google.com/open?id=107fTVTJynJ1ShMmN8R7hMX24ufoTYkvW

    Whenever the end of a key or "elem_props_type" is "_map" it is a ds map and "_list" it is a ds list. So it will be easier to use the data.

    The elem_props_data_list and elem_props_type_list is synced.
    Ex:
    if elem_props_type_list[0]="unsigned_int_8_list"
    The elem_props_data_list[0]=a ds list with unsigned int 8

    Ex of use a list:
    Code:
    var elem_list=The elem_props_data_list[0];
    show_debug_message(elem_list[| 0]);
    
    Code:
    "elem_props_data_list": [
        [
            1.0,
            1.0,
            -1.0,
            1.0,
            -1.0,
            -1.0,
            -1.0,
            -1.0,
            -1.0,
            -1.0,
            1.0,
            -1.0,
            1.0,
            0.999999,
            1.0,
            0.999999,
            -1.000001,
            1.0,
            -1.0,
            -1.0,
            1.0,
            -1.0,
            1.0,
            1.0
        ]
    ],
    "elem_props_type_list": [
        "float_64_list"
    ],
    
    Now it is a whole other story to actually try to make some sense of this data.
     
    Last edited: Nov 28, 2018
    DBenji likes this.
  2. TheSnidr

    TheSnidr Heavy metal viking dentist GMC Elder

    Joined:
    Jun 21, 2016
    Posts:
    426
    I will resume my quest for importing popular animation formats as soon as I'm done with the rewrite of the system! :D
    With the new system, you will indeed be able to do procedural animation. It will have scripts for modifying bones and creating animations on the fly. I will also attempt to make the inverse kinematics seen in the editor available through code.

    Though the rewrite mainly is to make the scripts more accessible, I'm also having fun overhauling the controls!
    [​IMG]
     
    hippyman, Bart, Micah_DS and 8 others like this.
  3. MrPr1993

    MrPr1993 Member

    Joined:
    Nov 22, 2016
    Posts:
    90
    Oh, wow, that's amazing! UwU
     
  4. NoobsWeStand

    NoobsWeStand Member

    Joined:
    Jun 20, 2016
    Posts:
    142
    sorry to poke you again.

    I was playing around with the shadows, but I couldn't get things that have alpha in the texture to work:
    [​IMG]

    I tried modifying the sh_smf_shadowmap fragment shader like this:
    varying float v_vDepth;
    varying vec2 v_vTexcoord;
    void main()
    {
    vec4 baseCol = texture2D(gm_BaseTexture, v_vTexcoord);
    if (baseCol.a < 0.01){discard;}
    gl_FragColor = vec4(vec3(floor(v_vDepth * 255.0) / 255.0, fract(v_vDepth * 255.0), fract(v_vDepth * 255.0 * 255.0)),baseCol.a);
    }
    but it was still the same result.
    I am not great at shaders, but I gave it my best shot

    texture: https://www.dropbox.com/s/pt8mjotngs6uhit/texTree0.png?dl=0
    obj: https://www.dropbox.com/s/iyjar7h7vvs0hd5/tree0d.obj?dl=0
    smf: https://www.dropbox.com/s/e5m3sqjq3kjlhr8/tree0.smf?dl=0


    edit: never mind. I am a poopy head. I realized that when updating the shadow map, I was not inputting a texture
     
    Last edited: Dec 3, 2018
    FoxyOfJungle and TheSnidr like this.
  5. TheSnidr

    TheSnidr Heavy metal viking dentist GMC Elder

    Joined:
    Jun 21, 2016
    Posts:
    426
    Here's the source to the model tool as it is at the moment, in case anyone's interested. I got pretty far with the rewrite, almost all scripts have been rewritten. Instead of just being an animation engine, it's now more like an animation framework. Creating rigs and animations on the fly is now possible through code.

    I want to continue working on this, but I can't keep spending as much time as I have been on this project. Updates will be sparse, and as such, I'd like to share what I already have, even though it's not completed.
    Here's some WIP documentation for the animation part of the engine:
    https://www.dropbox.com/s/o5wku78dc40anr8/SMF Animation System 0.9.9 docs Unfinished.pdf?dl=0
     
  6. Joe Ellis

    Joe Ellis Member

    Joined:
    Aug 30, 2016
    Posts:
    662
    Aw thats really sad, are you too busy with work? Well I hope you have time in the future to finish everything, I mean you started it with a whole idea and it deserves to get finished, especially with everything you've done so far
     
    FoxyOfJungle likes this.
  7. DBenji

    DBenji Member

    Joined:
    Sep 20, 2016
    Posts:
    33
    Thanks a million times over. My suggestion was just a luxury we could all do without and yet you still managed to pull it off. Mad props to you.
     
    FoxyOfJungle likes this.
  8. FoxyOfJungle

    FoxyOfJungle Member

    Joined:
    Jul 18, 2018
    Posts:
    8
    Please answer,
    What version did you use of Game Maker Studio 2 in this project? Because when I click on open a 3d model (FBX or OBJ), this don't works.
    If it's not too much of a hassle, can you make the ".exe" available to the current editor? Thank you so much, I hope you've read it.
     
  9. TheSnidr

    TheSnidr Heavy metal viking dentist GMC Elder

    Joined:
    Jun 21, 2016
    Posts:
    426
    I've just spent so much of the little spare time I have thinking about ways to improve this system. I need a break from it, that's all!
    It was a good suggestion though :D\
    What happens when you load an obj file? Does it give an error or fail to load without errors? If the latter, check the debug messages it's outputting to see what went wrong.
    I removed the limited FBX importer in the open source version of the model tool, since I don't own the rights to share the DLL I used.
     
    DBenji likes this.
  10. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,174
    How about loading gltf?
    It's a fairly simple format based in json and binary vertex data.
    Would be a perfect fit for this project, even if it only imports a subset of gltf.
     
    TheSnidr and DBenji like this.
  11. The-any-Key

    The-any-Key Member

    Joined:
    Feb 2, 2017
    Posts:
    1,465
    Can you put it on bitbucket or github? So we can help out? To allow potential code contributions to the project.
    Also, if you need funds to allow push more time to the project. I am sure people interested will help out.
    And if your brain is in "Ahh-soon-I-AM-FINISHED-with-this-thing!-I-can-start-to-slow-down-now" mode. Or "Ohh-no!-NOT-THIS-again" mode. Swap your thinking. Make a mini game and put in on itch.io or learn something completely new.
     
    CameronScottCreations likes this.
  12. FoxyOfJungle

    FoxyOfJungle Member

    Joined:
    Jul 18, 2018
    Posts:
    8
    I'm not on the computer right now, but it gives me an error loading, and then deletes things from the view, like the grid, the model, and so on.
    Anyway, I just wanted the compiled application, just to use it in my current project. I thank you very much if you can.


    I loved the idea of putting it on Github.
    I'm good at interface design, it would be an honor to make a cool interface for the editor!
     
  13. Zeritum

    Zeritum Member

    Joined:
    Dec 27, 2018
    Posts:
    1
    Hiya,

    Just discovered this project yesterday and my oh my it's incredible, you're doing great work! Thanks so much for making this available for free
    Testing it out and I've come across a problem though, I made a model in Blender and imported it, rigged it, skinned it, etc but when it came to animation one of the meshes in the model had disappeared?

    This is how it appears in every other tab:
    [​IMG]

    And this is how it appears in the animation tab:
    [​IMG]

    Not sure whether it's an issue with the model or the program, or just something I've done unknowingly, but I would appreciate some help :)

    Thanks!
     
  14. TheSnidr

    TheSnidr Heavy metal viking dentist GMC Elder

    Joined:
    Jun 21, 2016
    Posts:
    426
    Excellent suggestion! Seems like a simple format, will look into it.
    Another excellent suggestion! Github it is! Gonna polish a bit more, and then put it up there.
    Tbh I don't really need to make money from this project, so funding isn't the issue. For the past few months I've spent nearly all my spare time working on this. I'd rather spend some more time with my gf, work out and get in shape, and less time staring at the computer.
    If the model importer doesn't work in the project file, it won't work in a compiled version either! :p
    I'll need to know what kind of error you're getting, or even better, send me the model file you tried to load so that I can figure out what makes that different.
    The current interface is a bare-bones interface made many years ago for a level editor for a game I made (Race Friend), so a visual update would certainly be welcome :D
    Thank you! The chest most likely disappears because it has no skinning info. Try using autoskin on the entire model and see if this fixes it!
     
  15. FoxyOfJungle

    FoxyOfJungle Member

    Joined:
    Jul 18, 2018
    Posts:
    8
    First Image: When I open the model.
    Second Image: When I click ignore error.
    Third Image: When I click in somewhere in the window.

    Attention: the same happens with ".obj".
    My model works perfectly, I've used it in other programs, and I've downloaded it.
     

    Attached Files:

    • 000.PNG
      000.PNG
      File size:
      174.3 KB
      Views:
      12
    • 001.PNG
      001.PNG
      File size:
      207.4 KB
      Views:
      11
    • 002.PNG
      002.PNG
      File size:
      242.6 KB
      Views:
      11
  16. TheSnidr

    TheSnidr Heavy metal viking dentist GMC Elder

    Joined:
    Jun 21, 2016
    Posts:
    426
    The error was caused by a silly mistake in my code! It should be able to load obj files now:
    https://www.dropbox.com/s/m5xydtf456ppb93/SMF Model Tool v0.99 Unfinished 2.yyz?dl=0
    I've also fixed the scripts for saving and loading collision meshes to/from buffers!

    Keep in mind though, the system isn't as "complete" as the old version, not all functions are present.
     
  17. TheSnidr

    TheSnidr Heavy metal viking dentist GMC Elder

    Joined:
    Jun 21, 2016
    Posts:
    426
    I'm currently in the final phase of separating the collision system from the rest of the SMF environment entirely!
    The collision system has seen a complete rewrite in the last couple of months, and is now much more efficient than it has ever been. Here are some of the major changes:
    • The collision system no longer depends on the SMF system. You can feed it your own vertex buffers, using your own vertex formats, and it will generate a collision mesh for you.
    • It now supports a number of different geometry subdivision types. Simply specify which type you want in the creation script, and the system will keep track of it for you, no extra scripts necessary. The following types are supported at the moment:
      • None: The mesh is not subdivided at all, and collision checks will check every triangle of the mesh
      • Lattice: A 3D grid structure. This stores info about empty space as well, and you can use this to point to the nearest region containing triangles. Useful for Mario Galaxy type 3D games
      • Spatial hash: A map structure storing sparse geometry data as sections in space. Similar to lattice, except it does not store empty space.
      • Quadtree: Splits the mesh recursively in the x and y dimensions. Useful for flat meshes with varying geometric density
      • Octree: Splits the mesh recursively in all three dimensions. Useful for complex models with varying geometric density
    • Each subdivision type supports ray casting. The method for ray casting on the different types differs, but they all use the same script.
    • The colmesh can be scaled, rotated and translated in real time. To get technical about it, it's not actually the colmesh that gets transformed, but the collision shape that gets transformed by the inverse of the transformation matrix, and then transformed back at the end. This does as such not support non-uniform scaling, all dimensions must be scaled equally. It does also not support shear.
    • There are scripts for writing and reading the colmesh to/from a buffer, giving you total control over how you save your colmeshes.
    • You can now check for collisions between ellipsoids and colmesh! Useful for tall units. The problem with this is that the ellipsoid slides down hills slower than a sphere.
    • Collision scripts no longer define hundreds of arrays for each collision. It now uses local variables instead, which is how it always should have been. I got a bit crazy with the arrays in my quest to shorten the code as much as possible, but then I recently found out that this slowed the system down drastically. I've gone away from arrays as much as possible.
    • No more buffer usage in real time. Buffers are slow. Instead, I use grids, maps and lists wherever they fit best. Saving and loading takes a little more time because of this, but in-game speed is much more important IMO.
    • You can perform collisions and ray casting within a region. This is useful for complex collision checking with multiple checks and ray casts, since you only have to get the region once. The most costly part of ray casting is looping through the regions the ray crosses, so this is a super way of optimizing when you only need short-range rays.
    The file also includes some optimized scripts for primitive collisions (sphere-sphere, sphere-cube, sphere-torus).
    There's also an early version of another standalone asset called SMF Basics, which contains scripts for manipulating vertex buffers. It has a basic obj-importer, some scripts for creating normals and tangents, and aims to be a low-level tool for model processing.

    I plan to make a separate topic for the collision system once it's done and ready for the Marketplace. Until then, here's a demo for you to play around with:

    Download SMF Collisions v0.99

    Crude documentation
     
    Last edited: Jan 20, 2019
    Mert, DBenji, Dacker and 6 others like this.
  18. Christian Price

    Christian Price Member

    Joined:
    Apr 24, 2017
    Posts:
    5
    Newest version doesn't work. It crashes when I try to export .smf files.
    Code:
    ___________________________________________
    ############################################################################################
    FATAL ERROR in
    action number 1
    of  Step Event0
    for object oRigSystem:
    
    global variable name 'editorModelName' index (100202) not set before reading it.
    at gml_Script_press_buttons
    ############################################################################################
    --------------------------------------------------------------------------------------------
    stack frame is
    gml_Script_press_buttons (line -1)
    gml_Object_oRigSystem_Step_0
    Also it won't allow me to Save rigs nor load rigs. When I click on them nothing happens.
    Do you think you could link all versions of this program?

    EDIT:
    Nevermind, went through the thread and found the fix.
     
    Last edited: Jan 23, 2019
  19. FoxyOfJungle

    FoxyOfJungle Member

    Joined:
    Jul 18, 2018
    Posts:
    8
    There is a problem when I try to import an .obj model:

    ___________________________________________
    ############################################################################################
    FATAL ERROR in
    action number 1
    of Draw Event
    for object oRigSystem:

    string_copy argument 1 incorrect type (undefined) expecting a String (YYGS)
    at gml_Script_draw_buttons (line 118) - str = string_copy(mtlName, 1, 16);
    ############################################################################################
    --------------------------------------------------------------------------------------------
    stack frame is
    gml_Script_draw_buttons (line 118)
    called from - gml_Object_oRigSystem_Draw_64 (line 56) - draw_buttons()

    I can't figure it out.
     
  20. johndoe88

    johndoe88 Member

    Joined:
    Aug 1, 2016
    Posts:
    8
    How is the FBX importer coming along?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice