Simplified and streamlined reading and writing of vectors, quaternions and matrices with conversion between Freelancer and 3ds Max coordinate systems reducing redundant matrix operations.
Minor improvements to .sur generation.
Improved exceptions messages to better indicate origin of issue.
Fixed incorrect normals export which would occur when LOD mesh matrix rotation did not match rotation of the rigid part helper.
Added "Force Zero Center" checkbox in Rigid part helper to force its LODs bounding sphere center to zero. Enable when exporting starspheres, otherwise camera can end up off center.
Special treatment of null VMeshRefs (references with no groups/indices, null meshID) used by parts without LODs.
Fixed inverted textures bug that would occur when importing models without previously exported textures (bug was related to 3ds Max bitmap caching).
Fixed bug where submaterials in LOD mesh without faces would still generate empty mesh groups.
"Remove Duplicates" has been changed to "Keep Duplicates" in Import Rigid Model dialog window.
Improved compatibility with some non-vanilla models.
Added support for offset in revolute joint (be aware most other tools either ignore or incorrectly apply it).
New features:
Import Character tool to import complete character costumes (body, head, left and right hands).
New Alignment Tool (sidebar). Primarily intended to align hardpoints/helpers to mesh surface but also can be used for any scene objects.
New Resize Model Tool (sidebar). Resizes model, relocating and upscaling as needed.
New Surfaces Tool (sidebar). Generate convex hull(s) from mesh selection. For each mesh object a convex hull is generated and optionally merged into single resulting mesh.
Important changes regarding hitbox hulls:
Surface meshes no longer have or need special attributes to designate them as such, instead any editable mesh found in Rigid part helper will be used as hitbox unless it is marked as LOD mesh. Hardpoint flag is determined by presence of a hardpoint matching mesh name.
p.s. Still just a zip with files, postponed installer till next update.
Automatic hitbox BHV validation (new feature for upcoming release)
Pretty much everyone at some point had a nasty surprise of having a shot that clearly was going to hit a ship hull but instead it passed through as if nothing was there. And so the subject of hitboxes and the issues with them come up time and time again. One thing I'd like to separate right away is when something like this happens because of network lag but that's a different story altogether. This is just about situation when lag isn't the cause, like you're firing a stationary object.
For a long time it was a manual and tedious testing, unfortunately it's least effective too.
First let's look what goes into .sur file. A hitbox file contains one or more parts. These parts correspond to parts of compound model hierarchy in multipart models (main hull, wings, engine, base doors, etc). Each such part will have bounding sphere and bounding box that must contain everything else in their volumes. Center of that sphere is also used as center of mass and target point when object or individual part is being targeted in game. These spheres used in initial test and also used for visibility check to perform offscreen culling.
Next each part in hitbox is broken into one or more individual convex hulls. A convex hull is a mesh that isn't concave. Because any concave shape can be broken into multiple convex shapes hitboxes are made of those. This is a standard procedure for practically any rigid body physics, modern games continue to use the same approach (with a few adjustments and optimizations). To avoid performing costly tests on every individual hull they form up a hierarchy of bounding box volumes. In this structure every node must be within the volume of its parent node while any leaf node have convex hulls associated to them. This way hierarchy is used to determine which hulls must be tested while discarding the rest. This part of optimization is very common.
Think of this hierarchy as boxes stacked inside other boxes. Now should a box (that is supposed to be inside another) has its position and dimensions physically placing it partially or completely outside the holding box this isn't going to work right for the algorithm. Collision detection relies on having this data be valid. It can tolerate some margin of error, things don't have to be bit perfect but there's only so much window for error before results become invalid.
For a longest time the only viable tool Freelancer community had at its disposal was obj2sur, which processed input .obj file into .sur. Unfortunately it has a few very nasty bugs and one in particular results in generating invalid hierarchy where some individual nodes will have invalid position offset causing them to be partially or completely outside of parent node boundary. The offset drift has accumulative effect meaning the more hulls a part has the more likely the entire sections will be cut off erroneously. And that's why shots end up passing through the hitbox.
In MAXLancer hierarchy visualization can be toggled on in Import Rigid Dialog by enabling "Volume Hierarchy" (which replaces old "BSP Nodes" checkbox).
When hull wireframe is gray - it is valid: all points are contained within immediate hierarchy node volume. Yellow means some points are outside the volume, collision may work but it can be unreliable for this hull. Red means all points are completely outside the volume and most likely this piece is going to be completely unhittable. Nodes themselves have similar color indication to mark them apart from valid ones.
Vanilla li_dreadnought, despite being one of the more complex hitboxes there are no errors.
A certain ship in mod where some parts have their volumes drifted away to the point certain hulls are completely outside their volumes.
Li_elite that was re-exported in MAXLancer (its hitbox and hierarchies within reconstructed from vanilla hulls imported into 3ds max) showing no sign of offset bug.
tl;dr: Automated hitbox testing aims to drastically reduce need for manual testing, to diagnose issues with existing hitboxes much quicker. Physics in Freelancer might be quirky but when hitboxes are made correctly it's actually quite robust, most issues stem from bugs in obj2sur. Until obj2sur is fixed or Lanceredit supports import/export all hitboxes should be made in MAXLancer instead.
- Installer (yay!)
- Performance improvement to mesh parsing and LODs buffer assembly
- BHV testing when 'Volume Hierarchy' is enabled in import rigid model dialog
- Models imported with 'Volume Hierarchy' can be re-exported with hulls meshes pulled from node hierarchies
- UTF boundary checks are temporarily disabled as it prevents importing a number of custom models with malformed UTF structures
- Fixed alignment tool and hardpoint attachment functions
- Fixed matrix scaling check ("Non-one scaling in part transform" error)
- Fixed animations export (animations were correctly listed in export dialog but weren't exported into cmp)
- Added "Ignore" option in Missing resources dialog for materials to generate placeholders
- Passing some materials properties into Standard fallback material to allow offline rendering as DirectX shader materials are rendered only in viewports
- Import materials dialog automatically checks materials in library matching material names/IDs/hashes found in selected LOD meshes or all LOD meshes in scene if none were selected prior to evoking import dialog
- Added "Overwrite matching materials in scene" in import materials dialog window to replace matching materials in scene with the ones imported
- Added predefined hull types for Hardpoints helpers (gun box, turret hemisphere and equipment cylinder) for surface export to generate hardpoint hulls
- Added "Force Convex" checkbox in export rigid model dialog to forcibly reconvex individual hulls
- Added "Rescale Model" to MAXLancer sidebar to uniformly rescale models with hitboxes, subparts and relocating hardpoints
- Added FLCRC32 hash calculator to MAXLancer sidebar for quick checks
- Additional technical messages in MAXLancer message log
Download link in first post.
ATTENTION: If you have previous version installed already please remove its files manually to avoid to version conflict:
%LOCALAPPDATA%\Autodesk\3dsMax\[3ds Max version]\ENU\scripts\MAXLancer
%LOCALAPPDATA%\Autodesk\3dsMax\[3ds Max version]\ENU\scripts\startup\MAXLancer.ms
%LOCALAPPDATA%\Autodesk\3dsMax\[3ds Max version]\ENU\usermacros\MAXLancer-*.mcr
After installation via installer is complete you will not need to make new toolbar, toolbar buttons will work as before.
Newer documentation will be posted online in a few days and I'll make a post here with URL as well as modify first post accordingly.
Later all code will be moved to github and releases will be published there.
(05-24-2020, 04:13 AM)massdriver Wrote: Works great!
however I couldnt convert images when importing with materials, it produced faulty images filled with dots but utf editor saved osurus
Thanks. Be sure you have Nvidia texture tools installed (binaries for windows obtainable from github) and path to executables (bin folder) is specified in maxlancer settings.
Also I've noticed you have overbright gamma in viewport, to fix that go into preferences and turn off Gamma/LUT (you may need to delete textures that were previously automatically extracted when importing material libraries as their gamma would be incorrect).
(06-27-2020, 09:20 PM)Eagle-Vulture Wrote: I have 3 Beta version and such problem on my 3D Max 2018, how to solve?
That's normal.
Go to Customize - Customize User Interface - Toolbars.
In category select "MAXLancer".
Drag and drop icons to main toolbar (or alternatively create separate toolbar and drop there).
Among icons will be "Toolbox", click on it and MAXLancer sidebar will appear to the left.
Click on "Settings" button.
Configure paths to Freelancer, Nvidia Texture Tools binary folder (here), Shaders (by default they're installed in "maps\fx\MAXLancer" located in 3ds max installation folder).
New release brings new features and fixes to old ones.
I've been told installer was causing false positive with overzealous AV software which seem flag any installer made with NSIS. To alleviate this problem I've switched to a new installer made using Inno Setup, so far there seem to be no problem.
It may still trigger Windows SmartScreen but there's not much I can do about it. To prevent this from happening right-click on downloaded file, go into properties and to the right of security toggle "Unblock" checkbox.
Fixes:
Improved support for quaternion compression used in character animations (though lips animations for trent and juni are still off).
Surface builder no longer crashes when PhysX/MassFX cannot generate valid hull for a given set of vertices.
Fixed crash at material import occurring when no material matches were found in selected meshes.
Rigid model export dialog no longer offers to export embedded materials if they're not DirectX shaders.
Improvements:
Added support for INI/BINI reading/writing for future features.
Rigid model joint type will be determined automatically unless specified explicitly by assigned transformation controller.
Hull meshes are auto-welded when exporting to prevent near zero surface area face with ambiguous normal direction.
Added tool to flip UV maps for selected meshes.
Rigid part helpers without LODs will write zero VMeshRef (meshID and everything else is zero) for compatibility with other programs.
When importing model materials from scene and material editor are applied should they match references in model.