Skip to content

VBM Export

Dreamer edited this page Jun 21, 2022 · 2 revisions

Installation

  • Go to Edit > Preferences > Add-ons.
  • Click on Install on the top right.
  • Navigate to the DmrVBM folder.
  • Click on DmrBlender_VBM.zip and click Install Add-on.
  • Find the imported addon and enable it by clicking its checkbox.
    - Type "dmr" in the search box if you don't see it.
    - Make sure the Community box is highlighted on the top.
  • Click the settings box on the bottom-left and click "Save Preferences" to keep the addon after closing Blender.
  • Close the Preferences Window.
  • The export panel can be found in Properties > Scene Properties.
  • Should be in the bottom area on the right of the screen. If not, the Editor Type can be set to Properties with the top left button of any area.
    • Shift + F7 also works.

Vertex Buffer Export Dialog

When ready to export a vertex buffer, click on Export VB or Export VBM. You will be presented with this dialog. (Window on right has Show More Options expanded):

Export Panel

Adjust the fields on the right side of the dialog to customize file export:

Simple Options

  • Collection - Group of objects to export. This can be the currently selected objects, a collection in the current scene, or an export list.
  • Batching - Allows multiple file exports in one call. Can export by object name, mesh name, or by material.
    • When doing batch export, filenames are a joined string based on batch type: "<object/materialname>.vb(m)"
  • Grouping (VBM Only) - Join exported vertex buffer data by object or material.
  • Delimiter - Character that marks the end of a group or batched name. Data is joined by the final name.
    • For example, say the delimiter is set to a single hyphen '-'. If batching or grouping by material and two separate materials have names like "body-leg" and "body-arm", the final name for the vb data will be "body" for both, meaning their data will join together before exporting.
  • Export Armature (VBM Only) - Write armature data to VBM file. If off, bone count will be 0.
  • Apply Armature - Allows the Armature modifier to be applied when preparing vb data.
    • Usually leave on for static exports, off for rigged exports (Using Bone Indices + Weights).
  • Deform Only - Only export bones with the Deform box checked.

Vertex Attributes

  • POSITION (3* Floats) - Positions of vertices in world space.
  • UV (2 Floats) - Texture coordinates of mesh loops.
  • NORMAL (3 Floats) - Normals of mesh loops. Uses split normals if present.
  • TANGENT (3 Floats) - Tangents of mesh loops. Useful for normal mapping.
  • BITANGENT (3 Floats) - Bitangents of mesh loops. Useful for normal mapping.
  • COLOR (4* Floats) - Loop color values as floats. Order is RGBA.
  • COLORBYTES (4 Bytes = Size of 1 Float) - Loop color values as bytes. Order is RGBA.
  • BONE (4* Floats) - Corresponding bone indices for vertex groups as floats.
  • BONEBYTES (4 Bytes = Size of 1 Float) - Corresponding bone indices for vertex groups as bytes.
  • WEIGHT (4* Floats) - Vertex weights set from vertex groups as floats.
  • WEIGHTBYTES (4 Bytes = Size of 1 Float) - Vertex weights set from vertex groups as bytes.
  • VERTEXGROUP (1 Float) - Vertex weights from named vertex group. A default value can be set for objects without the named group.

For scripting, vertex attribute parameters are vbfX, with X being a number from 0 to 7. The following share the same rule:

  • Attribute Size = attribsizeX
  • Target Color Layer = vclyrX
  • Target UV Layer = uvlyrX
  • Target Vertex Group = vgroupX

More Options

  • Export Hidden - Include hidden objects in target collection for export.
  • Edges Only - Export mesh as a wireframe without triangulation.
  • Flip Normals - Reverse winding order of faces to invert normals.
  • Flip UVs - Flips the Y-coordinate of uvs so that 0.0 is the top of the image and 1.0 is the bottom. On by default for GMS2.
  • Default Weight - Default weight for Vertex Group attribute when an object does not contain the selected group.
  • Color Source - Default vertex color layer for the COLOR and COLORBYTES attributes.
    • Can be set to Render, Selected, or a specific layer.
  • UV Source - Default uv layer for the UV attribute.
    • Can be set to Render, Selected, or a specific layer.
  • Modifier Source - Determines which modifiers will be enabled on export.
    • Viewport Only - Only export modifiers visible in viewports.
    • Render Only - Only export modifiers visible in renders.
    • Viewport or Render - Export modifiers if they are visible in viewport or renders.
    • Viewport and Render - Export modifiers only if they are visible in viewport and renders.
    • All - Export all modifiers.
  • Scale - Vector to scale the exported model.
  • Up Axis - The "Up" direction of the model. Blender is +Z Up, GMS2 is -Y Up.
  • Forward Axis - The "Forward" direction of the model. Blender is +Y Forward, GMS2 is +Z Forward.
  • Max Subdivisions - Maximum number of subdivisions for Subdivision Surface modifier.\n(-1 for no limit).
  • Compression - Level of zlib compression to apply to export. 0 for no compression, -1 for default compression (5), 9 for max compression.
    • No compression (0) will export without the zlib headers.