1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice
  2. NOTICE: We will be applying a Xenforo update on Tuesday 25th of February. This means that from approximately 10:00 to 14:00 BST the forums will be offline (or possibly longer). Sorry for the inconvenience! Official Announcement here.

Free BBAC - 3D model loader

Discussion in 'Work in Progress' started by kraifpatrik, Mar 11, 2019.

  1. kraifpatrik

    kraifpatrik Member

    Joined:
    Jun 23, 2016
    Posts:
    153
    BlueBurn AssetCreator

    Screen0.png

    AssetCreator (further as BBAC) is a new addition to the family of 3D gamedev tools for GameMaker used internally in our team BlueBurn (BBP, PushEd). Using this tool you can easily manage game assets created in third-party programs and export them into formats compatible with GameMaker: Studio 1.4 and GameMaker Studio 2.

    Stage of development
    BBAC is currently in a very early stage of development, but it already is making our GM3D gamedev life easier. Here is a list of its current features:
    • Import models using Assimp (OBJ, FBX, COLLADA, ...)
    • Import of GameMaker: Studio 1.4 d3d / mod models
    • Automatic calculation of tangent and bitangent vectors for tangent-space normal mapping
    • Flip texture UV coordinates, change location, rotation, scale; vertex colour blending
    • Export to obj, d3d / mod
    • Import and export of our custom bbmod format that allows for configurable vertex buffer formats (for both GM:S1.4 and GMS2)
    TODOs
    • Move code base to C++ (where it makes sense)
    • Materials
    • Brushes - create simple models from blocks, ellipsoids, etc.
    • Join multiple meshes into single model
    • Collision shapes
    • Animations
    • Asset format that will contain all asset info - mesh, material, collision shape, etc.
    Please note that the list of features and TODOs can still change drastically, as the tool really is in an early development stage.

    Installation
    To add resources required for loading and rendering of BBMOD files into your project, use Catalyst, the open-source package manager for GameMaker Studio 2:
    Code:
    catalyst install blueburn-cz/bbmod
    
    For d3d and mod files in GMS1.4 this is not required. Resources for loading and rendering of BBMODs in GMS1.4 are no more officially distributed, but they can be easily backported.

    Tutorial
    The workflow and controls are pretty intuitive and straight forward. Untill we create a tutorial in some proper format, please, referr to the following text or post your questions here or on our Discord.
    • After starting BBAC, a simple project browser shows up. These are custom project files (*.bbproj) that will be shared between all of our future tools. Create new or open an existing project here.
    • To import resources into the project, right click into the content browser and select import mesh / texture. A little window with options will pop up. After selecting the file to import and setting the options up, click import.
    • Drag and drop mesh from the Content Browser into the viewport to instantiate it. You can instantiate multiple meshes, but at the end only one of them (the selected one) can be exported at time!
    • You can now modify the mesh using the Details panel on the right or the tools at the top of the screen.
    • When you're done, use Ctrl + E to export the selected model. A little window will pop up, where you can specify the output path and file format, vertex format for BBMODs and whether you want to apply the current transformation etc. After setting this up, click export.
    • Exported d3d / mod models can be rendered in GM:S1.4 right away using d3d_model_load and d3d_model_draw without any additional setup.
    • To load a BBMOD file, use script b_bbmod_load from the BBMOD Catalyst package. It will create a new vertex buffer (and a matching vertex format, if not given as an argument). This vertex buffer can be then rendered using vertex_submit. Before the vertex_submit, you should first set a shader that accepts the vertex format. You can create your own shaders using included shader template.

    Changelog
    EA 2019.10.3
    • Updated Assimp to v5.0.0
    EA 2019.10.2 Hotfix
    • Fixed list of supported file formats
    EA 2019.10.1
    • Loading of 3rd-party formats using Assimp
    EA 2019.10.0
    • Fixed *.obj loader issues
    EA 2019.3.1 Hotfix
    • Fixed bug where indices used to access vertices were used to access normals when saving BBMODs
    EA 2019.3.0
    • First public release

    All constructive feedback is welcome!
    If you experience any issues with BBAC or you have an idea on how to improve it, please, do not hesitate and let us know!

    [​IMG] [​IMG]
    [​IMG]
     
    Last edited: Feb 15, 2020
  2. lolslayer

    lolslayer Member

    Joined:
    Jun 23, 2016
    Posts:
    695
    good stuff
     
  3. Ali Al - Mosawi

    Ali Al - Mosawi Member

    Joined:
    Jun 20, 2016
    Posts:
    57
    Thank you very much I will check it tomoro im interesting to test materials and collision
     
  4. kraifpatrik

    kraifpatrik Member

    Joined:
    Jun 23, 2016
    Posts:
    153
    lolslayer and Ali Al - Mosawi like this.
  5. kraifpatrik

    kraifpatrik Member

    Joined:
    Jun 23, 2016
    Posts:
    153
    Hey everyone, when this thread is in the WIP section, I realized I maybe could write some development logs between releasing new versions of the tool, so here it is, my first devlog!

    Porting code base over to C++
    Throughout the many years I've been working with GM, I've always been writing everything in pure GML, without using any DLLs (except for the 39dll in those times :D), as I felt like it was a part of pushing the boundaries of GM. But recently, while working on BBAC, I realized how beneficial it could be to write specific code in C++ instead and that avoiding it just for sake of "being pure GML" does not really help anything. BBAC is a Windows only tool anyways, not a cutting edge game or a tech demo. And so I decided that I will port some of the code base over to C++ (like D3D / MOD and BBMOD loading), as well as create some new libraries that will allow us to do things that are impossible with pure GML.

    Job system
    One of the biggest GM's disadvantages is that it does not support multithreading. Right now, If you have a lot of bigger models in your BBAC project, the entire application freezes until they are all loaded. To address this, I've been working on a multithreaded job system in C++. The system is pretty simple, first there are created as many threads as there are CPU cores. Each thread takes a job from a shared queue, executes it and then puts it into another queue, which is then accessed from GML (to know that the job has been finished and to get it's result). The jobs themselves are also written in C++ and they are spawned from GML. Here is a little example of a SleepJob, that just makes the thread that is executing it sleep for given number of seconds.

    JobsCpp.PNG
    The job's definition in C++, alongside a function that allows for it to be spawned from GML.

    JobsGML.png
    A little test in GML.

    SleepJobs.gif
    The output of the test. The application window remains being fully interactive throughout the entire time.

    In BBAC, this job system will be mainly used for import and export of models.

    Using Assimp to load third party model formats
    Until now, all BBAC was able to import was OBJ models, and only in a limited form (they had to be triangulated, had to have normals, etc.). Fortunately, there is an amazing open source library called Assimp, which allows to load practically any format ever, including the industry standard FBX (you can see the whole list in the link). Part of the DLL that I'm working on is a wrapper for this library. As I'm writing this, I already have a working version of a loader of mesh hierarchies, including their transformation matrices.

    Next up will be loading materials, skeletons and animations. BBAC will then of course also support to export the loaded models into a custom binary format, which will be more suitable for in-game use and will be loadable without the DLL. Since rendering of objects consisting of multiple meshes and / or animated models is a bit more complicated and requires more scripts, you can also expect that there will be an example GM:S1.4 and GMS2 project with the scripts included.

    I think that's all I have for now! Thanks for comming by and speding your time by reading my first little devlog. It's already kinda too late for me and I'm sleepy, so it's hopefully not too poop :D
     
    Last edited: Mar 22, 2019
    DBenji, RujiK, CMAllen and 1 other person like this.
  6. kraifpatrik

    kraifpatrik Member

    Joined:
    Jun 23, 2016
    Posts:
    153
    A new version EA 2019.10.2 EA 2019.10.3 (there was an error in the list of supported files, please download again!) has been released! BBAC now utilizes Assimp to load 3rd-party file formats like OBJ, FBX, COLLADA and many more! Animations, materials etc. are not yet supported. If a loaded file consists of multiple meshes, they are all joined into one.

    unknown.png
    Doomguy from Quake 3 Arena (*.md3)

    • *.3d
    • *.3ds
    • *.3mf
    • *.ac
    • *.ac3d
    • *.acc
    • *.amf
    • *.ase
    • *.ask
    • *.assbin
    • *.b3d
    • *.blend
    • *.bvh
    • *.cob
    • *.csm
    • *.dae
    • *.dxf
    • *.enff
    • *.fbx
    • *.glb
    • *.gltf
    • *.hmp
    • *.ifc
    • *.ifczip
    • *.irr
    • *.irrmesh
    • *.lwo
    • *.lws
    • *.lxo
    • *.md2
    • *.md3
    • *.md5anim
    • *.md5camera
    • *.md5mesh
    • *.mdc
    • *.mdl
    • *.mesh
    • *.mesh.xml
    • *.mot
    • *.ms3d
    • *.ndo
    • *.nff
    • *.obj
    • *.off
    • *.ogex
    • *.pk3
    • *.ply
    • *.pmx
    • *.prj
    • *.q3o
    • *.q3s
    • *.raw
    • *.scn
    • *.sib
    • *.smd
    • *.stl
    • *.stp
    • *.ter
    • *.uc
    • *.vta
    • *.x
    • *.x3d
    • *.x3db
    • *.xgl
    • *.xml
    • *.zae
    • *.zgl
     
    Last edited: Oct 9, 2019
    DBenji, MilkMan5x, RujiK and 3 others like this.
  7. kraifpatrik

    kraifpatrik Member

    Joined:
    Jun 23, 2016
    Posts:
    153
    Alright, since the last post I've been focused on loading of scene-graphs (models consisting of multiple meshes, each with their own transformation) as well as animations and I can happily say that I got them working! It took a few fights with Assimp's confusing data structures and row-major vs column-major matices and their multiplication order issues in GM, but it was worth it.

    [​IMG]
    Bob with lamp (MD5), available from here: https://www.katsbits.com/download/models/md5-example.php
    Currently it's all in a very rought state and I still have a lot of work to do till the next release, but you can expect that when it comes out, you will be able to load your animated fbx, collada, md5, you-name-it models into your GM games. There will be some GM-imposed limitations like maximum number of bones per model, but since I'm making this to work on any target platform, using only GML + GLSL ES, I can't do any workarounds for that. Hope you like the progress so far, see you next time! Cheers!
     
    IGameArt, RujiK, Yal and 6 others like this.
  8. kraifpatrik

    kraifpatrik Member

    Joined:
    Jun 23, 2016
    Posts:
    153
    Updates: As we are continuously moving all of our projects to GMS2, we have discontinued distribution of scripts and shaders for loading and rendering BBMOD files in GMS1.4. The resources now have their own GitHub repository here https://github.com/blueburn-cz/BBMOD and they can be added into your GMS2 project using Catalyst. The resources are released under the MIT license, so their backport for GMS1.4 and redistribution is possible, but won't be done officially by the BlueBurn team.
     

Share This Page