The thing is I went the path of creating perfectly convex shapes prior using obj2sur and maxlancer
Since the days of the milkshape sur exporter I avoided concave shapes.
Obj2sur in the latest version even has the “yes I am sure that everythign is 100% convex”-option which I of course tried (without different results, sure the sur is smaller because there is no splicing but the lag remains)
I no longer use obj2sur so not much I can say there.
The station models are relative complex, with negative space for docking bays etc.
To ensure everything is convex I created a simplified version of the stations which I broke down into groups of convex shapes to mimic the overall shape. That was the adviced method ever since we were able to create own surs.
When you make a hitbox the result is always going to be an approximation and the objective is to make a rough shape of the object using fewest possible and least geometrically complex convex hulls. Generally speaking the less triangles and individual hulls the better it is for performance. Unlike rendering the game physics can’t process complex geometry, it’s all done in CPU and in case of Freelancer it happens in main thread as well. Cut the corners where you can, if you can cut the third of hulls and/or triangles - it’s worth doing in a long run. From my observation the game has some kind of internal time limits and if exceeded the game will discard some hulls in the model from further calculations.
Since I observed these issues with obj2sur I tried to use maxlancer and its sur builder. But even there I can observe these lag issues.
I tested multiple export methods.
In one method I imported the simplified sur model with convex geometry groups from a different program and then exported it with maxlancer
In a different try I allowed the sur builder to generate the convex hull shapes, then exported the model with the sur.
There seem to be multiple export options in maxlancer… I tested them all.
In every case I am able to reproduce the lag issue by bumping my ship into the station often enough. Depending on the method used it takes a bit longer to break the game.
I am not sure what I am overlooking right now.
The use of maxlancer was adviced to me by somebody helping me with some refresh of older 3d models but even there I noticed that his models which purely were done with the surface builder can trigger the lag issue.
Without looking at problematic models you refer to I can’t say for sure what might be the cause.
The BVH tree you mentioned (correct me if I am wrong) is the color coded stuff you get when enabling the hierarchy option on the sur import in maxlancer, right?
BVH (Boundary Volume Hierarchy) is a pre-calculated BSP-like tree for collection of hulls in a single part and is an element of optimization to perform faster lookups in collision detection code. In maxlancer there’s a debug option in import dialog to display and color code BVH nodes. White/grey is normal, yellow means hull geometry is outside node and red means node hull is completely outside node boundary. Yellow isn’t always a sign of problem, if geometry barely sticks out that’s fine. Red however means its hull is most likely not going to work. Most problems with .sur generated by obj2sur working partially were related to it having errors in BVH calculation (nodes would often have erroneous offset by X axis making boundary either partially covering hull or entirely missing it). My post here explains it further.
I discussed this possibility as error source with 2 other modders a few weeks ago.
If so, is there a way to fix this?
Hard to say because since in disco we pretty much remade and re-exported all hitboxes. I have not heard of lags specific to collisions since then.
Even the surs generated by the surface builder of maxlancer have these yellow and red boxes sometimes. I am not sure how to avoid that. The one post I was able to find about that was not so clear to us.
Sure, yellow boxes can sometimes occur because boundary parameters are stored in .sur with reduced bit depth, so there’s loss of accuracy, but the game accounts for that and it should not be a problem if hull generally fits within its node box. In theory maxlancer should not produce those “red nodes” at all. If somehow it does that then fill a bug report and provide assets where it happens - I’ll look into it. Meshes produced by surface builder are not intended to be manipulated afterwards (other than deleting if you didn’t like the result and want to redo).