Skip to content

Releases: Richard01CZ/MafiaBlenderToolkit

Mafia Blender Toolkit 1.0.2

Choose a tag to compare

@Richard01CZ Richard01CZ released this 29 Sep 22:27

A projector projects

A projector carries no mesh: it is a volume and a material, and the game works out as it draws which surfaces the volume overlaps, maps the texture across it and paints them. Blender has nothing of the kind, so the viewport drew the outline and left the rest to the imagination. It now draws the paint — onto the surfaces the volume covers, against the depth the viewport already has, so it lands on what can be seen and stops at the first thing in the way.

Everything the mode decides comes with it:

  • the volume — Orthographic, a box the same width all the way through, or Perspective, the pyramid inscribed in it, sized by the frame's own scale;
  • the depth falloff — constant, or full at the near face and gone at the far one, or nothing at either face and full between;
  • the blend — added to the surface, or drawn over it.

The texture is the one the material builds, so the transparency a material keeps in a second image is part of what is painted, and a colour key cuts its own colour out. Project Textures in the 4DS Model tab turns the whole thing off; it is drawing only and changes nothing that is written.

Measured rather than eyeballed — rendered into an offscreen buffer looking straight down at a floor: a box two units across covers 3.92 m² against the 4.00 it should (one pixel of the buffer), twice as wide is four times the area, the pyramid ends exactly as wide as the box, a floor past the reach takes nothing at all, and the falloffs read 0.000 at the far face for both the linear and the triangular, 0.498 half way down for the linear and 1.000 for the triangular.

One thing the viewport cannot do. Blender composites an overlay over the scene rather than adding into it, so an Additive projector cannot brighten the surface it lands on. Its brightness is carried in its opacity instead: black shows nothing, the brightest paint shows fully, and the falloff fades it away rather than blackening it. The shape, the texture, the falloff and where it stops are exact; only the brightening is not, which shows on a light surface more than a dark one. Alpha Blend is exact. Said plainly in the panel, the guide and the manual rather than left to be discovered.

Also in this release

  • The volume is named for its shape. The panel offered a Straight On tick, which said nothing about what it picked between. It is two buttons now — Orthographic and Perspective — named the way the engine names them. The stored value is unchanged.
  • New made the wrong kind of material. The picker on a projector, and the one on each lens flare element, used Blender's own New — which makes a material the add-on knows nothing about: no flags, and none of the graph that previews what the game draws. All three pickers now offer a button that makes one set up the way the game reads it.
  • A projector's Material Settings ran into its own settings. Opening the material drew its rows into the same box as the falloff and the blend, so the two read as one list. The projector's own settings come first now, and the material's sit in a box of their own.
  • The shader warned on every build. Two matrices are the only push constants left — 128 bytes, all a backend has to promise — and the settings ride in a uniform block.

Documentation

  • The Field Manual had no projector section at all. It has one now.
  • The wiki has pages of their own for Lights and Projectors, a line for cameras which nothing covered, and a walk-through of switching a model's light on in game — both halves of what the .4ds and the mission's scene2.bin have to agree on, with the two traps that cost the most time.

Tested

What Result
Checks 285 passed, 0 failed
Models, format layer 3,123 exact, 2 refused for their version
Animations, format layer 2,695 exact — 52,132 tracks, 13.7M keys
Animations, back through Blender 2,690 compared, every key within a 32-bit step
Movement tracks 283 exact, 10 refused for their version
Shadows 37 exact
Playback all 33 models with an animation of their own, and 48 character runs, identical

Requires Blender 5.2 or newer.

Mafia Toolkit 1.0.1

Choose a tag to compare

@Richard01CZ Richard01CZ released this 29 Sep 11:11

Seven fixes to how animation is written, all found on a hand-animated model.

Fixed

  • An object keyed by hand was written at the world's origin. Its place lives in the very channels an animation keys, and the export put those back to nothing — right for a model opened from a file, which keeps its place in the Delta Transform, wrong for anything keyed with the I key. It is now written standing where the viewport shows it at the moment of the export, and the report names every object placed that way.
  • Parenting was ignored by the animation export. Blender stores an offset when you parent an object with Ctrl+P, and a frame holds the whole step from the frame above it. Anything parented that way played its animation as far out of place as its parent stands from the origin.
  • An object hung on a bone went through different arithmetic than the model export used for the same frame. Both now measure through one anchor, so the two can never place a frame differently.
  • A rotation's sign was rewritten. A quaternion and its negative are the same rotation and the game reads a pair the same way whichever sign they carry — except at a turn of exactly half a circle, where the sign is the only thing saying which way round to go. A sign read out of a file is now carried through untouched.
  • A model written with its animation left the travel behind. The export now offers Write Its Track beside Write Its Animation, on by default, and writes the .tck under the same name.
  • The count of animated objects was worked out after the animation had been set aside, so it always came to zero and never warned. A model full of movement could go out saying it had none, and the game only opens the .5ds beside a model when that count is above zero.
  • A scene not on 25 frames a second is refused rather than warned about. An animation numbers its keys in frames and carries no rate of its own, so keys from another clock play at another speed; the 25 fps button is the one-press fix and leaves your keys where they are.

Proven over everything the game ships

What Result
Models, format layer 3,123 exact, 2 refused for their version, 0 failed
Animations, format layer 2,695 exact — 52,132 tracks, 13.7M keys
Animations, back through Blender 2,690 compared, every key within a 32-bit step
Movement tracks 283 exact, 10 refused for their version
Shadows 37 exact — 110 pieces, 3,935 triangles
Playback all 33 models with an animation of their own, and 48 character runs, identical
Checks 283 passed, 0 failed

Requires Blender 5.2 or newer.

Mafia Toolkit 1.0.0

Choose a tag to compare

@Richard01CZ Richard01CZ released this 27 Sep 16:59

Mafia Toolkit 1.0.0 - a Blender add-on for Mafia's model formats.

Download mafia-toolkit-1.0.0.zip below, then in Blender: Edit > Preferences > Add-ons > Install from Disk, pick the zip, switch it on, and set the Texture Folder in its preferences to the game's maps directory.

Needs Blender 5.2 or newer.

What it does

  • All four formats, in and out: .4ds models, .5ds animations, .tck movement tracks, .6ds shadows.
  • 15 of the 17 frame types and all nine visual sub-types - meshes and LODs, sectors and portals, occluders, dummies, targets, lights, billboards, mirrors, lens flares, projectors, morphs, joints and skinned characters.
  • Round-trips byte for byte: a model imported and exported again comes back identical, the save date aside.
  • Says what is wrong before it writes - Check 4DS Scene runs every export check without writing a file, and each refusal carries a suggested fix.
  • Characters: the skeleton preset, influence boxes with draggable handles, and weights painted by hand or made from the boxes.
  • The MBT CLI, for driving the add-on without a window: mbt --open model.4ds --gui.

Tested against everything the game ships

What Files Result
Models, through Blender 3,125 round-trip identical
Models, format layer only 3,125 3,123 exact, 2 refused for their version
Animations 2,695 all exact - 52,132 tracks, 13.7M keys
Movement tracks 293 283 exact, 10 refused for their version
Shadows 37 all exact

Documentation

The User Guide is the way in; the Field Manual is the reference, with four more pages beside them. The wiki covers the same ground in shorter pages.