Free BlueBurn AssetCreator - easy import of models into your 3D projects

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

  1. kraifpatrik

    kraifpatrik Member

    Jun 23, 2016
    BlueBurn AssetCreator


    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)
    • 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.
    Load script for BBMODs
    Compatible with both GM:S1.4 and GMS2.
    /// @func b_bbmod_load(file[, format[, sha1]])
    /// @desc Loads a model from a BBMOD file into a vertex buffer.
    /// @param {string} file     Path to the BBMOD file.
    /// @param {real}   [format] An id of a vertex format of the model. If not
    ///                          specified, a new vertex format will be built based
    ///                          on the information in the header of the BBMOD.
    /// @param {string} [sha1]   Expected SHA1 of the BBMOD file. If the actual one
    ///                          does not match with this, then the model will not
    ///                          be loaded.
    /// @return {real} The id of the created vertex buffer or -1 on fail.
    var _file    = argument[0];
    var _vFormat = undefined;
    if (argument_count > 1)
        _vFormat = argument[1];
    var _sha1    = undefined;
    if (argument_count > 2)
        _sha1    = argument[2];
    if (!is_undefined(_sha1))
        if (sha1_file(_file) != _sha1)
            return -1;
    var _buffer = buffer_load(_file);
    buffer_seek(_buffer, buffer_seek_start, 0);
    var _vBuffer = -1;
    var _version = buffer_read(_buffer, buffer_u8);
    if (_version == 0)
        var _hasVertices = buffer_read(_buffer, buffer_bool);
        var _hasNormals  = buffer_read(_buffer, buffer_bool);
        var _hasUVs      = buffer_read(_buffer, buffer_bool);
        var _hasColours  = buffer_read(_buffer, buffer_bool);
        var _hasTangentW = buffer_read(_buffer, buffer_bool);
        var _vertexCount = buffer_read(_buffer, buffer_u32);
        if (is_undefined(_vFormat))
            if (!variable_global_exists("__bVertexFormats"))
                global.__bVertexFormats = ds_map_create();
            var _mask = (_hasVertices
                | _hasNormals  << 1
                | _hasUVs      << 2
                | _hasColours  << 3
                | _hasTangentW << 4);
            if (ds_map_exists(global.__bVertexFormats, _mask))
                _vFormat = global.__bVertexFormats[? _mask];
                if (_hasVertices)
                if (_hasNormals)
                if (_hasUVs)
                if (_hasColours)
                if (_hasTangentW)
                    vertex_format_add_custom(vertex_type_float4, vertex_usage_textcoord);
                _vFormat = vertex_format_end();
                global.__bVertexFormats[? _mask] = _vFormat;
        _vBuffer = vertex_create_buffer_from_buffer_ext(
            _buffer, _vFormat, buffer_tell(_buffer), _vertexCount);
    return _vBuffer;

    Shader template for BBMODs
    Note: This is only necessary when using the bbmod files, which have to be rendered using vertex_submit! D3D / MOD files can be loaded and rendered as you are used to, there's no other necessary setup.
    // Comment out if you don't have tangent and bitangent sign in you vertex format.
    #define USING_TBN
    #ifdef USING_TBN
    #define in_TangentBitangentSign in_TextureCoord1
    attribute vec4 in_Position;             // (xyzw)
    attribute vec3 in_Normal;               // (xyz)
    attribute vec2 in_TextureCoord0;        // (uv)
    attribute vec4 in_Colour;               // (rgba)
    #ifdef USING_TBN
    attribute vec4 in_TangentBitangentSign; // (, bitangentSign)
    varying vec2 v_vTexcoord;
    varying vec4 v_vColour;
    #ifdef USING_TBN
    varying mat3 v_mTBN;
    void main()
        gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * in_Position;
        #ifdef USING_TBN
        vec3 N = (gm_Matrices[MATRIX_WORLD] * vec4(in_Normal, 0.0)).xyz;
        vec3 T = (gm_Matrices[MATRIX_WORLD] * vec4(, 0.0)).xyz;
        vec3 B = (gm_Matrices[MATRIX_WORLD] * vec4(
            cross(in_Normal, * in_TangentBitangentSign.w, 0.0)).xyz;
        v_mTBN = mat3(T, B, N);
        v_vColour = in_Colour;
        v_vTexcoord = in_TextureCoord0;
    // Comment out if you don't have tangent and bitangent sign in you vertex format.
    #define USING_TBN
    varying vec2 v_vTexcoord;
    varying vec4 v_vColour;
    #ifdef USING_TBN
    varying mat3 v_mTBN;
    uniform sampler2D u_texNormal; // Tangent-space normal map
    void main()
        vec4 diffuse = v_vColour * texture2D(gm_BaseTexture, v_vTexcoord);
        #ifdef USING_TBN
        vec3 N = normalize(v_mTBN * (texture2D(u_texNormal, v_vTexcoord).xyz * 2.0 - 1.0));
        // Your lighting code here...
        // E.g.:
        // vec3 L = vec3(1.0, 0.0, 0.0);
        // float NoL = max(dot(N, L), 0.0);
        // diffuse.rgb *= NoL;
        gl_FragColor = diffuse;

    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, use the provided script. 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 the provided shader template.

    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]
    Last edited: Oct 10, 2019
  2. lolslayer

    lolslayer Member

    Jun 23, 2016
    good stuff
  3. Ali Al - Mosawi

    Ali Al - Mosawi Member

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

    kraifpatrik Member

    Jun 23, 2016
    lolslayer and Ali Al - Mosawi like this.
  5. kraifpatrik

    kraifpatrik Member

    Jun 23, 2016
    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.

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

    A little test in GML.

    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

    Jun 23, 2016
    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.

    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

    Jun 23, 2016
    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.

    Bob with lamp (MD5), available from here:
    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!
    DBenji, ❤️×1, 2Bad Games and 3 others like this.

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